Refactoring and documentation
This commit is contained in:
parent
87a208d305
commit
3fb5be5a74
10 changed files with 149 additions and 75 deletions
|
|
@ -7,29 +7,54 @@
|
|||
/**
|
||||
* @brief Class handling energy saving options.
|
||||
*
|
||||
* Shut down RaspberryPi if no mouse input is detected and music player
|
||||
* Shut down device if no mouse input is detected and music player
|
||||
* has not been active or a certain time interval.
|
||||
*
|
||||
* @todo For now this does only work for Lena's RasPi, where the
|
||||
* shutdown script is positioned in a ceratin hardcoded path.
|
||||
* Enable/disable energy saving option, timeout and path of
|
||||
* shutdown script via config
|
||||
*/
|
||||
class EnergySaver : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
protected:
|
||||
EnergySaver(QObject *parent = 0);
|
||||
explicit EnergySaver(QObject *parent = nullptr) : QObject(parent) {};
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* @brief Create instance if necessary and set timeout interval.
|
||||
* @param interval Timer interval in seconds
|
||||
* @see EnergySaver::instance
|
||||
*/
|
||||
static void init(int interval);
|
||||
/**
|
||||
* @brief Implements the singleton pattern.
|
||||
* @return Instance
|
||||
*
|
||||
* If no instance has been created yet, create new instance.
|
||||
*/
|
||||
static EnergySaver *instance();
|
||||
|
||||
public slots:
|
||||
/**
|
||||
* @brief Restart shutdown timer, e.g. because of music player activiti
|
||||
*/
|
||||
void restartTimer();
|
||||
|
||||
private:
|
||||
/**
|
||||
* @brief Initialize and connect timer.
|
||||
* @param interval Timeout interval in millisecond.
|
||||
*/
|
||||
void initTimer(int interval);
|
||||
QTimer mTimer;
|
||||
|
||||
private slots:
|
||||
/**
|
||||
* @brief Behavior on timeout: shut down RaspberryPi.
|
||||
*/
|
||||
void onTimeout();
|
||||
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue