[SPIN] request RemoveNetwork when disconnected to stop scanning in supplicant. 40/74640/3
authorNiraj Kumar Goit <niraj.g@samsung.com>
Wed, 15 Jun 2016 10:43:46 +0000 (16:13 +0530)
committerNiraj Kumar Goit <niraj.g@samsung.com>
Fri, 17 Jun 2016 10:31:23 +0000 (03:31 -0700)
Change-Id: I4248b2de4d00d4218dcfac078bcda3e95db83896
Signed-off-by: Niraj Kumar Goit <niraj.g@samsung.com>
gsupplicant/gsupplicant.h
gsupplicant/supplicant.c
plugins/wifi.c

index 776f613..9d53d16 100755 (executable)
@@ -291,6 +291,9 @@ int g_supplicant_interface_disconnect(GSupplicantInterface *interface,
                                        GSupplicantInterfaceCallback callback,
                                                        void *user_data);
 
+#if defined TIZEN_EXT
+int g_supplicant_interface_remove_network(GSupplicantInterface *interface);
+#endif
 int g_supplicant_interface_set_apscan(GSupplicantInterface *interface,
                                                        unsigned int ap_scan);
 
index 2bb676e..fb71df6 100755 (executable)
@@ -2254,6 +2254,9 @@ static void interface_property(const char *key, DBusMessageIter *iter,
        } else if (g_strcmp0(key, "CurrentBSS") == 0) {
                interface_bss_added_without_keys(iter, interface);
        } else if (g_strcmp0(key, "CurrentNetwork") == 0) {
+#if defined TIZEN_EXT
+               if (interface->state != G_SUPPLICANT_STATE_COMPLETED)
+#endif
                interface_network_added(iter, interface);
        } else if (g_strcmp0(key, "BSSs") == 0) {
                supplicant_dbus_array_foreach(iter,
@@ -5606,6 +5609,28 @@ int g_supplicant_set_widi_ies(GSupplicantP2PServiceParams *p2p_service_params,
        return -EINPROGRESS;
 }
 
+#if defined TIZEN_EXT
+int g_supplicant_interface_remove_network(GSupplicantInterface *interface)
+{
+       struct interface_data *data;
+
+       SUPPLICANT_DBG("");
+
+       if (interface == NULL)
+               return -EINVAL;
+
+       if (system_available == FALSE)
+               return -EFAULT;
+
+       data = dbus_malloc0(sizeof(*data));
+       if (data == NULL)
+               return -ENOMEM;
+
+       data->interface = interface;
+
+       return network_remove(data);
+}
+#endif
 
 static const char *g_supplicant_rule0 = "type=signal,"
                                        "path=" DBUS_PATH_DBUS ","
index 4bf4047..499c73e 100755 (executable)
@@ -2673,6 +2673,12 @@ static void interface_state(GSupplicantInterface *interface)
                        DBG("Could not disables selected network");
 
 #if defined TIZEN_EXT
+               int err;
+
+               err = g_supplicant_interface_remove_network(wifi->interface);
+               if (err < 0)
+                       DBG("Failed to remove network(%d)", err);
+
                /* Some of Wi-Fi networks are not comply Wi-Fi specification.
                 * Retry association until its retry count is expired */
                if (handle_wifi_assoc_retry(network, wifi) == true) {
@@ -2684,8 +2690,6 @@ static void interface_state(GSupplicantInterface *interface)
                /* To avoid unnecessary repeated association in wpa_supplicant,
                 * "RemoveNetwork" should be made when Wi-Fi is disconnected */
                if (wps != true && wifi->network && wifi->disconnecting == false) {
-                       int err;
-
                        wifi->disconnecting = true;
                        err = g_supplicant_interface_disconnect(wifi->interface,
                                                        disconnect_callback, wifi->network);