From: Cheoleun Moon Date: Wed, 21 Aug 2019 07:24:30 +0000 (+0900) Subject: [Connection][WiFi][Non-ACR][Try to connect a Wi-Fi AP again] X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=cd147e432265e11d706ee7a433dfa14b6e73d0b7;p=test%2Ftct%2Fcsharp%2Fapi.git [Connection][WiFi][Non-ACR][Try to connect a Wi-Fi AP again] 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 --- diff --git a/tct-suite-vs/Tizen.Connection.Tests/testcase/support/networkSetup.cs b/tct-suite-vs/Tizen.Connection.Tests/testcase/support/networkSetup.cs index a037eaa..88783f0 100755 --- a/tct-suite-vs/Tizen.Connection.Tests/testcase/support/networkSetup.cs +++ b/tct-suite-vs/Tizen.Connection.Tests/testcase/support/networkSetup.cs @@ -84,6 +84,7 @@ namespace networkUtils // Already connected if (ap != null && ap.NetworkInformation.Essid == WiFiName) { + Tizen.Log.Info(Globals.LogTag, "WiFi is already connected " + WiFiName); return; } @@ -130,8 +131,16 @@ namespace networkUtils 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() } } diff --git a/tct-suite-vs/Tizen.WiFi.Tests/testcase/support/networkSetup.cs b/tct-suite-vs/Tizen.WiFi.Tests/testcase/support/networkSetup.cs index 9d91e3b..6c10734 100755 --- a/tct-suite-vs/Tizen.WiFi.Tests/testcase/support/networkSetup.cs +++ b/tct-suite-vs/Tizen.WiFi.Tests/testcase/support/networkSetup.cs @@ -84,6 +84,7 @@ namespace networkUtils // Already connected if (ap != null && ap.NetworkInformation.Essid == WiFiName) { + Tizen.Log.Info(Globals.LogTag, "WiFi is already connected " + WiFiName); return; } @@ -127,8 +128,16 @@ namespace networkUtils 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() } }