Replace WPS scan to BSSID scan keywords. 08/137008/3 accepted/tizen/unified/20170710.154655 submit/tizen/20170710.074033
authorMilind Ramesh Murhekar <m.murhekar@samsung.com>
Tue, 4 Jul 2017 05:42:12 +0000 (11:12 +0530)
committerMilind Ramesh Murhekar <m.murhekar@samsung.com>
Fri, 7 Jul 2017 05:45:10 +0000 (11:15 +0530)
Descritpion: This patch replaces the WPS scan
to BSSID scan to avoid confusion between
WPS (Wi-Fi Protected Setup) features.

Change-Id: I08080556383807782cd4d7c263c3c681d2f5e486
Signed-off-by: Milind Ramesh Murhekar <m.murhekar@samsung.com>
include/wifi-wps.h
interfaces/netconfig-iface-wifi.xml
resources/etc/dbus-1/system.d/net-config.conf
src/wifi-wps.c
src/wifi.c

index 61d2539..0879498 100755 (executable)
@@ -37,7 +37,7 @@ gboolean netconfig_wifi_is_wps_enabled(void);
 void netconfig_wifi_wps_signal_scandone(void);
 void netconfig_wifi_wps_signal_scanaborted(void);
 
-gboolean handle_request_wps_scan(Wifi *wifi, GDBusMethodInvocation *context);
+gboolean handle_request_bssid_scan(Wifi *wifi, GDBusMethodInvocation *context);
 gboolean handle_request_wps_connect(Wifi *wifi, GDBusMethodInvocation *context, gchar *param);
 gboolean handle_request_wps_cancel(Wifi *wifi, GDBusMethodInvocation *context);
 void netconfig_wifi_notify_wps_completed(const char *ssid, gsize ssid_len);
index 719a572..4a253ec 100755 (executable)
@@ -31,7 +31,7 @@
                <method name="RequestSpecificScan">
                        <arg type="s" name="SSID" direction="in"/>
                </method>
-               <method name="RequestWpsScan">
+               <method name="RequestBssidScan">
                </method>
                <method name="RequestWpsCancel">
                </method>
                <signal name="SpecificScanCompleted">
                        <arg type="a{sv}" name="Fields" direction="out"/>
                </signal>
-               <signal name="WpsScanCompleted">
+               <signal name="BssidScanCompleted">
                        <arg type="a{sv}" name="Fields" direction="out"/>
                </signal>
        </interface>
index a67582c..ffc5439 100755 (executable)
@@ -30,7 +30,7 @@
 
                <check send_destination="net.netconfig" send_interface="net.netconfig.wifi" send_member="DeleteEapConfig" privilege="http://tizen.org/privilege/network.profile" />
                <check send_destination="net.netconfig" send_interface="net.netconfig.wifi" send_member="RequestSpecificScan" privilege="http://tizen.org/privilege/network.set" />
-               <check send_destination="net.netconfig" send_interface="net.netconfig.wifi" send_member="RequestWpsScan" privilege="http://tizen.org/privilege/network.set" />
+               <check send_destination="net.netconfig" send_interface="net.netconfig.wifi" send_member="RequestBssidScan" privilege="http://tizen.org/privilege/network.set" />
                <check send_destination="net.netconfig" send_interface="net.netconfig.wifi" send_member="RequestWpsCancel" privilege="http://tizen.org/privilege/network.set" />
                <check send_destination="net.netconfig" send_interface="net.netconfig.wifi" send_member="RequestWpsConnect" privilege="http://tizen.org/privilege/network.set" />
                <check send_destination="net.netconfig" send_interface="net.netconfig.wifi" send_member="CreateEapConfig" privilege="http://tizen.org/privilege/network.profile" />
@@ -53,7 +53,7 @@
                <check send_destination="net.netconfig" send_interface="net.netconfig.wifi" send_member="PowerOnCompleted" privilege="http://tizen.org/privilege/network.get" />
                <check send_destination="net.netconfig" send_interface="net.netconfig.wifi" send_member="PowerOffCompleted" privilege="http://tizen.org/privilege/network.get" />
                <check send_destination="net.netconfig" send_interface="net.netconfig.wifi" send_member="SpecificScanCompleted" privilege="http://tizen.org/privilege/network.get" />
-               <check send_destination="net.netconfig" send_interface="net.netconfig.wifi" send_member="WpsScanCompleted" privilege="http://tizen.org/privilege/network.get" />
+               <check send_destination="net.netconfig" send_interface="net.netconfig.wifi" send_member="BssidScanCompleted" privilege="http://tizen.org/privilege/network.get" />
                <check send_destination="net.netconfig" send_interface="net.netconfig.wifi" send_member="TdlsDisconnect" privilege="http://tizen.org/privilege/network.set" />
                <check send_destination="net.netconfig" send_interface="net.netconfig.wifi" send_member="TdlsConnectedPeer" privilege="http://tizen.org/privilege/network.get" />
 
index 792c706..38d4544 100755 (executable)
 
 static gboolean netconfig_is_wps_enabled = FALSE;
 static gboolean netconfig_is_device_scanning = FALSE;
-static gboolean netconfig_is_wps_scan_aborted = FALSE;
+static gboolean netconfig_is_bssid_scan_aborted = FALSE;
 static int wps_bss_list_count = 0;
 
-struct wps_bss_info_t {
+struct bssid_scan_info_t {
        unsigned char ssid[NETCONFIG_SSID_LEN + 1];
        unsigned char bssid[NETCONFIG_BSSID_LEN + 1];
        int ssid_len;
@@ -170,7 +170,7 @@ static void __netconfig_wifi_wps_notify_scan_done(void)
 
        builder = g_variant_builder_new(G_VARIANT_TYPE("a{sv}"));
        for (list = wps_bss_info_list; list != NULL; list = list->next) {
-               struct wps_bss_info_t *bss_info = (struct wps_bss_info_t *)list->data;
+               struct bssid_scan_info_t *bss_info = (struct bssid_scan_info_t *)list->data;
 
                if (bss_info) {
                        gchar bssid_buff[18] = { 0, };
@@ -198,7 +198,7 @@ static void __netconfig_wifi_wps_notify_scan_done(void)
                }
        }
 
-       wifi_emit_wps_scan_completed((Wifi *)get_wifi_object(), g_variant_builder_end(builder));
+       wifi_emit_bssid_scan_completed((Wifi *)get_wifi_object(), g_variant_builder_end(builder));
        g_variant_builder_unref(builder);
 
        if (wps_bss_info_list != NULL)
@@ -206,7 +206,7 @@ static void __netconfig_wifi_wps_notify_scan_done(void)
 
        wps_bss_info_list = NULL;
        wps_bss_list_count = 0;
-       INFO("WpsScanCompleted");
+       INFO("BSSIDScanCompleted");
 
        return;
 }
@@ -218,7 +218,7 @@ static void __netconfig_wifi_wps_get_bss_info_result(
        GVariant *value;
        GVariantIter *iter;
        gchar *key;
-       struct wps_bss_info_t *bss_info;
+       struct bssid_scan_info_t *bss_info;
        GDBusConnection *conn = NULL;
        GError *error = NULL;
 
@@ -231,7 +231,7 @@ static void __netconfig_wifi_wps_get_bss_info_result(
                goto done;
        }
 
-       bss_info = g_try_new0(struct wps_bss_info_t, 1);
+       bss_info = g_try_new0(struct bssid_scan_info_t, 1);
        if (bss_info == NULL)
                goto done;
 
@@ -297,7 +297,7 @@ done:
        if (wps_bss_list_count <= 0) {
                __netconfig_wifi_wps_notify_scan_done();
 
-               if (netconfig_is_wps_scan_aborted == FALSE)
+               if (netconfig_is_bssid_scan_aborted == FALSE)
                        wifi_power_driver_and_supplicant(FALSE);
        }
 }
@@ -364,11 +364,11 @@ done:
 
        netconfig_gdbus_pending_call_unref();
 
-       /* Send WpsScanCompleted signal even when the BSS count is 0 */
+       /* Send BssidScanCompleted signal even when the BSS count is 0 */
        if (wps_bss_list_count <= 0 && counter_flag == FALSE) {
                __netconfig_wifi_wps_notify_scan_done();
 
-               if (netconfig_is_wps_scan_aborted == FALSE)
+               if (netconfig_is_bssid_scan_aborted == FALSE)
                        wifi_power_driver_and_supplicant(FALSE);
        }
 }
@@ -412,7 +412,7 @@ void netconfig_wifi_wps_signal_scandone(void)
 void netconfig_wifi_wps_signal_scanaborted(void)
 {
        wps_bss_list_count = 0;
-       netconfig_is_wps_scan_aborted = TRUE;
+       netconfig_is_bssid_scan_aborted = TRUE;
        _netconfig_wifi_wps_get_bsss();
 
        netconfig_is_device_scanning = FALSE;
@@ -420,7 +420,7 @@ void netconfig_wifi_wps_signal_scanaborted(void)
        __netconfig_wps_set_mode(FALSE);
 }
 
-static int __netconfig_wifi_wps_request_scan(const char *if_path)
+static int __netconfig_wifi_bssid_request_scan(const char *if_path)
 {
        GDBusConnection *connection = NULL;
        GVariant *message = NULL;
@@ -469,7 +469,7 @@ static int __netconfig_wifi_wps_request_scan(const char *if_path)
                wps_bss_info_list = NULL;
        }
 
-       netconfig_is_wps_scan_aborted = FALSE;
+       netconfig_is_bssid_scan_aborted = FALSE;
 
        return 0;
 }
@@ -489,17 +489,17 @@ static void __netconfig_wifi_interface_create_result(
                g_variant_get(message, "(o)", &path);
 
                if (path) {
-                       __netconfig_wifi_wps_request_scan(path);
+                       __netconfig_wifi_bssid_request_scan(path);
                        g_free(path);
                }
        } else if (NULL != strstr(error->message, ".InterfaceExists")) {
                INFO("Error Message %s %s", error->message, path);
                g_variant_get(message, "(o)", &path);
                if (path) {
-                       __netconfig_wifi_wps_request_scan(path);
+                       __netconfig_wifi_bssid_request_scan(path);
                        g_free(path);
                } else
-                       __netconfig_wifi_wps_request_scan(NULL);
+                       __netconfig_wifi_bssid_request_scan(NULL);
        } else {
                ERR("Failed to create interface, Error: %d[%s]", error->code, error->message);
                __netconfig_wps_set_mode(FALSE);
@@ -545,7 +545,7 @@ static int  __netconfig_wifi_wps_create_interface(void)
        return 0;
 }
 
-static int __netconfig_wifi_wps_scan(void)
+static int __netconfig_wifi_bssid_scan(void)
 {
        int err = 0;
        wifi_tech_state_e wifi_tech_state;
@@ -562,7 +562,7 @@ static int __netconfig_wifi_wps_scan(void)
 
        netconfig_is_device_scanning = TRUE;
 
-       DBG("WPS scan requested");
+       DBG("BSSID scan requested");
        if (wifi_tech_state >= NETCONFIG_WIFI_TECH_POWERED) {
                if (netconfig_wifi_get_scanning() == TRUE)
                        return -EINPROGRESS;
@@ -570,7 +570,7 @@ static int __netconfig_wifi_wps_scan(void)
                netconfig_wifi_bgscan_start(TRUE);
 
                if (wifi_tech_state == NETCONFIG_WIFI_TECH_CONNECTED)
-                       __netconfig_wifi_wps_request_scan(NULL);
+                       __netconfig_wifi_bssid_request_scan(NULL);
        } else {
                err = __netconfig_wifi_wps_create_interface();
        }
@@ -578,7 +578,7 @@ static int __netconfig_wifi_wps_scan(void)
        return err;
 }
 
-gboolean handle_request_wps_scan(Wifi *wifi, GDBusMethodInvocation *context)
+gboolean handle_request_bssid_scan(Wifi *wifi, GDBusMethodInvocation *context)
 {
        int err, enabled = 0;
        wifi_tech_state_e tech_state;
@@ -602,7 +602,7 @@ gboolean handle_request_wps_scan(Wifi *wifi, GDBusMethodInvocation *context)
        tech_state = wifi_state_get_technology_state();
        if (tech_state <= NETCONFIG_WIFI_TECH_OFF) {
 #if !defined TIZEN_WEARABLE
-               netconfig_vconf_get_int(VCONF_WIFI_ALWAYS_ALLOW_SCANNING, &enabled);
+               enabled = 1;
 #else
                enabled = 0;
 #endif
@@ -615,7 +615,7 @@ gboolean handle_request_wps_scan(Wifi *wifi, GDBusMethodInvocation *context)
 
        __netconfig_wps_set_mode(TRUE);
 
-       err = __netconfig_wifi_wps_scan();
+       err = __netconfig_wifi_bssid_scan();
        if (err < 0) {
                if (err == -EINPROGRESS)
                        netconfig_error_inprogress(context);
@@ -625,7 +625,7 @@ gboolean handle_request_wps_scan(Wifi *wifi, GDBusMethodInvocation *context)
                return FALSE;
        }
 
-       wifi_complete_request_wps_scan(wifi, context);
+       wifi_complete_request_bssid_scan(wifi, context);
        return TRUE;
 }
 
index 18f0d39..dd4dcc5 100755 (executable)
@@ -162,8 +162,8 @@ void wifi_object_create_and_init(void)
        /* WIFI scan */
        g_signal_connect(wifi_object, "handle-request-specific-scan",
                        G_CALLBACK(handle_request_specific_scan), NULL);
-       g_signal_connect(wifi_object, "handle-request-wps-scan",
-                       G_CALLBACK(handle_request_wps_scan), NULL);
+       g_signal_connect(wifi_object, "handle-request-bssid-scan",
+                       G_CALLBACK(handle_request_bssid_scan), NULL);
 
        /* WPS Connect */
        g_signal_connect(wifi_object, "handle-request-wps-connect",