Add function connman_device_cleanup_scanning()
authorMartin Xu <martin.xu@intel.com>
Tue, 22 Sep 2009 02:32:26 +0000 (10:32 +0800)
committerMarcel Holtmann <marcel@holtmann.org>
Tue, 22 Sep 2009 18:22:27 +0000 (11:22 -0700)
include/device.h
src/device.c

index 5da48bc..f1c12b1 100644 (file)
@@ -89,6 +89,8 @@ int connman_device_set_carrier(struct connman_device *device,
                                                connman_bool_t carrier);
 int connman_device_set_scanning(struct connman_device *device,
                                                connman_bool_t scanning);
+void connman_device_cleanup_scanning(struct connman_device *device);
+
 int connman_device_set_disconnected(struct connman_device *device,
                                                connman_bool_t disconnected);
 connman_bool_t connman_device_get_disconnected(struct connman_device *device);
index 2427c68..119255f 100644 (file)
@@ -1466,6 +1466,24 @@ static void scanning_changed(struct connman_device *device)
        g_dbus_send_message(connection, signal);
 }
 
+static void mark_network_available(gpointer key, gpointer value,
+                                               gpointer user_data)
+{
+       struct connman_network *network = value;
+
+       connman_network_set_available(network, TRUE);
+}
+
+void connman_device_cleanup_scanning(struct connman_device *device)
+{
+       device->scanning = FALSE;
+
+       scanning_changed(device);
+
+       g_hash_table_foreach(device->networks,
+                               mark_network_available, NULL);
+}
+
 /**
  * connman_device_set_scanning:
  * @device: device structure