/* * FanTimerControl.h * * Author: Aleksey Gerasimenko * gerasimenko.aleksey.n@gmail.com */ #include #include #ifndef SYSCTRL_FANTIMERCONTROL_H_ #define SYSCTRL_FANTIMERCONTROL_H_ namespace SYSCTRL { struct FanTimerControlConfiguration { float timer_period; FanTimerControlConfiguration(): timer_period(-1.0) {} // };//FanTimerControlConfiguration class FanTimerControl { public: enum mode_t {UNDEFINED, CONFIGURATE, OPERATIONAL}; private: mode_t m_mode; private: float m_time_sample; private: float m_timer_counter; float m_timer_period; bool m_state; public: FanTimerControl(); void setup(float time_sample); void configure(const FanTimerControlConfiguration& config); public: mode_t get_mode(); bool compare(mode_t mode); public: bool is_on(); bool is_off(); public: void execute(bool is_switched_on, bool is_switched_off); private: void (FanTimerControl::*_execute)(bool is_switched_on, bool is_switched_off); void _execute_undef(bool is_switched_on, bool is_switched_off); void _execute_operational(bool is_switched_on, bool is_switched_off); }; } /* namespace SYSCTRL */ #endif /* SYSCTRL_FANTIMERCONTROL_H_ */