Define a callback function to detect when the WiFi connected state has changed.
The state parameter can be “CONNECTING”, “CONNECTED”, or “DISCONNECTED”. The WiFi ssid is passed on “CONNECTED” only.
See Also: WifiConnect, WifiScan
Example - Detect WiFi Changes
function OnStart()
{
app.SetOnWifiChange( OnWifiChange );
}
function OnWifiChange( state, ssid )
{
if( state.EndsWith( "ED" ))
{
app.ShowPopup( state + "\n" + ssid );
app.HideProgress();
}
else app.ShowProgress( state )
}
from native import app
def OnStart():
app.SetOnWifiChange(OnWifiChange)
def OnWifiChange(state, ssid):
if state.endswith("ED"):
app.ShowPopup(state + "\n" + ssid)
app.HideProgress()
else:
app.ShowProgress(state)