Fix notification to use service types instead of device types
[platform/upstream/connman.git] / src / notifier.c
index 3ae9a0c..2403e91 100644 (file)
@@ -176,7 +176,7 @@ static void technology_registered(enum connman_service_type type,
        g_dbus_send_message(connection, signal);
 }
 
-static void technology_enabled(enum connman_device_type type,
+static void technology_enabled(enum connman_service_type type,
                                                connman_bool_t enabled)
 {
        GSList *list;
@@ -212,8 +212,8 @@ done:
        for (list = notifier_list; list; list = list->next) {
                struct connman_notifier *notifier = list->data;
 
-               if (notifier->device_enabled)
-                       notifier->device_enabled(type, enabled);
+               if (notifier->service_enabled)
+                       notifier->service_enabled(type, enabled);
        }
 }
 
@@ -363,7 +363,32 @@ void __connman_notifier_disconnect(enum connman_service_type type)
                technology_connected(type, FALSE);
 }
 
-void __connman_notifier_offline_mode(connman_bool_t enabled)
+static void offlinemode_changed(dbus_bool_t enabled)
+{
+       DBusMessage *signal;
+       DBusMessageIter entry, value;
+       const char *key = "OfflineMode";
+
+       DBG("enabled %d", enabled);
+
+       signal = dbus_message_new_signal(CONNMAN_MANAGER_PATH,
+                               CONNMAN_MANAGER_INTERFACE, "PropertyChanged");
+       if (signal == NULL)
+               return;
+
+       dbus_message_iter_init_append(signal, &entry);
+
+       dbus_message_iter_append_basic(&entry, DBUS_TYPE_STRING, &key);
+
+       dbus_message_iter_open_container(&entry, DBUS_TYPE_VARIANT,
+                                       DBUS_TYPE_BOOLEAN_AS_STRING, &value);
+       dbus_message_iter_append_basic(&value, DBUS_TYPE_BOOLEAN, &enabled);
+       dbus_message_iter_close_container(&entry, &value);
+
+       g_dbus_send_message(connection, signal);
+}
+
+void __connman_notifier_offlinemode(connman_bool_t enabled)
 {
        GSList *list;
 
@@ -371,6 +396,8 @@ void __connman_notifier_offline_mode(connman_bool_t enabled)
 
        __connman_profile_changed(FALSE);
 
+       offlinemode_changed(enabled);
+
        for (list = notifier_list; list; list = list->next) {
                struct connman_notifier *notifier = list->data;