2017-08-23 08:21:31 +00:00
|
|
|
#pragma once
|
|
|
|
|
2017-07-20 07:07:02 +00:00
|
|
|
class PowerSaver
|
|
|
|
{
|
|
|
|
public:
|
2017-08-02 19:56:33 +00:00
|
|
|
enum mode : int { DISABLED = -1, INSTANT = 200, ENHANCED = 3000, DEFAULT = 10000 };
|
|
|
|
|
2017-08-11 17:03:12 +00:00
|
|
|
// Call when you want PS to reload all state and settings
|
2017-08-02 19:56:33 +00:00
|
|
|
static void init();
|
|
|
|
|
2017-08-11 17:03:12 +00:00
|
|
|
// Get timeout to wake up from for the next event
|
2017-07-20 07:07:02 +00:00
|
|
|
static int getTimeout();
|
2017-08-11 17:03:12 +00:00
|
|
|
// Update currently set timeouts after User changes Timeout settings
|
2017-08-02 19:56:33 +00:00
|
|
|
static void updateTimeouts();
|
|
|
|
|
2017-08-11 17:03:12 +00:00
|
|
|
// Use this to check which mode you are in or get the mode timeout
|
2017-08-02 19:56:33 +00:00
|
|
|
static mode getMode();
|
2017-08-11 17:03:12 +00:00
|
|
|
// Called when user changes mode from Settings
|
2017-08-02 19:56:33 +00:00
|
|
|
static void updateMode();
|
2017-07-20 07:07:02 +00:00
|
|
|
|
2017-08-11 17:03:12 +00:00
|
|
|
// Get current state of PS. Not to be confused with Mode
|
2017-07-20 07:07:02 +00:00
|
|
|
static bool getState();
|
2017-08-11 17:03:12 +00:00
|
|
|
// State is used to temporarily pause and resume PS
|
2017-07-20 07:07:02 +00:00
|
|
|
static void setState(bool state);
|
2017-08-02 19:56:33 +00:00
|
|
|
|
2017-08-11 17:03:12 +00:00
|
|
|
// Paired calls when you want to pause PS briefly till you finish animating
|
|
|
|
// or processing over cycles
|
|
|
|
static void pause() { setState(false); }
|
|
|
|
static void resume() { setState(true); }
|
|
|
|
|
|
|
|
// This is used by ScreenSaver to let PS know when to switch to SS timeouts
|
2017-08-02 19:56:33 +00:00
|
|
|
static void runningScreenSaver(bool state);
|
2017-08-11 17:03:12 +00:00
|
|
|
static bool isScreenSaverActive();
|
2017-08-02 19:56:33 +00:00
|
|
|
|
2017-07-20 07:07:02 +00:00
|
|
|
private:
|
|
|
|
static bool mState;
|
2017-08-02 19:56:33 +00:00
|
|
|
static bool mRunningScreenSaver;
|
|
|
|
|
|
|
|
static mode mMode;
|
|
|
|
static int mPlayNextTimeout;
|
|
|
|
static int mScreenSaverTimeout;
|
2017-07-20 07:07:02 +00:00
|
|
|
};
|