Fix wireless connection logic not to ask password again 42/98842/2 accepted/tizen/3.0/tv/20161122.035521 submit/tizen_3.0/20161121.050923
authorJiwan Kim <ji-wan.kim@samsung.com>
Mon, 21 Nov 2016 04:45:07 +0000 (13:45 +0900)
committerJiwan Kim <ji-wan.kim@samsung.com>
Mon, 21 Nov 2016 04:47:39 +0000 (13:47 +0900)
 - Fix for TSAM-10021
 - If AP was successfully connected, passphrase is not required on 2nd connection.

Change-Id: I33333f4a2ab4f72c206c20d208fc00d2846bae79
Signed-off-by: Jiwan Kim <ji-wan.kim@samsung.com>
CMakeLists.txt
include/data/system/settings_wireless.h [new file with mode: 0644]
src/data/system/settings_wireless.c [new file with mode: 0644]
src/layout/layout_network.c

index 651df84..0eb07b1 100644 (file)
@@ -78,6 +78,7 @@ SET(SRCS
        src/data/system/settings_language.c
        src/data/system/settings_pincode.c
        src/data/system/settings_wakeup_timer.c
+       src/data/system/settings_wireless.c
        src/data/system/data_location.c
        src/data/system/data_wired.c
        src/data/system/data_wireless.c
diff --git a/include/data/system/settings_wireless.h b/include/data/system/settings_wireless.h
new file mode 100644 (file)
index 0000000..fb43e17
--- /dev/null
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __AIR_SETTINGS_WIRELESS_H__
+#define __AIR_SETTINGS_WIRELESS_H__
+
+#include <stdbool.h>
+#include <wifi.h>
+
+/**
+* @brief Gets if passphrase is required for specific AP.
+*
+* @param[in] ap The access point handle
+*
+* @return True on success, false otherwise.
+*/
+bool settings_wireless_passharase_required(wifi_ap_h ap);
+
+#endif /* __AIR_SETTINGS_WIRELESS_H__ */
diff --git a/src/data/system/settings_wireless.c b/src/data/system/settings_wireless.c
new file mode 100644 (file)
index 0000000..5f5a84c
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "data/system/settings_wireless.h"
+#include "app_debug.h"
+
+bool settings_wireless_passharase_required(wifi_ap_h ap)
+{
+       bool res = false;
+       int r;
+
+       if (!ap)
+               return false;
+
+       r = wifi_ap_is_passphrase_required(ap, &res);
+       if (WIFI_ERROR_NONE != r) {
+               _ERR("Failed to get result [%X]", r);
+       }
+
+       return res;
+}
index e9ac2b3..88e941a 100644 (file)
@@ -26,6 +26,7 @@
 #include "common/viewmgr.h"
 #include "data/system/data_wired.h"
 #include "data/system/data_wireless.h"
+#include "data/system/settings_wireless.h"
 #include "define.h"
 #include "grid/grid_wireless.h"
 #include "layout.h"
@@ -948,6 +949,7 @@ static void _wireless_selected_cb(Elm_Object_Item *it, void *data)
        struct _priv *priv;
        struct wifi_ap_info *ap_info;
        char *wifi_name;
+       bool required = false;
 
        if (!it || !data) {
                _ERR("Invalid argument.");
@@ -967,7 +969,9 @@ static void _wireless_selected_cb(Elm_Object_Item *it, void *data)
                return;
        }
 
-       if (ap_info->secure_type != WIFI_SECURITY_TYPE_NONE) {
+       required = settings_wireless_passharase_required(ap_info->ap);
+       _DBG("Passphrase required : %s", (required) ? "True" : "False");
+       if (required) {
                wifi_name = ap_info->essid;
                if (!wifi_name)
                        return;