@@ -124,22 +124,22 @@ static const char * auth_mode_str(int authmode)
124
124
}
125
125
#endif
126
126
127
- static void _onStaArduinoEvent (arduino_event_id_t event, arduino_event_info_t info )
127
+ static void _onStaArduinoEvent (arduino_event_t *ev )
128
128
{
129
- if (_sta_network_if == NULL || event < ARDUINO_EVENT_WIFI_STA_START || event > ARDUINO_EVENT_WIFI_STA_LOST_IP){
129
+ if (_sta_network_if == NULL || ev-> event_id < ARDUINO_EVENT_WIFI_STA_START || ev-> event_id > ARDUINO_EVENT_WIFI_STA_LOST_IP){
130
130
return ;
131
131
}
132
132
static bool first_connect = true ;
133
- log_d (" Arduino STA Event: %d - %s" , event , Network.eventName (event ));
133
+ log_d (" Arduino STA Event: %d - %s" , ev-> event_id , Network.eventName (ev-> event_id ));
134
134
135
- if (event == ARDUINO_EVENT_WIFI_STA_START) {
135
+ if (ev-> event_id == ARDUINO_EVENT_WIFI_STA_START) {
136
136
_sta_network_if->_setStatus (WL_DISCONNECTED);
137
137
if (esp_wifi_set_ps (WiFi.getSleep ()) != ESP_OK){
138
138
log_e (" esp_wifi_set_ps failed" );
139
139
}
140
- } else if (event == ARDUINO_EVENT_WIFI_STA_STOP) {
140
+ } else if (ev-> event_id == ARDUINO_EVENT_WIFI_STA_STOP) {
141
141
_sta_network_if->_setStatus (WL_STOPPED);
142
- } else if (event == ARDUINO_EVENT_WIFI_STA_CONNECTED) {
142
+ } else if (ev-> event_id == ARDUINO_EVENT_WIFI_STA_CONNECTED) {
143
143
_sta_network_if->_setStatus (WL_IDLE_STATUS);
144
144
if (_sta_network_if->getStatusBits () & ESP_NETIF_WANT_IP6_BIT){
145
145
esp_err_t err = esp_netif_create_ip6_linklocal (_sta_network_if->netif ());
@@ -149,8 +149,8 @@ static void _onStaArduinoEvent(arduino_event_id_t event, arduino_event_info_t in
149
149
log_v (" Enabled IPv6 Link Local on %s" , _sta_network_if->desc ());
150
150
}
151
151
}
152
- } else if (event == ARDUINO_EVENT_WIFI_STA_DISCONNECTED) {
153
- uint8_t reason = info .wifi_sta_disconnected .reason ;
152
+ } else if (ev-> event_id == ARDUINO_EVENT_WIFI_STA_DISCONNECTED) {
153
+ uint8_t reason = ev-> event_info .wifi_sta_disconnected .reason ;
154
154
// Reason 0 causes crash, use reason 1 (UNSPECIFIED) instead
155
155
if (!reason)
156
156
reason = WIFI_REASON_UNSPECIFIED;
@@ -186,18 +186,18 @@ static void _onStaArduinoEvent(arduino_event_id_t event, arduino_event_info_t in
186
186
_sta_network_if->disconnect ();
187
187
_sta_network_if->connect ();
188
188
}
189
- } else if (event == ARDUINO_EVENT_WIFI_STA_GOT_IP) {
189
+ } else if (ev-> event_id == ARDUINO_EVENT_WIFI_STA_GOT_IP) {
190
190
#if ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_DEBUG
191
- uint8_t * ip = (uint8_t *)&(info .got_ip .ip_info .ip .addr );
192
- uint8_t * mask = (uint8_t *)&(info .got_ip .ip_info .netmask .addr );
193
- uint8_t * gw = (uint8_t *)&(info .got_ip .ip_info .gw .addr );
191
+ uint8_t * ip = (uint8_t *)&(ev-> event_info .got_ip .ip_info .ip .addr );
192
+ uint8_t * mask = (uint8_t *)&(ev-> event_info .got_ip .ip_info .netmask .addr );
193
+ uint8_t * gw = (uint8_t *)&(ev-> event_info .got_ip .ip_info .gw .addr );
194
194
log_d (" STA IP: %u.%u.%u.%u, MASK: %u.%u.%u.%u, GW: %u.%u.%u.%u" ,
195
195
ip[0 ], ip[1 ], ip[2 ], ip[3 ],
196
196
mask[0 ], mask[1 ], mask[2 ], mask[3 ],
197
197
gw[0 ], gw[1 ], gw[2 ], gw[3 ]);
198
198
#endif
199
199
_sta_network_if->_setStatus (WL_CONNECTED);
200
- } else if (event == ARDUINO_EVENT_WIFI_STA_LOST_IP) {
200
+ } else if (ev-> event_id == ARDUINO_EVENT_WIFI_STA_LOST_IP) {
201
201
_sta_network_if->_setStatus (WL_IDLE_STATUS);
202
202
}
203
203
}
0 commit comments