Skip to content

File espos_power.h

FileList > espos_power > include > espos_power.h

Go to the source code of this file

  • #include <stdbool.h>
  • #include <stdint.h>
  • #include "esp_err.h"
  • #include "espos_power_policy.h"

Classes

Type Name
struct espos_power_status_t

Public Functions

Type Name
esp_err_t espos_power_get_status (espos_power_status_t * out)
A snapshot for the application and GET /api/v1/power.
void espos_power_hold (void)
Keep the device awake while the application does something the policy cannot see โ€” a sensor that needs two seconds to settle, a reading still on its way.
void espos_power_release (void)
esp_err_t espos_power_sleep_now (void)
Flush the SignalK stream and sleep for power.interval_s now, whatever the policy would say, except that an unconfirmed update still refuses (ESP_ERR_INVALID_STATE): sleeping would roll it back.
esp_err_t espos_power_start (void)
Start the duty cycle's task.

Public Functions Documentation

function espos_power_get_status

A snapshot for the application and GET /api/v1/power.

esp_err_t espos_power_get_status (
    espos_power_status_t * out
) 

Safe from any task. ESP_ERR_INVALID_STATE before espos_power_start().


function espos_power_hold

Keep the device awake while the application does something the policy cannot see โ€” a sensor that needs two seconds to settle, a reading still on its way.

void espos_power_hold (
    void
) 

Counted: every hold needs one release. A hold does not outlast the wake's deadline (power.awake_max_s). Safe from any task.


function espos_power_release

void espos_power_release (
    void
) 

function espos_power_sleep_now

Flush the SignalK stream and sleep for power.interval_s now, whatever the policy would say, except that an unconfirmed update still refuses (ESP_ERR_INVALID_STATE): sleeping would roll it back.

esp_err_t espos_power_sleep_now (
    void
) 

Does not return on success. ESP_ERR_NOT_SUPPORTED where there is no deep sleep (the host).


function espos_power_start

Start the duty cycle's task.

esp_err_t espos_power_start (
    void
) 

espos_start() calls this when the component is built; call it yourself after espos_start_network() in a two-phase boot. Reads the power config namespace and follows changes to it. Idempotent.



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