summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2009-03-11 21:26:41 +0100
committerMarcel Holtmann <marcel@holtmann.org>2009-03-11 21:26:41 +0100
commit87d190b3060eac7409f9c893e0a69ace65081f54 (patch)
tree92f43aa94d647192690209172b2dc5aef413cf4f
parenta8764dd1a3bb5f33f7c12260d61603d724c42fc4 (diff)
downloadconnman-87d190b3060eac7409f9c893e0a69ace65081f54.tar.gz
connman-87d190b3060eac7409f9c893e0a69ace65081f54.tar.bz2
connman-87d190b3060eac7409f9c893e0a69ace65081f54.zip
Hook up device type and offline mode notifications
-rw-r--r--src/connman.h4
-rw-r--r--src/device.c20
-rw-r--r--src/notifier.c15
3 files changed, 33 insertions, 6 deletions
diff --git a/src/connman.h b/src/connman.h
index e9d72ae9..128c084c 100644
--- a/src/connman.h
+++ b/src/connman.h
@@ -204,6 +204,10 @@ int __connman_profile_remove_network(struct connman_network *network);
int __connman_notifier_init(void);
void __connman_notifier_cleanup(void);
+void __connman_notifier_device_type_increase(enum connman_device_type type);
+void __connman_notifier_device_type_decrease(enum connman_device_type type);
+void __connman_notifier_offline_mode(connman_bool_t enabled);
+
#include <connman/rtnl.h>
int __connman_rtnl_init(void);
diff --git a/src/device.c b/src/device.c
index a07726a9..30940385 100644
--- a/src/device.c
+++ b/src/device.c
@@ -169,16 +169,18 @@ static int set_powered(struct connman_device *device, connman_bool_t powered)
return -EINVAL;
if (powered == TRUE) {
- if (driver->enable)
+ if (driver->enable) {
err = driver->enable(device);
- else
+ __connman_notifier_device_type_increase(device->type);
+ } else
err = -EINVAL;
} else {
g_hash_table_remove_all(device->networks);
- if (driver->disable)
+ if (driver->disable) {
err = driver->disable(device);
- else
+ __connman_notifier_device_type_decrease(device->type);
+ } else
err = -EINVAL;
}
@@ -615,8 +617,10 @@ static void device_enable(struct connman_device *device)
if (device->powered == TRUE)
return;
- if (device->driver->enable)
+ if (device->driver->enable) {
device->driver->enable(device);
+ __connman_notifier_device_type_increase(device->type);
+ }
}
static void device_disable(struct connman_device *device)
@@ -631,8 +635,10 @@ static void device_disable(struct connman_device *device)
g_hash_table_remove_all(device->networks);
- if (device->driver->disable)
+ if (device->driver->disable) {
device->driver->disable(device);
+ __connman_notifier_device_type_decrease(device->type);
+ }
}
static int setup_device(struct connman_device *device)
@@ -1429,6 +1435,8 @@ int __connman_device_set_offlinemode(connman_bool_t offlinemode)
__connman_element_foreach(NULL, CONNMAN_ELEMENT_TYPE_DEVICE,
set_offlinemode, GUINT_TO_POINTER(offlinemode));
+ __connman_notifier_offline_mode(offlinemode);
+
return 0;
}
diff --git a/src/notifier.c b/src/notifier.c
index e2dcff80..c23a5702 100644
--- a/src/notifier.c
+++ b/src/notifier.c
@@ -66,6 +66,21 @@ void connman_notifier_unregister(struct connman_notifier *notifier)
notifier_list = g_slist_remove(notifier_list, notifier);
}
+void __connman_notifier_device_type_increase(enum connman_device_type type)
+{
+ DBG("type %d", type);
+}
+
+void __connman_notifier_device_type_decrease(enum connman_device_type type)
+{
+ DBG("type %d", type);
+}
+
+void __connman_notifier_offline_mode(connman_bool_t enabled)
+{
+ DBG("enabled %d", enabled);
+}
+
int __connman_notifier_init(void)
{
DBG("");