X-Git-Url: https://vcs.maemo.org/git/?a=blobdiff_plain;f=src%2Fdevice.c;h=b4a4b0fd37f81787e92dc1ff808c2adea0555a6b;hb=9b05cebe93ad885ee2a2156f6310eb7da365e581;hp=1bc0d837573cca3154843aa31f2904de1c215777;hpb=9781e0c3e2c8284691c753eb9bf3941823fab46b;p=connman diff --git a/src/device.c b/src/device.c index 1bc0d83..b4a4b0f 100644 --- a/src/device.c +++ b/src/device.c @@ -39,6 +39,7 @@ struct connman_device { char *name; char *node; char *interface; + unsigned int connections; struct connman_device_driver *driver; void *driver_data; @@ -884,6 +885,15 @@ int connman_device_set_powered(struct connman_device *device, g_dbus_send_message(connection, signal); + if (powered == FALSE) + return 0; + + if (device->policy != CONNMAN_DEVICE_POLICY_AUTO) + return 0; + + if (device->driver->scan) + device->driver->scan(device); + return 0; } @@ -932,6 +942,11 @@ int connman_device_set_carrier(struct connman_device *device, return 0; } +static void connect_known_network(struct connman_device *device) +{ + DBG("device %p", device); +} + /** * connman_device_set_scanning: * @device: device structure @@ -972,6 +987,17 @@ int connman_device_set_scanning(struct connman_device *device, g_dbus_send_message(connection, signal); + if (scanning == TRUE) + return 0; + + if (device->connections > 0) + return 0; + + if (device->policy != CONNMAN_DEVICE_POLICY_AUTO) + return 0; + + connect_known_network(device); + return 0; } @@ -1019,6 +1045,16 @@ const char *connman_device_get_string(struct connman_device *device, return NULL; } +void __connman_device_increase_connections(struct connman_device *device) +{ + device->connections++; +} + +void __connman_device_decrease_connections(struct connman_device *device) +{ + device->connections--; +} + /** * connman_device_add_network: * @device: device structure