[Connection][WiFi][Non-ACR][Try to connect a Wi-Fi AP again] 09/212409/1
authorCheoleun Moon <chleun.moon@samsung.com>
Wed, 21 Aug 2019 07:24:30 +0000 (16:24 +0900)
committerCheoleun Moon <chleun.moon@samsung.com>
Wed, 21 Aug 2019 07:24:37 +0000 (16:24 +0900)
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>
tct-suite-vs/Tizen.Connection.Tests/testcase/support/networkSetup.cs
tct-suite-vs/Tizen.WiFi.Tests/testcase/support/networkSetup.cs

index a037eaa..88783f0 100755 (executable)
@@ -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()
     }
 }
index 9d91e3b..6c10734 100755 (executable)
@@ -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()
     }
 }