|
Deki 1.3.0
Modular C++ 2D engine for embedded displays and desktop
|
Abstract interface for device power management (sleep / wake). More...
#include <IDekiPower.h>
Classes | |
| struct | SleepInfo |
Public Types | |
| enum class | State { Awake , Sleeping } |
| enum class | SleepMode { Light , Deep } |
| using | SleepCallback = std::function<void(SleepInfo)> |
Public Member Functions | |
| virtual | ~IDekiPower ()=default |
| virtual bool | Initialize ()=0 |
| virtual void | Shutdown ()=0 |
| virtual State | GetState () const =0 |
| virtual SleepInfo | GetCurrentSleepInfo () const =0 |
| virtual bool | SupportsMode (SleepMode mode) const =0 |
| virtual void | NotifyActivity ()=0 |
| virtual void | SetIdleTimeoutSec (int32_t seconds)=0 |
| virtual void | SetIdleSleepMode (SleepMode mode)=0 |
| virtual void | RequestSleep (SleepMode mode)=0 |
| virtual void | SetWakeGpio (int gpio_num, int level)=0 |
| virtual void | RegisterOnScreenOn (SleepCallback cb)=0 |
| virtual void | RegisterOnBeforeSleep (SleepCallback cb)=0 |
| virtual void | Tick ()=0 |
Abstract interface for device power management (sleep / wake).
Engine-core consumes this through the DekiPower facade. Whichever platform integration package is loaded at runtime registers its concrete driver via DekiPower::SetCurrent at init.
Sleep modes are exposed as a platform-agnostic tier (Light / Deep) so the same API serves ESP32, nRF52 etc. Each implementation maps the tiers to native modes: ESP32: Light -> esp_light_sleep, Deep -> esp_deep_sleep nRF52: Light -> System ON idle, Deep -> System OFF
The engine main loop calls Tick() once per iteration. Tick() may either block (real light sleep: function returns when wake fires) or set state to Sleeping for soft / simulated sleep on platforms without HW support; the loop checks GetState() after Tick() and skips Update / Render when sleeping.
Boot is treated as an OnScreenOn event so app code that needs to run on every wake can hook a single callback and have it cover the cold-boot path.
| using IDekiPower::SleepCallback = std::function<void(SleepInfo)> |
|
strong |
|
strong |
|
virtualdefault |
|
pure virtual |
|
pure virtual |
|
pure virtual |
|
pure virtual |
|
pure virtual |
|
pure virtual |
|
pure virtual |
|
pure virtual |
|
pure virtual |
|
pure virtual |
|
pure virtual |
|
pure virtual |
|
pure virtual |