Wi-Fi Connection Status
What you are going to learn
This tutorial describes how Flyport Wi-Fi network connection status works, changes and can be managed by firmware.
Actual Wi-Fi connection status can be read using the framework global variable WFStatus. Its values can be:
- NOT_CONNECTED - Wi-Fi connection is closed and there is no need to open it
- CONNECTING - Flyport is starting a connection
- CONNECTED - Flyport is actually connected to a network
- CONNECTION_LOST - Flyport lost connection to previously used network
- CONNECTION_FAILED - Flyport cannot connect to provided network
- STOPPING - Flyport is stopping the connection attempts
- TURNED_OFF - Wi-Fi transceiver is turned off (power saving mode)
Static vs Dynamic Status
NOT_CONNECTED and TURNED_OFF are static values. Once Flyport is in this status only user firmware can change it (for example turning on Wi-Fi transceiver or stating a Wi-Fi connection).
CONNECTING, CONNECTED, CONNECTION_LOST, CONNECTION_FAILED and STOPPING are dynamic values. When WFStatus has one of this values it can change by external events. In fact, when user firmware starts a Wi-Fi connection, WFStatus value change from NOT_CONNECTED to CONNECTING.
WFStatus values flow diagram
Following is a diagram showing how WFStatus values changes:
To manage Wi-Fi connection status you can use the following APIs:
WFConnect( int pconn );- to start a connection to a Wi-Fi network Profile
WFDisconnet();- to close actual connected network
WFStopConnecting();- When the WFConnect command is launched, the device tries to connect to the selected Wi-Fi network until it doesn't find it. If it is necessary to STOP retrying, this function must be called.