From: Patrik Flykt <[email protected]>
Notify technology when the first device has started scanning or
when the last device has stopped scanning.
---
src/device.c | 25 +++++++++++++++++++++++++
1 files changed, 25 insertions(+), 0 deletions(-)
diff --git a/src/device.c b/src/device.c
index e191194..4e38edb 100644
--- a/src/device.c
+++ b/src/device.c
@@ -826,6 +826,10 @@ void connman_device_reset_scanning(struct connman_device
*device)
int connman_device_set_scanning(struct connman_device *device,
connman_bool_t scanning)
{
+ int count = 0;
+ enum connman_service_type service_type;
+ GSList *list;
+
DBG("device %p scanning %d", device, scanning);
if (!device->driver || !device->driver->scan)
@@ -835,8 +839,26 @@ int connman_device_set_scanning(struct connman_device
*device,
return -EALREADY;
device->scanning = scanning;
+ service_type = __connman_device_get_service_type(device);
+
+ for (list = device_list; list != NULL; list = list->next) {
+ struct connman_device *other_device = list->data;
+
+ if (device == other_device)
+ continue;
+
+ if (__connman_device_get_service_type(other_device) !=
+ service_type)
+ continue;
+
+ if (__connman_device_scanning(other_device))
+ count += 1;
+ }
if (scanning == TRUE) {
+ if (count == 0)
+ __connman_technology_scan_start(service_type);
+
reset_scan_trigger(device);
g_hash_table_foreach(device->networks,
@@ -847,6 +869,9 @@ int connman_device_set_scanning(struct connman_device
*device,
__connman_device_cleanup_networks(device);
+ if (count == 0)
+ __connman_technology_scan_stop(service_type);
+
__connman_service_auto_connect();
return 0;
--
1.7.2.5
_______________________________________________
connman mailing list
[email protected]
http://lists.connman.net/listinfo/connman