Skip to content

File espos_power_policy.h

FileList > espos_power > include > espos_power_policy.h

Go to the source code of this file

  • #include <stdbool.h>
  • #include <stdint.h>

Classes

Type Name
struct espos_power_policy_cfg_t
struct espos_power_policy_in_t

Public Types

Type Name
enum espos_power_decision_t
enum espos_power_why_t

Public Functions

Type Name
uint32_t espos_power_policy_deadline_ms (const espos_power_policy_cfg_t * cfg, bool timer_wake)
The uptime at which this boot gives up and sleeps whatever is still outstanding: awake_max_ms for a timer wake, window_ms + awake_max_ms after any other boot.
espos_power_decision_t espos_power_policy_decide (const espos_power_policy_cfg_t * cfg, const espos_power_policy_in_t * in, espos_power_why_t * why)
STAY or SLEEP, and why in *why (may be NULL).
const char * espos_power_why_str (espos_power_why_t why)
"off", "unconfirmed", "window", …; "?" for an out-of-range value.

Public Types Documentation

enum espos_power_decision_t

enum espos_power_decision_t {
    ESPOS_POWER_STAY = 0,
    ESPOS_POWER_SLEEP = 1
};

enum espos_power_why_t

enum espos_power_why_t {
    ESPOS_POWER_WHY_OFF = 0,
    ESPOS_POWER_WHY_UNCONFIRMED = 1,
    ESPOS_POWER_WHY_WINDOW = 2,
    ESPOS_POWER_WHY_NETWORK = 3,
    ESPOS_POWER_WHY_STREAM = 4,
    ESPOS_POWER_WHY_PUBLISHING = 5,
    ESPOS_POWER_WHY_HOLD = 6,
    ESPOS_POWER_WHY_DONE = 7,
    ESPOS_POWER_WHY_DEADLINE = 8,
    ESPOS_POWER_WHY_OTA = 9,
    ESPOS_POWER_WHY_MAX = 10
};

Public Functions Documentation

function espos_power_policy_deadline_ms

The uptime at which this boot gives up and sleeps whatever is still outstanding: awake_max_ms for a timer wake, window_ms + awake_max_ms after any other boot.

uint32_t espos_power_policy_deadline_ms (
    const espos_power_policy_cfg_t * cfg,
    bool timer_wake
) 

Saturates instead of wrapping.


function espos_power_policy_decide

STAY or SLEEP, and why in *why (may be NULL).

espos_power_decision_t espos_power_policy_decide (
    const espos_power_policy_cfg_t * cfg,
    const espos_power_policy_in_t * in,
    espos_power_why_t * why
) 

NULL cfg or in is STAY/OFF: a caller that cannot say what it knows does not get to put the device to sleep.


function espos_power_why_str

"off", "unconfirmed", "window", …; "?" for an out-of-range value.

const char * espos_power_why_str (
    espos_power_why_t why
) 



The documentation for this class was generated from the following file espos_power/include/espos_power_policy.h