S1.2: The main task calls esp_event_loop_create() to create a system Event task and initialize an application event’s callback function. S1.1: The main task calls esp_netif_init() to create an LwIP core task and initialize LwIP-related work. The application can enable “Keep TCP connections when IP changed” via LwIP menuconfig. In above scenarios, ideally, the application sockets and the network layer should not be affected, since the Wi-Fi connection only fails temporarily and recovers very quickly. Sixty seconds later, when the application sends out data with the keep-alive socket, the socket returns an error and the application closes the socket and re-creates it when necessary. Moreover, the station connects to the same AP and gets the same IPV4 address as before. However, since the application designer believes that the network layer should NOT care about this error at the Wi-Fi layer, the application does not close the socket.įive seconds later, the Wi-Fi connection is restored because esp_wifi_connect() is called in the application event callback function. According to the current implementation, all TCP connections will be removed and the keep-alive socket will be in a wrong status. The application creates a TCP connection to maintain the application-level keep-alive data that is sent out every 60 seconds.ĭue to certain reasons, the Wi-Fi connection is cut off, and the WIFI_EVENT_STA_DISCONNECTED is raised. However, for some special application, this may not be what they want, consider following scenarios: Sometimes a better reconnect strategy is required, refer to Wi-Fi Reconnect and Scan When Wi-Fi Is Connecting.Īnother thing deserves our attention is that the default behavior of LwIP is to abort all TCP socket connections on receiving the disconnect. It’s application’s responsibility to distinguish whether the event is caused by esp_wifi_disconnect() or other reasons. However, if the event is raised because esp_wifi_disconnect() is called, the application should not call esp_wifi_connect() to reconnect. The most common event handle code for this event in application is to call esp_wifi_connect() to reconnect the Wi-Fi. For socket-based applications, the application callback can choose to close all sockets and re-create them, if necessary, upon receiving this event. Notifies the LwIP task to clear the UDP/TCP connections which cause the wrong status to all sockets. Upon receiving this event, the default behavior of the event task is: When the Wi-Fi connection is disrupted because of specific reasons, e.g., the station continuously loses N beacons, the AP kicks off the station, the AP’s authentication mode is changed, etc. If there are more than one AP with the same SSID, the disconnected event is raised after the station fails to connect all of the found APs. the scan fails to find the target AP, authentication times out, etc. When esp_wifi_connect() is called, but the Wi-Fi driver fails to set up a connection with the AP due to certain reasons, e.g. When esp_wifi_disconnect(), or esp_wifi_stop(), or esp_wifi_deinit() is called and the station is already connected to the AP. Wi-Fi Channel State Information Configure.Side-Effects to Avoid in Different Scenarios.Preconditions of Using esp_wifi_80211_tx().ESP32-C3 Wi-Fi Station Connecting When Multiple APs Are Found.ESP32-C3 Wi-Fi Station Connecting Scenario.Scan All APs on All Channels (Background). Scan All APs on All Channels (Foreground).
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |