2020-06-26 15:17:35 +00:00
|
|
|
//
|
|
|
|
// PowerSaver.h
|
|
|
|
//
|
|
|
|
// Power saving functions.
|
|
|
|
//
|
|
|
|
|
2017-08-23 08:21:31 +00:00
|
|
|
#pragma once
|
2017-10-31 17:12:50 +00:00
|
|
|
#ifndef ES_CORE_POWER_SAVER_H
|
|
|
|
#define ES_CORE_POWER_SAVER_H
|
2017-08-23 08:21:31 +00:00
|
|
|
|
2017-07-20 07:07:02 +00:00
|
|
|
class PowerSaver
|
|
|
|
{
|
|
|
|
public:
|
2020-06-26 15:17:35 +00:00
|
|
|
enum mode : int {
|
|
|
|
DISABLED = -1,
|
|
|
|
INSTANT = 200,
|
|
|
|
ENHANCED = 3000,
|
|
|
|
DEFAULT = 10000
|
|
|
|
};
|
|
|
|
|
|
|
|
// Call when you want PS to reload all states and settings.
|
|
|
|
static void init();
|
|
|
|
|
|
|
|
// Get timeout to wake up from for the next event.
|
|
|
|
static int getTimeout();
|
|
|
|
// Update currently set timeouts after user changes timeout settings.
|
|
|
|
static void updateTimeouts();
|
|
|
|
|
|
|
|
// Use this to check which mode you are in or get the mode timeout.
|
|
|
|
static mode getMode();
|
|
|
|
// Called when user changes mode from settings menu.
|
|
|
|
static void updateMode();
|
|
|
|
|
|
|
|
// Get current state of PS. Not to be confused with mode.
|
|
|
|
static bool getState();
|
|
|
|
// State is used to temporarily pause and resume PS.
|
|
|
|
static void setState(bool state);
|
|
|
|
|
|
|
|
// Paired calls when you want to pause PS briefly until 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.
|
|
|
|
static void runningScreenSaver(bool state);
|
|
|
|
static bool isScreenSaverActive();
|
2017-08-02 19:56:33 +00:00
|
|
|
|
2017-07-20 07:07:02 +00:00
|
|
|
private:
|
2020-06-26 15:17:35 +00:00
|
|
|
static bool mState;
|
|
|
|
static bool mRunningScreenSaver;
|
2017-08-02 19:56:33 +00:00
|
|
|
|
2020-06-26 15:17:35 +00:00
|
|
|
static mode mMode;
|
|
|
|
static int mWakeupTimeout;
|
|
|
|
static int mScreenSaverTimeout;
|
2017-09-04 02:35:50 +00:00
|
|
|
|
2020-06-26 15:17:35 +00:00
|
|
|
static void loadWakeupTime();
|
2017-07-20 07:07:02 +00:00
|
|
|
};
|
2017-10-31 17:12:50 +00:00
|
|
|
|
|
|
|
#endif // ES_CORE_POWER_SAVER_H
|