-Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 15
-VisualStudioVersion = 15.0.26730.15
-MinimumVisualStudioVersion = 15.0.26124.0
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Network.Tests", "Tizen.Network.Tests.csproj", "{D92BEEAC-3B2A-45F8-8C53-53B92550404A}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "nunit.framework", "..\nunit.framework\nunit.framework.csproj", "{B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "nunitlite", "..\nunitlite\nunitlite.csproj", "{FDB8025A-C029-461F-895E-287B4C65939B}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AutoTemplate", "..\Template\AutoTemplate\AutoTemplate.csproj", "{B11ABB0C-C3C1-4B5C-8251-A15628A775F3}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|Any CPU = Debug|Any CPU
- Debug|x64 = Debug|x64
- Debug|x86 = Debug|x86
- Release|Any CPU = Release|Any CPU
- Release|x64 = Release|x64
- Release|x86 = Release|x86
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|x64.ActiveCfg = Debug|Any CPU
- {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|x64.Build.0 = Debug|Any CPU
- {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|x86.ActiveCfg = Debug|Any CPU
- {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|x86.Build.0 = Debug|Any CPU
- {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|Any CPU.Build.0 = Release|Any CPU
- {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|x64.ActiveCfg = Release|Any CPU
- {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|x64.Build.0 = Release|Any CPU
- {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|x86.ActiveCfg = Release|Any CPU
- {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|x86.Build.0 = Release|Any CPU
- {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|x64.ActiveCfg = Debug|Any CPU
- {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|x64.Build.0 = Debug|Any CPU
- {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|x86.ActiveCfg = Debug|Any CPU
- {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|x86.Build.0 = Debug|Any CPU
- {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|Any CPU.Build.0 = Release|Any CPU
- {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|x64.ActiveCfg = Release|Any CPU
- {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|x64.Build.0 = Release|Any CPU
- {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|x86.ActiveCfg = Release|Any CPU
- {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|x86.Build.0 = Release|Any CPU
- {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|x64.ActiveCfg = Debug|Any CPU
- {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|x64.Build.0 = Debug|Any CPU
- {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|x86.ActiveCfg = Debug|Any CPU
- {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|x86.Build.0 = Debug|Any CPU
- {FDB8025A-C029-461F-895E-287B4C65939B}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {FDB8025A-C029-461F-895E-287B4C65939B}.Release|Any CPU.Build.0 = Release|Any CPU
- {FDB8025A-C029-461F-895E-287B4C65939B}.Release|x64.ActiveCfg = Release|Any CPU
- {FDB8025A-C029-461F-895E-287B4C65939B}.Release|x64.Build.0 = Release|Any CPU
- {FDB8025A-C029-461F-895E-287B4C65939B}.Release|x86.ActiveCfg = Release|Any CPU
- {FDB8025A-C029-461F-895E-287B4C65939B}.Release|x86.Build.0 = Release|Any CPU
- {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.NUI|Any CPU.ActiveCfg = Debug|Any CPU
- {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.NUI|Any CPU.Build.0 = Debug|Any CPU
- {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Release|Any CPU.Build.0 = Release|Any CPU
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
- GlobalSection(ExtensibilityGlobals) = postSolution
- SolutionGuid = {ED382B91-9930-40B6-B3D7-362304C78680}
- EndGlobalSection
-EndGlobal
+Microsoft Visual Studio Solution File, Format Version 12.00\r
+# Visual Studio 15\r
+VisualStudioVersion = 15.0.26730.15\r
+MinimumVisualStudioVersion = 15.0.26124.0\r
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Network.Tests", "Tizen.Network.Tests.csproj", "{D92BEEAC-3B2A-45F8-8C53-53B92550404A}"\r
+EndProject\r
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "nunit.framework", "..\nunit.framework\nunit.framework.csproj", "{B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}"\r
+EndProject\r
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "nunitlite", "..\nunitlite\nunitlite.csproj", "{FDB8025A-C029-461F-895E-287B4C65939B}"\r
+EndProject\r
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AutoTemplate", "..\Template\AutoTemplate\AutoTemplate.csproj", "{B11ABB0C-C3C1-4B5C-8251-A15628A775F3}"\r
+EndProject\r
+Global\r
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution\r
+ Debug|Any CPU = Debug|Any CPU\r
+ Debug|x64 = Debug|x64\r
+ Debug|x86 = Debug|x86\r
+ Release|Any CPU = Release|Any CPU\r
+ Release|x64 = Release|x64\r
+ Release|x86 = Release|x86\r
+ EndGlobalSection\r
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution\r
+ {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\r
+ {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|Any CPU.Build.0 = Debug|Any CPU\r
+ {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|x64.ActiveCfg = Debug|Any CPU\r
+ {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|x64.Build.0 = Debug|Any CPU\r
+ {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|x86.ActiveCfg = Debug|Any CPU\r
+ {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|x86.Build.0 = Debug|Any CPU\r
+ {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|Any CPU.ActiveCfg = Release|Any CPU\r
+ {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|Any CPU.Build.0 = Release|Any CPU\r
+ {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|x64.ActiveCfg = Release|Any CPU\r
+ {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|x64.Build.0 = Release|Any CPU\r
+ {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|x86.ActiveCfg = Release|Any CPU\r
+ {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|x86.Build.0 = Release|Any CPU\r
+ {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\r
+ {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|Any CPU.Build.0 = Debug|Any CPU\r
+ {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|x64.ActiveCfg = Debug|Any CPU\r
+ {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|x64.Build.0 = Debug|Any CPU\r
+ {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|x86.ActiveCfg = Debug|Any CPU\r
+ {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|x86.Build.0 = Debug|Any CPU\r
+ {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|Any CPU.ActiveCfg = Release|Any CPU\r
+ {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|Any CPU.Build.0 = Release|Any CPU\r
+ {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|x64.ActiveCfg = Release|Any CPU\r
+ {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|x64.Build.0 = Release|Any CPU\r
+ {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|x86.ActiveCfg = Release|Any CPU\r
+ {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|x86.Build.0 = Release|Any CPU\r
+ {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\r
+ {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|Any CPU.Build.0 = Debug|Any CPU\r
+ {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|x64.ActiveCfg = Debug|Any CPU\r
+ {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|x64.Build.0 = Debug|Any CPU\r
+ {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|x86.ActiveCfg = Debug|Any CPU\r
+ {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|x86.Build.0 = Debug|Any CPU\r
+ {FDB8025A-C029-461F-895E-287B4C65939B}.Release|Any CPU.ActiveCfg = Release|Any CPU\r
+ {FDB8025A-C029-461F-895E-287B4C65939B}.Release|Any CPU.Build.0 = Release|Any CPU\r
+ {FDB8025A-C029-461F-895E-287B4C65939B}.Release|x64.ActiveCfg = Release|Any CPU\r
+ {FDB8025A-C029-461F-895E-287B4C65939B}.Release|x64.Build.0 = Release|Any CPU\r
+ {FDB8025A-C029-461F-895E-287B4C65939B}.Release|x86.ActiveCfg = Release|Any CPU\r
+ {FDB8025A-C029-461F-895E-287B4C65939B}.Release|x86.Build.0 = Release|Any CPU\r
+ {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\r
+ {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Debug|Any CPU.Build.0 = Debug|Any CPU\r
+ {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Debug|x64.ActiveCfg = Debug|Any CPU\r
+ {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Debug|x64.Build.0 = Debug|Any CPU\r
+ {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Debug|x86.ActiveCfg = Debug|Any CPU\r
+ {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Debug|x86.Build.0 = Debug|Any CPU\r
+ {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Release|Any CPU.ActiveCfg = Release|Any CPU\r
+ {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Release|Any CPU.Build.0 = Release|Any CPU\r
+ {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Release|x64.ActiveCfg = Release|Any CPU\r
+ {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Release|x64.Build.0 = Release|Any CPU\r
+ {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Release|x86.ActiveCfg = Release|Any CPU\r
+ {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Release|x86.Build.0 = Release|Any CPU\r
+ EndGlobalSection\r
+ GlobalSection(SolutionProperties) = preSolution\r
+ HideSolutionNode = FALSE\r
+ EndGlobalSection\r
+ GlobalSection(ExtensibilityGlobals) = postSolution\r
+ SolutionGuid = {ED382B91-9930-40B6-B3D7-362304C78680}\r
+ EndGlobalSection\r
+EndGlobal\r
/*setup using for connecting to a PRIVATE AP*/
public static async Task setUp()
{
- await networkSetup.WiFiActivate(networkParameter.wnPRIVATE, networkParameter.wType.wPrivate, networkParameter.wPASS);
- }
-
- public static async Task tearDown()
- {
- await networkSetup.DeactiveWiFi();
+ await networkSetup.ConnectWiFi(networkParameter.wnPRIVATE, networkParameter.wType.wPrivate, networkParameter.wPASS);
}
[Test]
await Task.Delay(5000);
Log.Info(Globals.LogTag, "Ipv4AddressChanged Event subscribed");
- await tearDown();
- await Task.Delay(5000);
+ await networkSetup.ForgetCurrentAP();
+ await Task.Delay(3000);
await setUp();
Log.Info(Globals.LogTag, "Network is connected");
- await Task.Delay(5000);
+ await Task.Delay(3000);
Assert.IsTrue(_flag, "Ipv4Address is not changed");
ConnectionManager.IPAddressChanged -= Ipv4AddressChangedCallBack;
ConnectionManager.IPAddressChanged += Ipv6AddressChangedCallBack;
await Task.Delay(5000);
Log.Info(Globals.LogTag, "Ipv6Address_GET Ipv6AddressChanged Event subscribed");
- await tearDown();
- await Task.Delay(5000);
+ await networkSetup.ForgetCurrentAP();
+ await Task.Delay(3000);
await setUp();
Log.Info(Globals.LogTag, "Network is connected");
- await Task.Delay(5000);
+ await Task.Delay(3000);
Assert.IsTrue(_flag, "Ipv6Address is not changed");
/**
/*setup using for connecting to a PRIVATE AP*/
public static async Task setUp()
{
- await networkSetup.WiFiActivate(networkParameter.wnPRIVATE, networkParameter.wType.wPrivate, networkParameter.wPASS);
+ await networkSetup.ConnectWiFi(networkParameter.wnPRIVATE, networkParameter.wType.wPrivate, networkParameter.wPASS);
}
[Test]
*/
await setUp();
- await Task.Delay(5000);
+ await Task.Delay(3000);
/**
* TEST CODE
Log.Info(Globals.LogTag, "ConnectionItem_State_GET start");
await setUp();
- await Task.Delay(5000);
+ await Task.Delay(3000);
/**
* TEST CODE
public static async Task setUp()
{
_nameWiFi = networkParameter.wnPRIVATE;
- await networkSetup.WiFiActivate(networkParameter.wnPRIVATE, networkParameter.wType.wPrivate, networkParameter.wPASS);
- await Task.Delay(5000);
+ await networkSetup.ConnectWiFi(networkParameter.wnPRIVATE, networkParameter.wType.wPrivate, networkParameter.wPASS);
+ await Task.Delay(3000);
}
/*setup using for connecting to a PUBLIC AP*/
{
_nameWiFi = networkParameter.wnPUBLIC;
Log.Info(Globals.LogTag, "Try to connect to " + networkParameter.wnPUBLIC);
- await networkSetup.WiFiActivate(networkParameter.wnPUBLIC, networkParameter.wType.wPublic, null);
- await Task.Delay(5000);
+ await networkSetup.ConnectWiFi(networkParameter.wnPUBLIC, networkParameter.wType.wPublic, null);
+ await Task.Delay(3000);
}
public static async Task tearDown()
{
_nameWiFi = null;
- await networkSetup.DeactiveWiFi();
- await Task.Delay(2000);
+ await networkSetup.DeactivateWiFi();
+ await Task.Delay(3000);
}
[Test]
await setUp();
_wifiAP = WiFiManager.GetConnectedAP();
Assert.IsNotNull(_wifiAP, "No WiFi connection");
- await _wifiAP.DisconnectAsync();
+ await _wifiAP.ForgetAPAsync();
await Task.Delay(3000);
/**
* TEST CODE
* TEST CODE
* */
ConnectionManager.ConnectionTypeChanged += EventHandlerConnectionTypeChanged;
- await tearDown();
+ networkSetup.ForgetCurrentAP();
await Task.Delay(3000);
ConnectionManager.ConnectionTypeChanged -= EventHandlerConnectionTypeChanged;
Assert.IsTrue(_flag, "Event ChangeType is fail");
WiFiAP _wifiAP = null;
try
{
- await networkSetup.WiFiActivate(networkParameter.wnPRIVATE, networkParameter.wType.wPrivate, networkParameter.wPASS);
+ await networkSetup.ConnectWiFi(networkParameter.wnPRIVATE, networkParameter.wType.wPrivate, networkParameter.wPASS);
ConnectionManager.ProxyAddressChanged += EventHandlerProxyAddressChanged;
_wifiAP = WiFiManager.GetConnectedAP();
Assert.IsNotNull(_wifiAP, "No WiFi connection");
public static async Task setUp()
{
- await networkSetup.WiFiActivate(networkParameter.wnPRIVATE, networkParameter.wType.wPrivate, networkParameter.wPASS);
- await Task.Delay(5000);
+ await networkSetup.ConnectWiFi(networkParameter.wnPRIVATE, networkParameter.wType.wPrivate, networkParameter.wPASS);
+ await Task.Delay(3000);
}
public static async Task tearDown()
{
- await networkSetup.DeactiveWiFi();
+ await networkSetup.DeactivateWiFi();
await Task.Delay(2000);
}
_connectionProfile = ConnectionProfileManager.GetCurrentProfile();
Assert.IsNotNull(_connectionProfile);
Assert.AreEqual(ProfileState.Connected.ToString(), _connectionProfile.GetState(AddressFamily.IPv4).ToString(), "get state is fail");
- /**
- * POST CONDITION
- * turn off WiFi
- * */
- await tearDown();
}
catch (NotSupportedException)
{
_connectionProfile = ConnectionProfileManager.GetCurrentProfile();
Assert.IsNotNull(_connectionProfile);
_connectionProfile.Refresh();
- /**
- * POST CONDITION
- * turn off WiFi
- * */
- await tearDown();
}
catch (NotSupportedException)
{
Assert.AreEqual(ProxyType.Manual.ToString(), _connectionProfile.ProxyType.ToString(), "Set ProxyType is fail");
/**
* POST CONDITION
- * turn off WiFi
- * */
+ */
await tearDown();
+ await setUp();
}
catch (NotSupportedException)
{
Assert.AreEqual(proxy, _connectionProfile.ProxyAddress.ToString(), "Set proxyAddress is fail");
/**
* POST CONDITION
- * turn off WiFi
- * */
+ */
await tearDown();
+ await setUp();
}
catch (NotSupportedException)
Assert.IsNotNull(_connectionProfile, "No Profile Found");
_connectionProfile.ProfileStateChanged += EventHandlerProfileStateChanged;
await Task.Delay(3000);
- await tearDown();
- await Task.Delay(5000);
+ await networkSetup.ForgetCurrentAP();
+ await Task.Delay(3000);
Log.Info(Globals.LogTag, "_flag=" + _flag);
Assert.IsTrue(_flag, "Profile State don't change");
_connectionProfile.ProfileStateChanged -= EventHandlerProfileStateChanged;
/*setup using for connecting to a PRIVATE AP*/
public static async Task setUp()
{
- await networkSetup.WiFiActivate(networkParameter.wnPRIVATE, networkParameter.wType.wPrivate, networkParameter.wPASS);
+ await networkSetup.ConnectWiFi(networkParameter.wnPRIVATE, networkParameter.wType.wPrivate, networkParameter.wPASS);
await Task.Delay(3000);
}
public static async Task tearDown()
{
- await networkSetup.DeactiveWiFi();
+ await networkSetup.DeactivateWiFi();
await Task.Delay(2000);
}
if (isWiFiSupported && WiFiManager.IsActive)
{
- await networkSetup.DeactiveWiFi();
+ await networkSetup.DeactivateWiFi();
}
/* TEST CODE */
_profile = item;
break;
}
+ item.Dispose();
}
ConnectionProfileManager.RemoveProfile(_profile);
flag = false;
break;
}
+ item.Dispose();
}
Assert.IsTrue(flag, "RemoveProfile is fail");
+ await setUp();
}
catch (NotSupportedException)
{
_profile = i;
break;
}
+ i.Dispose();
}
Assert.IsNotNull(_profile, "Profile is Null");
await ConnectionProfileManager.DisconnectProfileAsync(_profile);
_currCP = i;
break;
}
+ i.Dispose();
}
/*Disconnect AP*/
await ConnectionProfileManager.DisconnectProfileAsync(_currCP);
mP = i;
break;
}
+ i.Dispose();
}
await ConnectionProfileManager.ConnectProfileAsync(mP);
Assert.AreEqual(ConnectionState.Connected.ToString(), ConnectionManager.WiFiState.ToString(), "ConnectProfileAsync is fail");
Assert.AreEqual(ConnectionState.Disconnected.ToString(), ConnectionManager.WiFiState.ToString(), "DisconnectProfileAsync is fail");
await Task.Delay(3000);
Log.Info(Globals.LogTag, "DisconnectProfileAsync_DISCONNECT_AP finish");
+ await setUp();
}
catch (NotSupportedException)
{
public static void Init()
{
Log.Info(Globals.LogTag, "Preconditions for each TEST");
- _flag = false;
Information.TryGetValue("http://tizen.org/feature/network.wifi", out isWiFiSupported);
}
public static void Destroy()
{
Log.Info(Globals.LogTag, "Postconditions for each TEST");
- _flag = false;
}
/*setup using for connecting to a PRIVATE AP*/
public static async Task setUp()
{
- await networkSetup.WiFiActivate(networkParameter.wnPRIVATE, networkParameter.wType.wPrivate, networkParameter.wPASS);
+ await networkSetup.ConnectWiFi(networkParameter.wnPRIVATE, networkParameter.wType.wPrivate, networkParameter.wPASS);
}
public static async Task tearDown()
{
- await networkSetup.DeactiveWiFi();
+ await networkSetup.DeactivateWiFi();
}
public static void EventHandlerProfileStateChanged(object sender, EventArgs e)
[Property("AUTHOR", "Nguyen Van Tan nguyen.vtan@samsung.com")]
public static async Task ConnectionProfileState_GET()
{
+ _flag = false;
ConnectionProfile _connectionProfile = null;
Log.Info(Globals.LogTag, "Start ConnectionProfileState_GET");
try
_connectionProfile.ProfileStateChanged += EventHandlerProfileStateChanged;
await Task.Delay(3000);
Log.Info(Globals.LogTag, "Event subscripted");
- await tearDown();
- await Task.Delay(5000);
+ await networkSetup.ForgetCurrentAP();
+ await Task.Delay(3000);
Log.Info(Globals.LogTag, "_flag=" + _flag);
Assert.IsTrue(_flag, "Profile State don't change");
_connectionProfile.ProfileStateChanged -= EventHandlerProfileStateChanged;
public static async Task setUp()
{
- await networkSetup.WiFiActivate(networkParameter.wnPRIVATE, networkParameter.wType.wPrivate, networkParameter.wPASS);
+ await networkSetup.ConnectWiFi(networkParameter.wnPRIVATE, networkParameter.wType.wPrivate, networkParameter.wPASS);
}
public static async Task tearDown()
{
- await networkSetup.DeactiveWiFi();
+ await networkSetup.DeactivateWiFi();
}
private static void EventHandlerConnectionStateChangedCBState(object sender, EventArgs e)
/*
* TEST CODE
- * Then, connect to WiFi private2, changed WiFiAp
+ * Then, connect to WiFi private2, changed WiFiApjk
*/
WiFiManager.ConnectionStateChanged += EventHandlerConnectionStateChangedCBAp;
await Task.Delay(3000);
- await networkSetup.WiFiActivate(networkParameter.wnPRIVATE1, networkParameter.wType.wPrivate, networkParameter.wPASS);
- await Task.Delay(5000);
+ await networkSetup.ConnectWiFi(networkParameter.wnPRIVATE1, networkParameter.wType.wPrivate, networkParameter.wPASS);
+ await Task.Delay(3000);
_wifiAP2 = WiFiManager.GetConnectedAP();
Assert.IsTrue(_flag, "Flag should be true after checking");
WiFiManager.ConnectionStateChanged -= EventHandlerConnectionStateChangedCBAp;
/*setup using for connecting to a PRIVATE AP*/
public static async Task setUp()
{
- await networkSetup.WiFiActivate(networkParameter.wnPRIVATE, networkParameter.wType.wPrivate, networkParameter.wPASS);
+ await networkSetup.ConnectWiFi(networkParameter.wnPRIVATE, networkParameter.wType.wPrivate, networkParameter.wPASS);
}
public static async Task tearDown()
{
- await networkSetup.DeactiveWiFi();
+ await networkSetup.DeactivateWiFi();
}
[Test]
ConnectionManager.ConnectionTypeChanged += ConnectionTypeChangedCB;
Log.Info(Globals.LogTag, "ConnectionType_GET ConnectionTypeChanged Event subsribed");
await setUp();
- await Task.Delay(5000);
+ await Task.Delay(3000);
Log.Info(Globals.LogTag, "ConnectionType_GET ConnectionTypeChanged WiFi Connected");
await tearDown();
await Task.Delay(2000);
public static async Task setUp()
{
- await networkSetup.WiFiActivate(networkParameter.wnPRIVATE, networkParameter.wType.wPrivate, networkParameter.wPASS);
+ await networkSetup.ConnectWiFi(networkParameter.wnPRIVATE, networkParameter.wType.wPrivate, networkParameter.wPASS);
+ }
+
+ public static async Task tearDown()
+ {
+ await networkSetup.DeactivateWiFi();
}
private static void EventHandlerDeviceStateChangedCB(object sender, EventArgs e)
*/
WiFiManager.DeviceStateChanged += EventHandlerDeviceStateChangedCB;
await Task.Delay(3000);
- if (WiFiManager.IsActive)
- {
- Log.Info(Globals.LogTag, "WiFi is activated");
- networkSetup.ForgetWiFi();
- await WiFiManager.DeactivateAsync();
- }
+ await tearDown();
+ await Task.Delay(3000);
await setUp();
await Task.Delay(3000);
Assert.IsTrue(_flag, "Flag should be true after checking");
public static async Task setUp()
{
- await networkSetup.WiFiActivate(networkParameter.wnPRIVATE, networkParameter.wType.wPrivate, networkParameter.wPASS);
- await Task.Delay(5000);
+ await networkSetup.ConnectWiFi(networkParameter.wnPRIVATE, networkParameter.wType.wPrivate, networkParameter.wPASS);
+ await Task.Delay(3000);
}
[Test]
public static async Task setUp()
{
- await networkSetup.WiFiActivate(networkParameter.wnPRIVATE, networkParameter.wType.wPrivate, networkParameter.wPASS);
- await Task.Delay(5000);
+ await networkSetup.ConnectWiFi(networkParameter.wnPRIVATE, networkParameter.wType.wPrivate, networkParameter.wPASS);
+ await Task.Delay(3000);
}
public static async Task tearDown()
{
- await networkSetup.DeactiveWiFi();
+ await networkSetup.DeactivateWiFi();
await Task.Delay(2000);
}
public static async Task setUp()
{
- await networkSetup.WiFiActivate(networkParameter.wnPRIVATE, networkParameter.wType.wPrivate, networkParameter.wPASS);
+ await networkSetup.ConnectWiFi(networkParameter.wnPRIVATE, networkParameter.wType.wPrivate, networkParameter.wPASS);
+ }
+
+ public static async Task tearDown()
+ {
+ await networkSetup.DeactivateWiFi();
}
private static void EventHandlerRssiLevelChangedCB(object sender, EventArgs e)
*/
WiFiManager.RssiLevelChanged += EventHandlerRssiLevelChangedCB;
await Task.Delay(3000);
- if (WiFiManager.IsActive)
- {
- Log.Info(Globals.LogTag, "WiFi is activated");
- networkSetup.ForgetWiFi();
- await WiFiManager.DeactivateAsync();
- }
+ await tearDown();
+ await Task.Delay(3000);
await setUp();
await Task.Delay(3000);
Assert.IsTrue(_flag, "Flag should be true after checking");
using System.Threading.Tasks;
using networkUtils;
using NUnit.Framework;
-using Tizen.System;\r
-\r
-namespace Tizen.Network.WiFi.Tests\r
-{\r
+using Tizen.System;
+
+namespace Tizen.Network.WiFi.Tests
+{
[TestFixture]
[Description("Tizen.Network.WiFi.ScanStateChangedEventArgs test")]
public class ScanStateChangedEventArgsTests
public static async Task setUp()
{
- await networkSetup.WiFiActivate(networkParameter.wnPRIVATE, networkParameter.wType.wPrivate, networkParameter.wPASS);
+ await networkSetup.ConnectWiFi(networkParameter.wnPRIVATE, networkParameter.wType.wPrivate, networkParameter.wPASS);
}
private static void EventHandlerScanStateChangedCB(object sender, ScanStateChangedEventArgs State)
public async Task State_PROPERTY()
{
try
- {\r
+ {
/*
* TEST CODE
- */\r
+ */
if (!WiFiManager.IsActive)
{
await WiFiManager.ActivateAsync();
- await Task.Delay(3000);
}
WiFiManager.ScanStateChanged += EventHandlerScanStateChangedCB;
- await WiFiManager.ScanAsync();\r
- WiFiManager.ScanStateChanged -= EventHandlerScanStateChangedCB;\r
-\r
+ await WiFiManager.ScanAsync();
+ WiFiManager.ScanStateChanged -= EventHandlerScanStateChangedCB;
+
Assert.IsTrue(_flag, "Flag should be true after checking");
}
catch (NotSupportedException)
Assert.True(false, "Exception occurs. Msg : " + ex.ToString());
}
}
- }\r
-}\r
+ }
+}
public static async Task SetUp()
{
- await networkSetup.WiFiActivate(networkParameter.wnPRIVATE, networkParameter.wType.wPrivate, networkParameter.wPASS);
+ await networkSetup.ConnectWiFi(networkParameter.wnPRIVATE, networkParameter.wType.wPrivate, networkParameter.wPASS);
}
- public static async Task TearDown()
+ public static async Task tearDown()
{
- await networkSetup.DeactiveWiFi();
+ await networkSetup.DeactivateWiFi();
}
[Test]
* turn off WiFi
* */
if (WiFiManager.IsActive)
- await TearDown();
+ await tearDown();
/** TEST CODE */
await WiFiManager.ActivateAsync();
_wifiAP = WiFiManager.GetConnectedAP();
Assert.IsNotNull(_wifiAP, "No WiFi connection");
- await TearDown();
+ await tearDown();
await Task.Delay(2000);
await _wifiAP.ForgetAPAsync();
await Task.Delay(2000);
Log.Info(Globals.LogTag, "Postconditions for each TEST");
}
- public static async Task Setup()
+ public static async Task setUp()
{
- await networkSetup.WiFiActivate(networkParameter.wnPRIVATE, networkParameter.wType.wPrivate, networkParameter.wPASS);
- await Task.Delay(5000);
+ await networkSetup.ConnectWiFi(networkParameter.wnPRIVATE, networkParameter.wType.wPrivate, networkParameter.wPASS);
+ await Task.Delay(3000);
_wants = networkParameter.wnPRIVATE;
}
* 1. Activate WiFi then connect to an AP.
* 2. Get connected AP.
* */
- await Setup();
+ await setUp();
/**
* Test contructor
* 1. Activate WiFi then connect to an AP.
* 2. Get connected AP.
*/
- await Setup();
+ await setUp();
/**
* Test contructor
* 1. Activate WiFi then connect to an AP.
* 2. Get connected AP.
*/
- await Setup();
+ await setUp();
/**
* Test contructor
* 1. Activate WiFi then connect to an AP.
* 2. Get connected AP.
*/
- await Setup();
+ await setUp();
/**
* Test contructor
* 1. Activate WiFi then connect to an AP.
* 2. Get connected AP.
*/
- await Setup();
+ await setUp();
/**
* Test contructor
* 1. Activate WiFi then connect to an AP.
* 2. Get connected AP.
*/
- await Setup();
+ await setUp();
/**
* Test property IsHidden
* 1. Activate WiFi then connect to an AP.
* 2. Get connected AP.
*/
- await Setup();
+ await setUp();
/**
* Test property IsHidden
* 1. Activate WiFi then connect to an AP.
* 2. Get connected AP.
*/
- await Setup();
+ await setUp();
/**
* Test property IsHidden
* 1. Activate WiFi then connect to an AP.
* 2. Get connected AP.
*/
- await Setup();
+ await setUp();
/**
* Test property ProxyAddress
* 1. Activate WiFi then connect to an AP.
* 2. Get connected AP.
*/
- await Setup();
+ await setUp();
/**
* Test property EapConfiguration
_wiFiEapConfig = null;
}
- public static async Task Setup()
+ public static async Task setUp()
{
- await networkSetup.WiFiActivate(_wants, networkParameter.wType.wPrivate, networkParameter.wPASS);
- await Task.Delay(5000);
+ await networkSetup.ConnectWiFi(_wants, networkParameter.wType.wPrivate, networkParameter.wPASS);
+ await Task.Delay(3000);
_wifiAP = WiFiManager.GetConnectedAP();
Assert.IsNotNull(_wifiAP, "No WiFi connection");
_wiFiConfig = new WiFiConfiguration(_wifiAP.NetworkInformation.Essid, networkParameter.wPASS, WiFiSecurityType.Eap);
/** Precondition
* Settup WiFi type WiFiEap
* */
- await Setup();
+ await setUp();
/**
* Test code
/** Precondition
* Settup WiFi type WiFiEap
* */
- await Setup();
+ await setUp();
/**
* Test code
/** Precondition
* Settup WiFi type WiFiEap
* */
- await Setup();
+ await setUp();
/**
* Test property AnonymousIdentify
/** Precondition
* Settup WiFi type WiFiEap
* */
- await Setup();
+ await setUp();
/**
* Test properties
/** Precondition
* Settup WiFi type WiFiEap
* */
- await Setup();
+ await setUp();
/**
* Test properties
/** Precondition
* Settup WiFi type WiFiEap
* */
- await Setup();
+ await setUp();
/**
* Test properties
/** Precondition
* Settup WiFi type WiFiEap
* */
- await Setup();
+ await setUp();
/**
* Test properties
/** Precondition
* Settup WiFi type WiFiEap
* */
- await Setup();
+ await setUp();
/**
* Test properties
public static async Task setUp()
{
- await networkSetup.WiFiActivate(networkParameter.wnPRIVATE, networkParameter.wType.wPrivate, networkParameter.wPASS);
- await Task.Delay(5000);
+ await networkSetup.ConnectWiFi(networkParameter.wnPRIVATE, networkParameter.wType.wPrivate, networkParameter.wPASS);
+ await Task.Delay(3000);
}
public static async Task tearDown()
{
- await networkSetup.DeactiveWiFi();
- await Task.Delay(5000);
+ await networkSetup.DeactivateWiFi();
+ await Task.Delay(2000);
}
public static void EventHandlerRssi(object sender, RssiLevelChangedEventArgs Rssi)
/** TEST CODE */
await WiFiManager.ActivateAsync();
- await Task.Delay(5000);
+ await Task.Delay(3000);
Assert.IsTrue(WiFiManager.IsActive, "WiFi is off");
Log.Info(Globals.LogTag, "Successfully done");
/** TEST CODE */
await WiFiManager.ActivateWithPickerAsync();
- await Task.Delay(5000);
+ await Task.Delay(3000);
Assert.IsTrue(WiFiManager.IsActive, "WiFi is off");
Log.Info(Globals.LogTag, "Successfully done");
/** TEST CODE **/
Assert.IsTrue(WiFiManager.IsActive, "WiFi doesn't turn on");
WiFiAP ap = WiFiManager.GetConnectedAP();
- if (ap != null)
- {
- Log.Info(Globals.LogTag, "Forget");
- ap.ForgetAP();
- }
+ await networkSetup.ForgetCurrentAP();
await WiFiManager.DeactivateAsync();
- await Task.Delay(5000);
+ await Task.Delay(3000);
Assert.IsFalse(WiFiManager.IsActive, "WiFi doesn't turn off");
Log.Info(Globals.LogTag, "Successfully done");
if (!WiFiManager.IsActive)
{
await WiFiManager.ActivateAsync();
- await Task.Delay(5000);
- networkSetup.ForgetWiFi();
+ await Task.Delay(3000);
+ await networkSetup.ForgetCurrentAP();
await WiFiManager.DeactivateAsync();
- await Task.Delay(5000);
+ await Task.Delay(3000);
Assert.True(_flag, "Event DeviceStateChanged hasn't been call.");
}
else
{
- networkSetup.ForgetWiFi();
+ await networkSetup.ForgetCurrentAP();
await WiFiManager.DeactivateAsync();
- await Task.Delay(5000);
+ await Task.Delay(3000);
await WiFiManager.ActivateAsync();
- await Task.Delay(5000);
+ await Task.Delay(3000);
Assert.True(_flag, "Event DeviceStateChanged hasn't been call.");
}
WiFiManager.DeviceStateChanged -= EventHandlerDevice;
if (WiFiManager.IsActive)
{
Log.Info(Globals.LogTag, "WiFi is activated");
- networkSetup.ForgetWiFi();
- await WiFiManager.DeactivateAsync();
+ await tearDown();
}
await setUp();
Assert.True(_flag, "Event RssiLevelChanged hasn't been call.");
Console.WriteLine("Postconditions for each TESTCASE");
}
- public static async Task SetUp()
+ public static async Task setUp()
{
- await networkSetup.WiFiActivate(networkParameter.wnPRIVATE, networkParameter.wType.wPrivate, networkParameter.wPASS);
+ await networkSetup.ConnectWiFi(networkParameter.wnPRIVATE, networkParameter.wType.wPrivate, networkParameter.wPASS);
await Task.Delay(3000);
}
* Activate WiFi then get WiFi connected
* Create a WiFiNetwork object
*/
- await SetUp();
+ await setUp();
/*
* TEST CODE
* Activate WiFi then get WiFi connected
* Create a WiFiNetwork object
*/
- await SetUp();
+ await setUp();
/*
* TEST CODE
* Activate WiFi then get WiFi connected
* Create a WiFiNetwork object
*/
- await SetUp();
+ await setUp();
/*
* TEST CODE
* 2. Get connect AP
*/
Log.Info(Globals.LogTag, "GetBssids_GET start");
- await SetUp();
+ await setUp();
_wifiAP = WiFiManager.GetConnectedAP();
Assert.IsNotNull(_wifiAP, "No WiFi connection");
* Activate WiFi then get WiFi connected
* Create a WiFiNetwork object
*/
- await SetUp();
+ await setUp();
/*
* TEST CODE
* Activate WiFi then get WiFi connected
* Create a WiFiNetwork object
*/
- await SetUp();
+ await setUp();
/*
* TEST CODE
* Activate WiFi then get WiFi connected
* Create a WiFiNetwork object
*/
- await SetUp();
+ await setUp();
/*
* TEST CODE
* Activate WiFi then get WiFi connected
* Create a WiFiNetwork object
*/
- await SetUp();
+ await setUp();
/*
* TEST CODE
* Activate WiFi then get WiFi connected
* Create a WiFiNetwork object
*/
- await SetUp();
+ await setUp();
/*
* TEST CODE
* Activate WiFi then get WiFi connected
* Create a WiFiNetwork object
*/
- await SetUp();
+ await setUp();
/*
* TEST CODE
* Activate WiFi then get WiFi connected
* Create a WiFiNetwork object
*/
- await SetUp();
+ await setUp();
/*
* TEST CODE
* Activate WiFi then get WiFi connected
* Create a WiFiNetwork object
*/
- await SetUp();
+ await setUp();
/*
* TEST CODE
* Activate WiFi then get WiFi connected
* Create a WiFiNetwork object
*/
- await SetUp();
+ await setUp();
/*
* TEST CODE
* Activate WiFi then get WiFi connected
* Create a WiFiNetwork object
*/
- await SetUp();
+ await setUp();
/*
* TEST CODE
* Activate WiFi then get WiFi connected
* Create a WiFiNetwork object
*/
- await SetUp();
+ await setUp();
/*
* TEST CODE
Log.Info(Globals.LogTag, "Successfully done");
- _wifiAP.ForgetAP();
+ await _wifiAP.ForgetAPAsync();
await Task.Delay(3000);
- await SetUp();
+ await setUp();
Log.Info(Globals.LogTag, "Finished");
}
catch (NotSupportedException)
* Activate WiFi then get WiFi connected
* Create a WiFiNetwork object
*/
- await SetUp();
+ await setUp();
/*
* TEST CODE
Log.Info(Globals.LogTag, "Successfully done");
- _wifiAP.ForgetAP();
+ await _wifiAP.ForgetAPAsync();
await Task.Delay(3000);
- await SetUp();
+ await setUp();
Log.Info(Globals.LogTag, "Finished");
}
catch (NotSupportedException)
* 2. Get connect AP
*/
Log.Info(Globals.LogTag, "GetAllIPv6Addresses_ALL_TYPE start");
- await SetUp();
+ await setUp();
_wifiAP = WiFiManager.GetConnectedAP();
Assert.IsNotNull(_wifiAP, "No WiFi connection");
public static async Task setUp()
{
- await networkSetup.WiFiActivate(networkParameter.wnPRIVATE, networkParameter.wType.wPrivate, networkParameter.wPASS);
+ await networkSetup.ConnectWiFi(networkParameter.wnPRIVATE, networkParameter.wType.wPrivate, networkParameter.wPASS);
_wiFiAp = WiFiManager.GetConnectedAP();
Assert.IsNotNull(_wiFiAp, "No WiFi connection");
_wiFiNetwork = _wiFiAp.NetworkInformation;
public static async Task setup()
{
- await networkSetup.WiFiActivate(networkParameter.wnPRIVATE, networkParameter.wType.wPrivate, networkParameter.wPASS);
+ await networkSetup.ConnectWiFi(networkParameter.wnPRIVATE, networkParameter.wType.wPrivate, networkParameter.wPASS);
await Task.Delay(5000);
}
public class networkSetup
{
- public static networkSetup mInstance = new networkSetup();
- private static int MAX_SCAN_TRY = 12;
- private static int MAX_CONNECT_TRY = 3;
+ private static int MAX_SCAN_TRY = 3;
private networkSetup()
{
}
- public static async void ForgetWiFi()
+ public static async Task ForgetCurrentAP()
{
- Tizen.Log.Info(Globals.LogTag, "networkSetup.ForgetWiFi");
+ Tizen.Log.Info(Globals.LogTag, "networkSetup.ForgetCurrentAP");
WiFiAP ap = WiFiManager.GetConnectedAP();
- while (ap != null)
+ if (ap != null)
{
- Tizen.Log.Info(Globals.LogTag, "Connected AP " + ap.NetworkInformation.Essid + " --> Forget");
- ap.ForgetAP();
+ Tizen.Log.Info(Globals.LogTag, "Forget AP " + ap.NetworkInformation.Essid);
+ await ap.ForgetAPAsync();
ap.Dispose();
+ }
+ }
+
+ public static async Task ActivateWiFi()
+ {
+ Tizen.Log.Info(Globals.LogTag, "networkSetup.ActivateWiFi");
+ if (!WiFiManager.IsActive)
+ {
+ await WiFiManager.ActivateAsync();
await Task.Delay(3000);
- ap = WiFiManager.GetConnectedAP();
}
+ Tizen.Log.Info(Globals.LogTag, "WiFi is Activated");
}
- public static async Task DeactiveWiFi()
+ public static async Task DeactivateWiFi()
{
- Tizen.Log.Info(Globals.LogTag, "networkSetup.DeactiveWiFi");
+ Tizen.Log.Info(Globals.LogTag, "networkSetup.DeactivateWiFi");
if (WiFiManager.IsActive)
{
- WiFiAP ap = WiFiManager.GetConnectedAP();
- while (ap != null)
- {
- Tizen.Log.Info(Globals.LogTag, "Connected AP " + ap.NetworkInformation.Essid + " --> Forget");
- ap.ForgetAP();
- ap.Dispose();
- await Task.Delay(3000);
- ap = WiFiManager.GetConnectedAP();
- }
+ await ForgetCurrentAP();
await WiFiManager.DeactivateAsync();
Tizen.Log.Info(Globals.LogTag, "Deactivated");
}
}
- /*Connect to a WANTED AP*/
- public static async Task WiFiActivate(string WiFiName, networkParameter.wType type, string WiFiPass)
+ private static WiFiAP FindAP(string WiFiName)
{
- Tizen.Log.Info(Globals.LogTag, "WiFiActivate " + WiFiName + " " + WiFiPass);
+ Tizen.Log.Info(Globals.LogTag, "Find AP " + WiFiName + " from scan results");
+ var list = WiFiManager.GetFoundAPs();
- if (!WiFiManager.IsActive)
+ foreach (WiFiAP item in list)
{
- await WiFiManager.ActivateAsync();
- await Task.Delay(5000);
+ if (item.NetworkInformation.Essid == WiFiName)
+ {
+ Tizen.Log.Info(Globals.LogTag, "Found AP " + item.NetworkInformation.Essid.ToString());
+ return item;
+ }
+ item.Dispose();
}
+ return null;
+ }
- Tizen.Log.Info(Globals.LogTag, "Activated");
+ /* Connect to a WANTED AP */
+ public static async Task ConnectWiFi(string WiFiName, networkParameter.wType type, string WiFiPass)
+ {
+ Tizen.Log.Info(Globals.LogTag, "ConnectWiFi (AP: " + WiFiName + ", Password: " + WiFiPass + ")");
+
+ await ActivateWiFi();
+
+ WiFiAP ap = WiFiManager.GetConnectedAP();
+ // Already connected
+ if (ap != null && ap.NetworkInformation.Essid == WiFiName)
+ {
+ return;
+ }
- WiFiAP ap = null;
- ap = WiFiManager.GetConnectedAP();
+ /**
+ * Connected to another AP
+ * We need to forget it
+ */
if (ap != null)
{
Tizen.Log.Info(Globals.LogTag, "Connected AP " + ap.NetworkInformation.Essid);
+ await ForgetCurrentAP();
+ ap = WiFiManager.GetConnectedAP();
+ if (ap != null)
+ {
+ Tizen.Log.Error(Globals.LogTag, "AP must be null");
+ return;
+ }
}
- else
+ Tizen.Log.Info(Globals.LogTag, "No connected AP");
+
+ /**
+ * Find AP from scan results
+ * If it fails, scan Wi-Fi APs maximum three times
+ */
+ ap = FindAP(WiFiName);
+ for (int i = 0; i < MAX_SCAN_TRY && ap == null; i++)
{
- Tizen.Log.Info(Globals.LogTag, "No connected AP");
+ await Task.Delay(1000);
+ await WiFiManager.ScanAsync();
+ ap = FindAP(WiFiName);
}
- if (ap == null || ap.NetworkInformation.Essid != WiFiName)
+ // Scan Failure
+ if (ap == null)
{
- while (ap != null) {
- Tizen.Log.Info(Globals.LogTag, "Try to Forget " + ap.NetworkInformation.Essid);
- ap.ForgetAP();
- await Task.Delay(3000);
- ap = WiFiManager.GetConnectedAP();
- }
+ Tizen.Log.Error(Globals.LogTag, "AP " + WiFiName + " is not found");
+ return;
+ }
+
+ // Connect to AP
+ if (type != networkParameter.wType.wPublic)
+ {
+ Tizen.Log.Info(Globals.LogTag, "Set passphrase " + WiFiPass);
+ ap.SecurityInformation.SetPassphrase(WiFiPass);
+ }
- int connectTry = 0;
- for (int i = 0; i < MAX_SCAN_TRY; i++) {
- var list = WiFiManager.GetFoundAPs();
- Tizen.Log.Info(Globals.LogTag, "Get Scan List. Try: " + i);
-
- foreach (WiFiAP item in list)
- {
- if (item.NetworkInformation.Essid == WiFiName)
- {
- Tizen.Log.Info(Globals.LogTag, "Found AP " + item.NetworkInformation.Essid.ToString());
- if (type != networkParameter.wType.wPublic)
- {
- Tizen.Log.Info(Globals.LogTag, "Set passphrase");
- item.SecurityInformation.SetPassphrase(WiFiPass);
- }
- try
- {
- ap = WiFiManager.GetConnectedAP();
- if (ap != null && ap.NetworkInformation.Essid == WiFiName)
- return;
- await item.ConnectAsync();
- Tizen.Log.Info(Globals.LogTag, "Connected");
- return;
- }
- catch (System.Exception e)
- {
- /*
- * It is possible that ConnectAsync is failed due to some network environment issue.
- * In this case, we will try to connect the AP again.
- */
- if (connectTry == MAX_CONNECT_TRY)
- {
- Tizen.Log.Info(Globals.LogTag, "Failed to connect");
- throw e;
- }
- else
- {
- connectTry++;
- Tizen.Log.Info(Globals.LogTag, "Failed to connect --> try again after 3 seconds");
- await Task.Delay(3000);
- break;
- }
-
- }
- }
- }
- if (i == 3)
- {
- Tizen.Log.Info(Globals.LogTag, "Scan. Try: " + i);
- await WiFiManager.ScanAsync();
- }
- await Task.Delay(10000);
- } // for (int i = 0; i < MAX_SCAN_TRY; i++) {
- } // if (ap != null && ap.NetworkInformation.Essid != WiFiName)
- } // WiFiActivate()
+ await ap.ConnectAsync();
+ Tizen.Log.Info(Globals.LogTag, "Connected");
+ } // ConnectWiFi()
}
}