Chapter 2. API Reference
esp_err_t esp_event_loop_init(system_event_cb_t
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
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
ESP32 station connected to AP
system_event_sta_disconnected_t
ESP32 station disconnected to AP
system_event_sta_scan_done_t
ESP32 station scan (APs) done
system_event_sta_authmode_change_t
the auth mode of AP ESP32 station connected to changed
system_event_sta_got_ip_t
ESP32 station got IP, first time got IP or when IP is changed
system_event_sta_wps_er_pin_t
ESP32 station WPS enrollee mode PIN code received
system_event_sta_wps_fail_reason_t
ESP32 station WPS enrollee mode failed reason code received
system_event_sta_wps_er_success_t
ESP32 station WPS enrollee success
system_event_ap_staconnected_t
a station connected to ESP32 soft-AP
system_event_ap_stadisconnected_t
a station disconnected to ESP32 soft-AP
system_event_ap_probe_req_rx_t
ESP32 soft-AP receive probe request packet
Espressif Systems
cb, void *ctx)
connected
disconnected
scan_done
auth_change
got_ip
sta_er_pin
sta_er_fail_reason
sta_er_success
sta_connected
sta_disconnected
ap_probereqrecved
847
Submit Document Feedback
cb, void *ctx)
Release v4.4
Need help?
Do you have a question about the ESP32-S2 and is the answer not in the manual?
Questions and answers