[PATCH 5/7] service: Set up technology powered notifier

patrik.flykt at linux.intel.com patrik.flykt at linux.intel.com
Fri Nov 2 01:33:36 PDT 2012


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

---
 src/service.c |   14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/src/service.c b/src/service.c
index 2ba34b8..326e4a2 100644
--- a/src/service.c
+++ b/src/service.c
@@ -3417,6 +3417,13 @@ void __connman_service_filter_types(connman_bool_t add, GSList *list)
 	update_session_filter();
 }
 
+static void session_technology_powered(enum connman_service_type type,
+		connman_bool_t powered)
+{
+	__sync_synchronize();
+	session_users[type].powered = powered;
+
+	update_session_filter();
 }
 
 struct preferred_tech_data {
@@ -6763,6 +6770,8 @@ static void remove_unprovisioned_services()
 	g_strfreev(services);
 }
 
+static struct connman_notifier notifier;
+
 int __connman_service_init(void)
 {
 	DBG("");
@@ -6779,6 +6788,9 @@ int __connman_service_init(void)
 			g_str_equal, g_free, NULL);
 	services_notify->add = g_hash_table_new(g_str_hash, g_str_equal);
 
+	notifier.technology_powered = session_technology_powered;
+	connman_notifier_register(&notifier);
+
 	remove_unprovisioned_services();
 
 	return 0;
@@ -6795,6 +6807,8 @@ void __connman_service_cleanup(void)
 		autoconnect_timeout = 0;
 	}
 
+	connman_notifier_unregister(&notifier);
+
 	list = service_list;
 	service_list = NULL;
 	g_sequence_free(list);
-- 
1.7.10.4




More information about the connman mailing list