[PATCH v2 4/9] notifier: Add technology powered notifier function

patrik.flykt at linux.intel.com patrik.flykt at linux.intel.com
Fri Nov 2 06:15:59 PDT 2012


From: Patrik Flykt <patrik.flykt at linux.intel.com>

---
 include/notifier.h |    2 ++
 src/connman.h      |    2 ++
 src/notifier.c     |   15 +++++++++++++++
 3 files changed, 19 insertions(+)

diff --git a/include/notifier.h b/include/notifier.h
index 4412717..f1d394f 100644
--- a/include/notifier.h
+++ b/include/notifier.h
@@ -55,6 +55,8 @@ struct connman_notifier {
 	void (*ipconfig_changed) (struct connman_service *service,
 					struct connman_ipconfig *ipconfig);
 	void (*idle_state) (connman_bool_t idle);
+	void (*technology_powered) (enum connman_service_type type,
+			connman_bool_t powered);
 };
 
 int connman_notifier_register(struct connman_notifier *notifier);
diff --git a/src/connman.h b/src/connman.h
index efff509..562fe78 100644
--- a/src/connman.h
+++ b/src/connman.h
@@ -735,6 +735,8 @@ void __connman_notifier_service_state_changed(struct connman_service *service,
 void __connman_notifier_ipconfig_changed(struct connman_service *service,
 					struct connman_ipconfig *ipconfig);
 
+void __connman_notifier_notify_powered(enum connman_service_type type,
+		connman_bool_t powered);
 connman_bool_t __connman_notifier_is_connected(void);
 const char *__connman_notifier_get_state(void);
 
diff --git a/src/notifier.c b/src/notifier.c
index ebde689..fb3ce05 100644
--- a/src/notifier.c
+++ b/src/notifier.c
@@ -78,6 +78,21 @@ void connman_notifier_unregister(struct connman_notifier *notifier)
 static int connected[MAX_TECHNOLOGIES];
 static int online[MAX_TECHNOLOGIES];
 
+void __connman_notifier_notify_powered(enum connman_service_type type,
+		connman_bool_t powered)
+{
+	GSList *list;
+
+	DBG("type %d powered %d", type, powered);
+
+	for (list = notifier_list; list; list = list->next) {
+		struct connman_notifier *notifier = list->data;
+
+		if (notifier->technology_powered)
+			notifier->technology_powered(type, powered);
+	}
+}
+
 static connman_bool_t notifier_is_online(void)
 {
 	unsigned int i;
-- 
1.7.10.4




More information about the connman mailing list