Chapter 2. API Reference
esp_err_t esp_event_loop_init(system_event_cb_t cb, void *ctx)
Initialize event loop.
Create the event handler and task
Note This API is part of the legacy event system. New code should use event library API in esp_event.h
Return
• ESP_OK: succeed
• others: fail
Parameters
• cb: application specified event callback, it can be modified by call esp_event_set_cb
• ctx: reserved for user
system_event_cb_t esp_event_loop_set_cb(system_event_cb_t cb, void *ctx)
Set application specified event callback function.
Note This API is part of the legacy event system. New code should use event library API in esp_event.h
Attention 1. If cb is NULL, means application don’t need to handle If cb is not NULL, it will be call when
an event is received, after the default event callback is completed
Return old callback
Parameters
• cb: application callback function
• ctx: argument to be passed to callback
Unions
union system_event_info_t
#include <esp_event_legacy.h> Union of all possible system_event argument structures
Public Members
system_event_sta_connected_t connected
ESP32 station connected to AP
system_event_sta_disconnected_t disconnected
ESP32 station disconnected to AP
system_event_sta_scan_done_t scan_done
ESP32 station scan (APs) done
system_event_sta_authmode_change_t auth_change
the auth mode of AP ESP32 station connected to changed
system_event_sta_got_ip_t got_ip
ESP32 station got IP, first time got IP or when IP is changed
system_event_sta_wps_er_pin_t sta_er_pin
ESP32 station WPS enrollee mode PIN code received
system_event_sta_wps_fail_reason_t sta_er_fail_reason
ESP32 station WPS enrollee mode failed reason code received
system_event_sta_wps_er_success_t sta_er_success
ESP32 station WPS enrollee success
system_event_ap_staconnected_t sta_connected
a station connected to ESP32 soft-AP
system_event_ap_stadisconnected_t sta_disconnected
a station disconnected to ESP32 soft-AP
system_event_ap_probe_req_rx_t ap_probereqrecved
ESP32 soft-AP receive probe request packet
Espressif Systems 847
Submit Document Feedback
Release v4.4