--- /dev/null
+using Tizen;
+
+namespace SettingWiFi
+{
+ internal class Logger
+ {
+ internal static readonly string LogTag = "SettingWiFi.App";
+
+ internal static void Debug(string msg)
+ {
+ Log.Debug(LogTag, msg);
+ }
+
+ internal static void Info(string msg)
+ {
+ Log.Info(LogTag, msg);
+ }
+
+ internal static void Error(string msg)
+ {
+ Log.Error(LogTag, msg);
+ }
+ }
+}
\ No newline at end of file
return null;\r
}\r
\r
- public async Task Connect(string essid, string password)\r
+ public async Task Connect(AP ap, string password)\r
{\r
Debug("WiFi.Connect");\r
- WiFiAP ap = FindAP(essid);\r
+\r
if (ap == null)\r
{\r
- Debug("Cannet find " + essid);\r
+ Debug("Cannot find AP");\r
return;\r
}\r
\r
+ WiFiAP apHandle = ap.ApHandle;\r
if (password.Length > 0)\r
{\r
- ap.SecurityInformation.SetPassphrase(password);\r
+ apHandle.SecurityInformation.SetPassphrase(password);\r
}\r
\r
try\r
{\r
- await ap.ConnectAsync();\r
+ await apHandle.ConnectAsync();\r
}\r
catch (Exception e)\r
{\r
\r
if (item.NetworkInformation.ConnectionState.ToString().Equals(Resources.IDS_WIFI_SBODY_CONNECTED_M_STATUS))\r
{\r
- apInfoList.Add(new AP(item.NetworkInformation.Essid, Resources.IDS_WIFI_SBODY_CONNECTED_M_STATUS, securityType, isWpsSupported));\r
+ apInfoList.Add(new AP(item, item.NetworkInformation.Essid, Resources.IDS_WIFI_SBODY_CONNECTED_M_STATUS, securityType, isWpsSupported));\r
continue;\r
}\r
string text = "";\r
text = Resources.IDS_ST_BODY_SECURED_ABB_M_WIFI_AP_SUMMARY;\r
}\r
\r
- apInfoList.Add(new AP(item.NetworkInformation.Essid, text, securityType, isWpsSupported));\r
+ apInfoList.Add(new AP(item, item.NetworkInformation.Essid, text, securityType, isWpsSupported));\r
}\r
\r
return apInfoList;\r
--- /dev/null
+using System;\r
+using System.ComponentModel;\r
+using System.Collections.Generic;\r
+using System.Collections.ObjectModel;\r
+using Tizen;\r
+using Tizen.NUI.BaseComponents;\r
+using Tizen.NUI.Components;\r
+using Tizen.NUI.Binding;\r
+using Tizen.Network.WiFi;\r
+using SettingWiFi.res.locale;\r
+using static SettingWiFi.Logger;\r
+\r
+\r
+namespace SettingWiFi\r
+{\r
+ public class AP : INotifyPropertyChanged\r
+ {\r
+ string iconDir = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "icon.png";\r
+ private string essid;\r
+ private string state;\r
+ private string secType;\r
+ private bool isWps;\r
+\r
+ public event PropertyChangedEventHandler PropertyChanged;\r
+\r
+ private void OnPropertyChanged(string propertyName)\r
+ {\r
+ Debug("OnPropertyChanged");\r
+ PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));\r
+ }\r
+\r
+ public AP(WiFiAP apHandle, string apEssid, string apState, string apSecType, bool apIsWps)\r
+ {\r
+ ApHandle = apHandle;\r
+ essid = apEssid;\r
+ state = apState;\r
+ secType = apSecType;\r
+ isWps = apIsWps;\r
+ }\r
+\r
+ public WiFiAP ApHandle\r
+ {\r
+ get;\r
+ set;\r
+ }\r
+\r
+ public string Essid\r
+ {\r
+ get\r
+ {\r
+ return essid;\r
+ }\r
+ set\r
+ {\r
+ essid = value;\r
+ OnPropertyChanged("Essid");\r
+ }\r
+ }\r
+\r
+ public string ImageUrl\r
+ {\r
+ get\r
+ {\r
+ return iconDir;\r
+ }\r
+ }\r
+\r
+ public string State\r
+ {\r
+ get\r
+ {\r
+ return state;\r
+ }\r
+ set\r
+ {\r
+ state = value;\r
+ OnPropertyChanged("State");\r
+ }\r
+ }\r
+\r
+ public string SecType\r
+ {\r
+ get\r
+ {\r
+ return secType;\r
+ }\r
+ }\r
+\r
+ public bool IsWps\r
+ {\r
+ get\r
+ {\r
+ return isWps;\r
+ }\r
+ }\r
+ };\r
+}
\ No newline at end of file
+++ /dev/null
-using System;\r
-using System.ComponentModel;\r
-using System.Collections.Generic;\r
-using System.Collections.ObjectModel;\r
-using Tizen;\r
-using Tizen.NUI.BaseComponents;\r
-using Tizen.NUI.Components;\r
-using Tizen.NUI.Binding;\r
-using Tizen.Network.WiFi;\r
-using SettingWiFi.res.locale;\r
-using static SettingWiFi.Logger;\r
-\r
-\r
-namespace SettingWiFi\r
-{\r
- public class AP : INotifyPropertyChanged\r
- {\r
- string iconDir = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "icon.png";\r
- private string essid;\r
- private string state;\r
- private string secType;\r
- private bool isWps;\r
-\r
- public event PropertyChangedEventHandler PropertyChanged;\r
-\r
- private void OnPropertyChanged(string propertyName)\r
- {\r
- Debug("OnPropertyChanged");\r
- PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));\r
- }\r
-\r
- public AP(string apEssid, string apState, string apSecType, bool apIsWps)\r
- {\r
- essid = apEssid;\r
- state = apState;\r
- secType = apSecType;\r
- isWps = apIsWps;\r
- }\r
-\r
- public string Essid\r
- {\r
- get\r
- {\r
- return essid;\r
- }\r
- set\r
- {\r
- essid = value;\r
- OnPropertyChanged("Essid");\r
- }\r
- }\r
-\r
- public string ImageUrl\r
- {\r
- get\r
- {\r
- return iconDir;\r
- }\r
- }\r
-\r
- public string State\r
- {\r
- get\r
- {\r
- return state;\r
- }\r
- set\r
- {\r
- state = value;\r
- OnPropertyChanged("State");\r
- }\r
- }\r
-\r
- public string SecType\r
- {\r
- get\r
- {\r
- return secType;\r
- }\r
- }\r
-\r
- public bool IsWps\r
- {\r
- get\r
- {\r
- return isWps;\r
- }\r
- }\r
- };\r
-\r
- public class DeviceCollection : ObservableCollection<AP>\r
- {\r
- private string title;\r
-\r
- public DeviceCollection(string groupTitle)\r
- {\r
- title = groupTitle;\r
- this.UpdateScanList(null);\r
- }\r
-\r
- public string Title\r
- {\r
- get\r
- {\r
- return title;\r
- }\r
- set\r
- {\r
- title = value;\r
- OnPropertyChanged(new PropertyChangedEventArgs("Title"));\r
- }\r
- }\r
-\r
- public void UpdateScanList(List<AP> apList)\r
- {\r
- if (apList == null)\r
- {\r
- Debug("apList is null");\r
- this.Add(new AP("", "", "", false));\r
- return;\r
- }\r
- // Clear method have some issue about asynchronous actions,\r
- // so call Remove for all item is recommanded.\r
- while (this.Count > 0)\r
- {\r
- this.RemoveAt(this.Count - 1);\r
- }\r
-\r
- foreach (var item in apList)\r
- {\r
- this.Add(new AP(item.Essid, item.State, item.SecType, item.IsWps));\r
- }\r
- }\r
-\r
- public void RemoveScanList()\r
- {\r
- while (this.Count > 0)\r
- {\r
- this.RemoveAt(this.Count - 1);\r
- }\r
- }\r
-\r
- public void UpdateState(AP ap)\r
- {\r
- string text = "";\r
-\r
- if (ap.SecType.Equals(Resources.IDS_ST_BODY_NONE))\r
- {\r
- text = Resources.IDS_WIFI_POP_OPEN;\r
- }\r
- else if (ap.SecType.Equals(Resources.IDS_WIFI_BODY_EAP))\r
- {\r
- text = Resources.IDS_ST_BODY_SECURED_ABB_M_WIFI_AP_SUMMARY + " (Eap)";\r
- }\r
- else if (ap.IsWps)\r
- {\r
- text = Resources.IDS_ST_BODY_SECURED_ABB_M_WIFI_AP_SUMMARY + " (WPS available)";\r
- }\r
- else\r
- {\r
- text = Resources.IDS_ST_BODY_SECURED_ABB_M_WIFI_AP_SUMMARY;\r
- }\r
-\r
- ap.State = text;\r
- }\r
- }\r
-\r
- public class APSource : ObservableCollection<DeviceCollection>\r
- {\r
- private DeviceCollection available;\r
- public APSource()\r
- {\r
- available = new DeviceCollection("Available networks");\r
- this.Add(available);\r
- }\r
-\r
- public void UpdateScanList(List<AP> apList)\r
- {\r
- available.UpdateScanList(apList);\r
- }\r
-\r
- public void RemoveScanList()\r
- {\r
- available.RemoveScanList();\r
- }\r
-\r
- public void UpdateState(AP ap)\r
- {\r
- available.UpdateState(ap);\r
- }\r
- }\r
-}
\ No newline at end of file
--- /dev/null
+using System;\r
+using System.ComponentModel;\r
+using System.Collections.Generic;\r
+using System.Collections.ObjectModel;\r
+using Tizen;\r
+using Tizen.NUI.BaseComponents;\r
+using Tizen.NUI.Components;\r
+using Tizen.NUI.Binding;\r
+using Tizen.Network.WiFi;\r
+using SettingWiFi.res.locale;\r
+using static SettingWiFi.Logger;\r
+\r
+\r
+namespace SettingWiFi\r
+{\r
+ public class DeviceCollection : ObservableCollection<AP>\r
+ {\r
+ private string title;\r
+\r
+ public DeviceCollection(string groupTitle)\r
+ {\r
+ title = groupTitle;\r
+ this.UpdateScanList(null);\r
+ }\r
+\r
+ public string Title\r
+ {\r
+ get\r
+ {\r
+ return title;\r
+ }\r
+ set\r
+ {\r
+ title = value;\r
+ OnPropertyChanged(new PropertyChangedEventArgs("Title"));\r
+ }\r
+ }\r
+\r
+ public void UpdateScanList(List<AP> apList)\r
+ {\r
+ if (apList == null)\r
+ {\r
+ Debug("apList is null");\r
+ this.Add(new AP(null, "", "", "", false));\r
+ return;\r
+ }\r
+ // Clear method have some issue about asynchronous actions,\r
+ // so call Remove for all item is recommanded.\r
+ while (this.Count > 0)\r
+ {\r
+ this.RemoveAt(this.Count - 1);\r
+ }\r
+\r
+ foreach (var item in apList)\r
+ {\r
+ this.Add(new AP(item.ApHandle, item.Essid, item.State, item.SecType, item.IsWps));\r
+ }\r
+ }\r
+\r
+ public void RemoveScanList()\r
+ {\r
+ while (this.Count > 0)\r
+ {\r
+ this.RemoveAt(this.Count - 1);\r
+ }\r
+ }\r
+\r
+ public void UpdateState(AP ap)\r
+ {\r
+ string text = "";\r
+\r
+ if (ap.SecType.Equals(Resources.IDS_ST_BODY_NONE))\r
+ {\r
+ text = Resources.IDS_WIFI_POP_OPEN;\r
+ }\r
+ else if (ap.SecType.Equals(Resources.IDS_WIFI_BODY_EAP))\r
+ {\r
+ text = Resources.IDS_ST_BODY_SECURED_ABB_M_WIFI_AP_SUMMARY + " (Eap)";\r
+ }\r
+ else if (ap.IsWps)\r
+ {\r
+ text = Resources.IDS_ST_BODY_SECURED_ABB_M_WIFI_AP_SUMMARY + " (WPS available)";\r
+ }\r
+ else\r
+ {\r
+ text = Resources.IDS_ST_BODY_SECURED_ABB_M_WIFI_AP_SUMMARY;\r
+ }\r
+\r
+ ap.State = text;\r
+ }\r
+ }\r
+\r
+ public class APSource : ObservableCollection<DeviceCollection>\r
+ {\r
+ private DeviceCollection available;\r
+ public APSource()\r
+ {\r
+ available = new DeviceCollection("Available networks");\r
+ this.Add(available);\r
+ }\r
+\r
+ public void UpdateScanList(List<AP> apList)\r
+ {\r
+ available.UpdateScanList(apList);\r
+ }\r
+\r
+ public void RemoveScanList()\r
+ {\r
+ available.RemoveScanList();\r
+ }\r
+\r
+ public void UpdateState(AP ap)\r
+ {\r
+ available.UpdateState(ap);\r
+ }\r
+ }\r
+}
\ No newline at end of file
Navigator.Pop();
}
- private async void Connect()
+ private void Connect()
{
mAp.State = Resources.IDS_WIFI_BODY_CONNECTING_ING;
- await mWifi.Connect(mAp.Essid, "datanetwork");
-
- if(mWifi.GetConnectedAP().Equals(mAp.Essid))
- {
- mAp.State = Resources.IDS_WIFI_SBODY_CONNECTED_M_STATUS;
- }
+ mWifi.Connect(mAp, "datanetwork");
}
}
}
\ No newline at end of file
+++ /dev/null
-using Tizen;
-
-namespace SettingWiFi
-{
- internal class Logger
- {
- internal static readonly string LogTag = "SettingWiFi.App";
-
- internal static void Debug(string msg)
- {
- Log.Debug(LogTag, msg);
- }
-
- internal static void Info(string msg)
- {
- Log.Info(LogTag, msg);
- }
-
- internal static void Error(string msg)
- {
- Log.Error(LogTag, msg);
- }
- }
-}
\ No newline at end of file