fix(esp_wifi): Stop roaming app when station stops

This commit is contained in:
Kapil Gupta 2024-09-11 11:06:00 +05:30
parent 09b421674b
commit b66f4444d7
2 changed files with 10 additions and 1 deletions

@ -1 +1 @@
Subproject commit 3b8ae052ea562f110d6b9826bfd0e91098feac2a Subproject commit f78422a3cb497b8f73a3d35956cf31d677a4e08b

View File

@ -78,6 +78,7 @@ static void roaming_app_get_ap_info(wifi_ap_record_t *ap_info)
} }
#endif /*LOW_RSSI_ROAMING_ENABLED*/ #endif /*LOW_RSSI_ROAMING_ENABLED*/
} }
#if LEGACY_ROAM_ENABLED #if LEGACY_ROAM_ENABLED
static void legacy_roam_clear_bssid_flag(void) static void legacy_roam_clear_bssid_flag(void)
{ {
@ -175,6 +176,12 @@ static void roaming_app_disconnected_event_handler(void* arg, esp_event_base_t e
} }
} }
static void roaming_app_sta_stop_event_handler(void* arg, esp_event_base_t event_base,
int32_t event_id, void* event_data)
{
g_roaming_app.allow_reconnect = false;
}
static void roaming_app_connected_event_handler(void* arg, esp_event_base_t event_base, static void roaming_app_connected_event_handler(void* arg, esp_event_base_t event_base,
int32_t event_id, void* event_data) int32_t event_id, void* event_data)
{ {
@ -787,6 +794,7 @@ void init_roaming_app(void)
#endif #endif
ESP_ERROR_CHECK(esp_event_handler_register(WIFI_EVENT, WIFI_EVENT_STA_CONNECTED, roaming_app_connected_event_handler, NULL)); ESP_ERROR_CHECK(esp_event_handler_register(WIFI_EVENT, WIFI_EVENT_STA_CONNECTED, roaming_app_connected_event_handler, NULL));
ESP_ERROR_CHECK(esp_event_handler_register(WIFI_EVENT, WIFI_EVENT_STA_DISCONNECTED, roaming_app_disconnected_event_handler, NULL)); ESP_ERROR_CHECK(esp_event_handler_register(WIFI_EVENT, WIFI_EVENT_STA_DISCONNECTED, roaming_app_disconnected_event_handler, NULL));
ESP_ERROR_CHECK(esp_event_handler_register(WIFI_EVENT, WIFI_EVENT_STA_STOP, roaming_app_sta_stop_event_handler, NULL));
#if LOW_RSSI_ROAMING_ENABLED #if LOW_RSSI_ROAMING_ENABLED
ESP_ERROR_CHECK(esp_event_handler_register(WIFI_EVENT, WIFI_EVENT_STA_BSS_RSSI_LOW, ESP_ERROR_CHECK(esp_event_handler_register(WIFI_EVENT, WIFI_EVENT_STA_BSS_RSSI_LOW,
&roaming_app_rssi_low_handler, NULL)); &roaming_app_rssi_low_handler, NULL));
@ -813,6 +821,7 @@ void deinit_roaming_app(void)
/* Unregister Event handlers */ /* Unregister Event handlers */
ESP_ERROR_CHECK(esp_event_handler_unregister(WIFI_EVENT, WIFI_EVENT_STA_CONNECTED, roaming_app_connected_event_handler)); ESP_ERROR_CHECK(esp_event_handler_unregister(WIFI_EVENT, WIFI_EVENT_STA_CONNECTED, roaming_app_connected_event_handler));
ESP_ERROR_CHECK(esp_event_handler_unregister(WIFI_EVENT, WIFI_EVENT_STA_DISCONNECTED, roaming_app_disconnected_event_handler)); ESP_ERROR_CHECK(esp_event_handler_unregister(WIFI_EVENT, WIFI_EVENT_STA_DISCONNECTED, roaming_app_disconnected_event_handler));
ESP_ERROR_CHECK(esp_event_handler_unregister(WIFI_EVENT, WIFI_EVENT_STA_STOP, roaming_app_sta_stop_event_handler));
#if LOW_RSSI_ROAMING_ENABLED #if LOW_RSSI_ROAMING_ENABLED
ESP_ERROR_CHECK(esp_event_handler_unregister(WIFI_EVENT, WIFI_EVENT_STA_BSS_RSSI_LOW, ESP_ERROR_CHECK(esp_event_handler_unregister(WIFI_EVENT, WIFI_EVENT_STA_BSS_RSSI_LOW,
&roaming_app_rssi_low_handler)); &roaming_app_rssi_low_handler));