36#if ESP_ARDUINO_VERSION_MAJOR >= 3
38 wifi_got_ip_handle_ = Network.onEvent(
39 [
this](arduino_event_id_t, arduino_event_info_t) {
40 ESP_LOGI(
"net_state",
"WiFi station got IP");
43 ARDUINO_EVENT_WIFI_STA_GOT_IP);
45 wifi_disconnected_handle_ = Network.onEvent(
46 [
this](arduino_event_id_t, arduino_event_info_t) {
47 ESP_LOGI(
"net_state",
"WiFi station disconnected");
50 ARDUINO_EVENT_WIFI_STA_DISCONNECTED);
52 wifi_ap_start_handle_ = Network.onEvent(
53 [
this](arduino_event_id_t, arduino_event_info_t) {
54 ESP_LOGI(
"net_state",
"WiFi soft-AP started");
57 ARDUINO_EVENT_WIFI_AP_START);
59 wifi_ap_stop_handle_ = Network.onEvent(
60 [
this](arduino_event_id_t, arduino_event_info_t) {
61 ESP_LOGI(
"net_state",
"WiFi soft-AP stopped");
64 ARDUINO_EVENT_WIFI_AP_STOP);
67 eth_got_ip_handle_ = Network.onEvent(
68 [
this](arduino_event_id_t, arduino_event_info_t) {
69 ESP_LOGI(
"net_state",
"Ethernet got IP");
72 ARDUINO_EVENT_ETH_GOT_IP);
74 eth_lost_ip_handle_ = Network.onEvent(
75 [
this](arduino_event_id_t, arduino_event_info_t) {
76 ESP_LOGI(
"net_state",
"Ethernet lost IP");
79 ARDUINO_EVENT_ETH_LOST_IP);
81 eth_disconnected_handle_ = Network.onEvent(
82 [
this](arduino_event_id_t, arduino_event_info_t) {
83 ESP_LOGI(
"net_state",
"Ethernet PHY disconnected");
86 ARDUINO_EVENT_ETH_DISCONNECTED);
90 wifi_got_ip_handle_ = WiFi.onEvent(
91 [
this](WiFiEvent_t, WiFiEventInfo_t) {
92 ESP_LOGI(
"net_state",
"WiFi station got IP");
95 WiFiEvent_t::ARDUINO_EVENT_WIFI_STA_GOT_IP);
97 wifi_disconnected_handle_ = WiFi.onEvent(
98 [
this](WiFiEvent_t, WiFiEventInfo_t) {
99 ESP_LOGI(
"net_state",
"WiFi station disconnected");
102 WiFiEvent_t::ARDUINO_EVENT_WIFI_STA_DISCONNECTED);
104 wifi_ap_start_handle_ = WiFi.onEvent(
105 [
this](WiFiEvent_t, WiFiEventInfo_t) {
106 ESP_LOGI(
"net_state",
"WiFi soft-AP started");
109 WiFiEvent_t::ARDUINO_EVENT_WIFI_AP_START);
111 wifi_ap_stop_handle_ = WiFi.onEvent(
112 [
this](WiFiEvent_t, WiFiEventInfo_t) {
113 ESP_LOGI(
"net_state",
"WiFi soft-AP stopped");
116 WiFiEvent_t::ARDUINO_EVENT_WIFI_AP_STOP);
128#if ESP_ARDUINO_VERSION_MAJOR >= 3
129 Network.removeEvent(wifi_got_ip_handle_);
130 Network.removeEvent(wifi_disconnected_handle_);
131 Network.removeEvent(wifi_ap_start_handle_);
132 Network.removeEvent(wifi_ap_stop_handle_);
133 Network.removeEvent(eth_got_ip_handle_);
134 Network.removeEvent(eth_lost_ip_handle_);
135 Network.removeEvent(eth_disconnected_handle_);
137 WiFi.removeEvent(wifi_got_ip_handle_);
138 WiFi.removeEvent(wifi_disconnected_handle_);
139 WiFi.removeEvent(wifi_ap_start_handle_);
140 WiFi.removeEvent(wifi_ap_stop_handle_);