When the network is busy, it is possible that Wi-Fi connection is failed and an Exception is thrown from WiFiAP.ConnectAsync().
During the network setup, we need to try to connect to the Wi-Fi AP once
more.
Since the given preconditions are assumed to be correct, a Wi-Fi
connection failure is likely due to a temporary network issue.
If there are other issues, the retry will also fail.
Change-Id: I1e0f46a457e3946f99be49f896ddf5b90946ca9a
Signed-off-by: Cheoleun Moon <chleun.moon@samsung.com>
// Already connected
if (ap != null && ap.NetworkInformation.Essid == WiFiName)
{
+ Tizen.Log.Info(Globals.LogTag, "WiFi is already connected " + WiFiName);
return;
}
ap.SecurityInformation.SetPassphrase(WiFiPass);
}
- await ap.ConnectAsync();
- Tizen.Log.Info(Globals.LogTag, "Connected");
+ try
+ {
+ await ap.ConnectAsync();
+ Tizen.Log.Info(Globals.LogTag, "Connected");
+ }
+ catch (System.Exception e)
+ {
+ Tizen.Log.Info(Globals.LogTag, "Exception during Wi-Fi Association: " + e);
+ await ap.ConnectAsync();
+ }
} // ConnectWiFi()
}
}
// Already connected
if (ap != null && ap.NetworkInformation.Essid == WiFiName)
{
+ Tizen.Log.Info(Globals.LogTag, "WiFi is already connected " + WiFiName);
return;
}
Tizen.Log.Info(Globals.LogTag, "Set passphrase " + WiFiPass);
ap.SecurityInformation.SetPassphrase(WiFiPass);
- await ap.ConnectAsync();
- Tizen.Log.Info(Globals.LogTag, "Connected");
+ try
+ {
+ await ap.ConnectAsync();
+ Tizen.Log.Info(Globals.LogTag, "Connected");
+ }
+ catch (System.Exception e)
+ {
+ Tizen.Log.Info(Globals.LogTag, "Exception during Wi-Fi Association: " + e);
+ await ap.ConnectAsync();
+ }
} // ConnectWiFi()
}
}