#ifndef HWMONFAN_H_ #define HWMONFAN_H_ #include #include #include #include #include class HwmonFan : public Fan { public: HwmonFan(std::shared_ptr pwmControl, std::shared_ptr rpmSensor); void PWM(int percent) override; int RPM() override; void Label(std::string label) override; void MinPWM(int value) override; int MinPWM() override; void StartPWM(int value) override; int StartPWM() override; void ZeroFanModeSupported(bool value) override; bool ZeroFanModeSupported() override; void FindPWMLimits() override; void AdjustPWMLimits() override; void EnforceSetValue() override; json toJson() const override; const std::string toString() const override; private: bool InhibitStopPeriodExpired(); void SetPower(int percent); std::shared_ptr mPWMControl; std::shared_ptr mRpmSensor; std::string mLabel; int mMinPWM = 0; int mStartPWM = 0; bool mZeroFanModeSupported = false; std::chrono::time_point mLastAdjustmentTime; std::chrono::time_point mLastStartTime; int mSetValue = 0; bool mWasStopped = false; }; #endif // HWMONFAN_H_