From: Akash Date: Fri, 18 Nov 2022 10:34:11 +0000 (+0530) Subject: Fix network connection issue on a AP click. X-Git-Tag: accepted/tizen/unified/20221216.024031~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F44%2F284544%2F1;p=profile%2Fiot%2Fapps%2Fdotnet%2Fsetting-wifi.git Fix network connection issue on a AP click. This patch fixes following issues: - Do not pop the password input page when an AP type is open. - Check if connect is done when after the password from keyboard input. Change-Id: Ia04c445c36e1364a49f4b8f7ab61ea292dfdd3c0 Signed-off-by: Akash --- diff --git a/SettingWiFi/SettingWiFi/model/AP.cs b/SettingWiFi/SettingWiFi/model/AP.cs index fdf42ff..94fc6b8 100755 --- a/SettingWiFi/SettingWiFi/model/AP.cs +++ b/SettingWiFi/SettingWiFi/model/AP.cs @@ -183,6 +183,15 @@ namespace SettingWiFi return ""; } + public bool IsAPOpen() + { + if (secType == WiFiSecurityType.None) + { + return true; + } + return false; + } + public string ImageUrl { get diff --git a/SettingWiFi/SettingWiFi/view/ConnectPage.cs b/SettingWiFi/SettingWiFi/view/ConnectPage.cs index d6086fe..98db6c8 100644 --- a/SettingWiFi/SettingWiFi/view/ConnectPage.cs +++ b/SettingWiFi/SettingWiFi/view/ConnectPage.cs @@ -12,6 +12,7 @@ namespace SettingWiFi { private AP mAp; private WiFi mWifi; + private TextField passwordField; internal ConnectPage(WiFi wifi) { @@ -84,7 +85,8 @@ namespace SettingWiFi HeightSpecification = LayoutParamPolicies.WrapContent, }; - connectView.Add(CreatePasswordField()); + passwordField = CreatePasswordField(); + connectView.Add(passwordField); connectView.Add(CreateWpsItem()); var cancelButton = new Button() @@ -129,7 +131,7 @@ namespace SettingWiFi { Debug("Connect"); //mAp.StateInfo = Resources.IDS_WIFI_BODY_CONNECTING_ING; - await mWifi.Connect(mAp, "datanetwork"); + await mWifi.Connect(mAp, passwordField.Text); if(mWifi.GetConnectedAP().Equals(mAp.Essid)) { @@ -137,4 +139,4 @@ namespace SettingWiFi } } } -} \ No newline at end of file +} diff --git a/SettingWiFi/SettingWiFi/view/MainPage.cs b/SettingWiFi/SettingWiFi/view/MainPage.cs index 8e29245..72717ff 100644 --- a/SettingWiFi/SettingWiFi/view/MainPage.cs +++ b/SettingWiFi/SettingWiFi/view/MainPage.cs @@ -318,6 +318,17 @@ namespace SettingWiFi return page; } + private async void ConnectOpenAP(AP ap) + { + Debug("Connect open AP"); + await mWifi.Connect(ap, ""); + + if (mWifi.GetConnectedAP().Equals(ap.Essid)) + { + ap.StateInfo = Resources.IDS_WIFI_SBODY_CONNECTED_M_STATUS; + } + } + /* Call WiFi */ private async void OnWiFiSelected(object sender, SelectedChangedEventArgs e) { @@ -379,8 +390,15 @@ namespace SettingWiFi DefaultLinearItem deviceItem = (DefaultLinearItem)sender; var device = deviceItem.BindingContext as AP; Info("OnAPClicked: " + device.Essid); - mConnectPage = CreateConnectPage(device); - Navigator.Push(mConnectPage); + if (device.IsAPOpen()) + { + ConnectOpenAP(device); + } + else + { + mConnectPage = CreateConnectPage(device); + Navigator.Push(mConnectPage); + } } public async void OnScanListSelected(object sender, SelectionChangedEventArgs ev)