dbus: Add connman_dbus_setting_changed_*()
authorDaniel Wagner <daniel.wagner@bmw-carit.de>
Thu, 31 Mar 2011 08:02:36 +0000 (10:02 +0200)
committerSamuel Ortiz <sameo@linux.intel.com>
Thu, 31 Mar 2011 10:41:05 +0000 (12:41 +0200)
include/dbus.h
src/dbus.c

index 83f3d30..33ddb73 100644 (file)
@@ -75,6 +75,18 @@ dbus_bool_t connman_dbus_property_changed_array(const char *path,
                        const char *interface, const char *key, int type,
                        connman_dbus_append_cb_t function, void *user_data);
 
+dbus_bool_t connman_dbus_setting_changed_basic(const char *owner,
+                               const char *path, const char *key,
+                               int type, void *val);
+dbus_bool_t connman_dbus_setting_changed_dict(const char *owner,
+                               const char *path, const char *key,
+                               connman_dbus_append_cb_t function,
+                               void *user_data);
+dbus_bool_t connman_dbus_setting_changed_array(const char *owner,
+                               const char *path, const char *key, int type,
+                               connman_dbus_append_cb_t function,
+                               void *user_data);
+
 static inline void connman_dbus_dict_open(DBusMessageIter *iter,
                                                        DBusMessageIter *dict)
 {
index 1b3a4be..697a417 100644 (file)
@@ -270,6 +270,92 @@ dbus_bool_t connman_dbus_property_changed_array(const char *path,
        return TRUE;
 }
 
+dbus_bool_t connman_dbus_setting_changed_basic(const char *owner,
+                               const char *path, const char *key,
+                               int type, void *val)
+{
+       DBusMessage *msg;
+       DBusMessageIter array, dict;
+
+       if (owner == NULL || path == NULL)
+               return FALSE;
+
+       msg = dbus_message_new_method_call(owner, path,
+                                               CONNMAN_NOTIFICATION_INTERFACE,
+                                               "Update");
+       if (msg == NULL)
+               return FALSE;
+
+       dbus_message_iter_init_append(msg, &array);
+       connman_dbus_dict_open(&array, &dict);
+
+       connman_dbus_dict_append_basic(&dict, key, type, val);
+
+       connman_dbus_dict_close(&array, &dict);
+
+       g_dbus_send_message(connection, msg);
+
+       return TRUE;
+}
+
+dbus_bool_t connman_dbus_setting_changed_dict(const char *owner,
+                               const char *path, const char *key,
+                               connman_dbus_append_cb_t function,
+                               void *user_data)
+{
+       DBusMessage *msg;
+       DBusMessageIter array, dict;
+
+       if (owner == NULL || path == NULL)
+               return FALSE;
+
+       msg = dbus_message_new_method_call(owner, path,
+                                               CONNMAN_NOTIFICATION_INTERFACE,
+                                               "Update");
+       if (msg == NULL)
+               return FALSE;
+
+       dbus_message_iter_init_append(msg, &array);
+       connman_dbus_dict_open(&array, &dict);
+
+       connman_dbus_dict_append_dict(&dict, key, function, user_data);
+
+       connman_dbus_dict_close(&array, &dict);
+
+       g_dbus_send_message(connection, msg);
+
+       return TRUE;
+}
+
+dbus_bool_t connman_dbus_setting_changed_array(const char *owner,
+                               const char *path, const char *key, int type,
+                               connman_dbus_append_cb_t function,
+                               void *user_data)
+{
+       DBusMessage *msg;
+       DBusMessageIter array, dict;
+
+       if (owner == NULL || path == NULL)
+               return FALSE;
+
+       msg = dbus_message_new_method_call(owner, path,
+                                               CONNMAN_NOTIFICATION_INTERFACE,
+                                               "Update");
+       if (msg == NULL)
+               return FALSE;
+
+       dbus_message_iter_init_append(msg, &array);
+       connman_dbus_dict_open(&array, &dict);
+
+       connman_dbus_dict_append_array(&dict, key, type, function, user_data);
+
+       connman_dbus_dict_close(&array, &dict);
+
+       g_dbus_send_message(connection, msg);
+
+       return TRUE;
+}
+
 DBusConnection *connman_dbus_get_connection(void)
 {
        if (connection == NULL)