Skip to content

File espos_event.h

FileList > espos_event > include > espos_event.h

Go to the source code of this file

  • #include <stddef.h>
  • #include <stdint.h>
  • #include "esp_err.h"
  • #include "esp_event.h"

Classes

Type Name
struct espos_event_network_t
struct espos_event_ota_t
struct espos_event_sk_server_t
struct espos_event_time_t

Public Types

Type Name
enum espos_event_id_t

Public Functions

Type Name
ESP_EVENT_DECLARE_BASE (ESPOS_EVENT)
esp_err_t espos_event_post (int32_t id, const void * data, size_t size)
Post an ESPOS_EVENT to the default loop, creating the loop if nobody has yet (espos_wifi or an application may already have; that is fine).
esp_err_t espos_event_subscribe (int32_t id, esp_event_handler_t handler, void * arg)
Run handler on the default loop task for ESPOS_EVENTid (ESP_EVENT_ANY_ID for all of them).
esp_err_t espos_event_unsubscribe (int32_t id, esp_event_handler_t handler)

Public Types Documentation

enum espos_event_id_t

enum espos_event_id_t {
    ESPOS_EVENT_CONFIG_READY = 1,
    ESPOS_EVENT_HTTPD_STARTED = 2,
    ESPOS_EVENT_NETWORK_UP = 3,
    ESPOS_EVENT_NETWORK_DOWN = 4,
    ESPOS_EVENT_MDNS_READY = 5,
    ESPOS_EVENT_SK_SERVER_SELECTED = 6,
    ESPOS_EVENT_SK_TOKEN_APPROVED = 7,
    ESPOS_EVENT_SK_STREAM_CONNECTED = 8,
    ESPOS_EVENT_SK_STREAM_DISCONNECTED = 9,
    ESPOS_EVENT_OTA_AVAILABLE = 10,
    ESPOS_EVENT_TIME_SYNCED = 11,
    ESPOS_EVENT_PORTAL_UP = 12,
    ESPOS_EVENT_PORTAL_DOWN = 13,
    ESPOS_EVENT_MAX = 14
};

Public Functions Documentation

function ESP_EVENT_DECLARE_BASE

ESP_EVENT_DECLARE_BASE (
    ESPOS_EVENT
) 

function espos_event_post

Post an ESPOS_EVENT to the default loop, creating the loop if nobody has yet (espos_wifi or an application may already have; that is fine).

esp_err_t espos_event_post (
    int32_t id,
    const void * data,
    size_t size
) 

data is copied, size bytes of it; NULL/0 for events without data.

Thread-safe. Never blocks for long: waits at most a few ticks for queue space, none at all when called from the loop's own task (from inside a handler). ESP_ERR_TIMEOUT when the queue is full — the event is dropped, which callers treat as acceptable for a notification.


function espos_event_subscribe

Run handler on the default loop task for ESPOS_EVENTid (ESP_EVENT_ANY_ID for all of them).

esp_err_t espos_event_subscribe (
    int32_t id,
    esp_event_handler_t handler,
    void * arg
) 

arg is handed back untouched. The same (handler, arg) pair registered twice is called once.


function espos_event_unsubscribe

esp_err_t espos_event_unsubscribe (
    int32_t id,
    esp_event_handler_t handler
) 


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