37#if ESP_ARDUINO_VERSION_MAJOR >= 3
39 wifi_got_ip_handle_ = Network.onEvent(
40 [
this](arduino_event_id_t, arduino_event_info_t) {
41 ESP_LOGI(
"net_state",
"WiFi station got IP %s",
42 WiFi.localIP().toString().c_str());
45 ARDUINO_EVENT_WIFI_STA_GOT_IP);
47 wifi_disconnected_handle_ = Network.onEvent(
48 [
this](arduino_event_id_t, arduino_event_info_t) {
49 ESP_LOGI(
"net_state",
"WiFi station disconnected");
52 ARDUINO_EVENT_WIFI_STA_DISCONNECTED);
54 wifi_ap_start_handle_ = Network.onEvent(
55 [
this](arduino_event_id_t, arduino_event_info_t) {
56 ESP_LOGI(
"net_state",
"WiFi soft-AP started, IP %s",
57 WiFi.softAPIP().toString().c_str());
60 ARDUINO_EVENT_WIFI_AP_START);
62 wifi_ap_stop_handle_ = Network.onEvent(
63 [
this](arduino_event_id_t, arduino_event_info_t) {
64 ESP_LOGI(
"net_state",
"WiFi soft-AP stopped");
67 ARDUINO_EVENT_WIFI_AP_STOP);
70 eth_got_ip_handle_ = Network.onEvent(
71 [
this](arduino_event_id_t, arduino_event_info_t) {
72 ESP_LOGI(
"net_state",
"Ethernet got IP");
75 ARDUINO_EVENT_ETH_GOT_IP);
77 eth_lost_ip_handle_ = Network.onEvent(
78 [
this](arduino_event_id_t, arduino_event_info_t) {
79 ESP_LOGI(
"net_state",
"Ethernet lost IP");
82 ARDUINO_EVENT_ETH_LOST_IP);
84 eth_disconnected_handle_ = Network.onEvent(
85 [
this](arduino_event_id_t, arduino_event_info_t) {
86 ESP_LOGI(
"net_state",
"Ethernet PHY disconnected");
89 ARDUINO_EVENT_ETH_DISCONNECTED);
93 wifi_got_ip_handle_ = WiFi.onEvent(
94 [
this](WiFiEvent_t, WiFiEventInfo_t) {
95 ESP_LOGI(
"net_state",
"WiFi station got IP %s",
96 WiFi.localIP().toString().c_str());
99 WiFiEvent_t::ARDUINO_EVENT_WIFI_STA_GOT_IP);
101 wifi_disconnected_handle_ = WiFi.onEvent(
102 [
this](WiFiEvent_t, WiFiEventInfo_t) {
103 ESP_LOGI(
"net_state",
"WiFi station disconnected");
106 WiFiEvent_t::ARDUINO_EVENT_WIFI_STA_DISCONNECTED);
108 wifi_ap_start_handle_ = WiFi.onEvent(
109 [
this](WiFiEvent_t, WiFiEventInfo_t) {
110 ESP_LOGI(
"net_state",
"WiFi soft-AP started, IP %s",
111 WiFi.softAPIP().toString().c_str());
114 WiFiEvent_t::ARDUINO_EVENT_WIFI_AP_START);
116 wifi_ap_stop_handle_ = WiFi.onEvent(
117 [
this](WiFiEvent_t, WiFiEventInfo_t) {
118 ESP_LOGI(
"net_state",
"WiFi soft-AP stopped");
121 WiFiEvent_t::ARDUINO_EVENT_WIFI_AP_STOP);
133#if ESP_ARDUINO_VERSION_MAJOR >= 3
134 Network.removeEvent(wifi_got_ip_handle_);
135 Network.removeEvent(wifi_disconnected_handle_);
136 Network.removeEvent(wifi_ap_start_handle_);
137 Network.removeEvent(wifi_ap_stop_handle_);
138 Network.removeEvent(eth_got_ip_handle_);
139 Network.removeEvent(eth_lost_ip_handle_);
140 Network.removeEvent(eth_disconnected_handle_);
142 WiFi.removeEvent(wifi_got_ip_handle_);
143 WiFi.removeEvent(wifi_disconnected_handle_);
144 WiFi.removeEvent(wifi_ap_start_handle_);
145 WiFi.removeEvent(wifi_ap_stop_handle_);