21 return p ?
static_cast<uint16_t
>(p->getBatteryVoltage()) : 0;
27 return p ? p->getBatteryPercent() : 0;
33 return p ? p->isUsbConnected() :
false;
41 switch (p->getPowerSource()) {
57 return p ? p->isBatteryLow() :
false;
63 return p ? p->isBatteryCritical() :
false;
74 sm.addSleepInhibitor(plugin->id().c_str());
76 sm.removeSleepInhibitor(plugin->id().c_str());
Owned WAMR module instance + per-plugin state.
static SleepManager & instance()
Returns singleton sleep manager instance.
#define POWER_SRC_UNKNOWN
#define POWER_SRC_BATTERY
uint8_t host_charge_status(void)
Charger state machine value - one of CHARGE_*.
uint8_t host_power_source(void)
Active power source - one of POWER_SRC_*.
bool host_is_battery_low(void)
True when battery has crossed the low-warning threshold.
bool host_is_battery_critical(void)
True when battery has crossed the critical-shutdown threshold.
void host_set_sleep_inhibit(uint32_t on)
Hold or release a light-sleep inhibitor for the calling plugin. While any inhibitor is held the badge...
bool host_is_usb_connected(void)
True when USB VBUS is detected.
uint16_t host_battery_mv(void)
Battery voltage in millivolts.
#define CHARGE_NOT_CHARGING
uint8_t host_battery_pct(void)
Battery state of charge as 0..100 percent.
CDC Badge OS plugin host API - canonical C ABI contract.
void * plg_get_active_plugin(void)
IPowerManager * getPowerManagerInstance()
Returns the singleton power manager instance.
IPowerManager * getPowerManagerInstance()
Returns the singleton power manager instance.