Add helper for sending PropertyChanged signal
authorMarcel Holtmann <marcel@holtmann.org>
Sat, 19 Dec 2009 20:19:08 +0000 (12:19 -0800)
committerMarcel Holtmann <marcel@holtmann.org>
Sat, 19 Dec 2009 20:19:08 +0000 (12:19 -0800)
include/dbus.h
src/dbus.c

index 3757fef..d8a1854 100644 (file)
@@ -55,6 +55,10 @@ void connman_dbus_property_append_fixed_array(DBusMessageIter *iter,
 void connman_dbus_property_append_variable_array(DBusMessageIter *dict,
                const char *key, int type, connman_dbus_append_cb_t function);
 
+dbus_bool_t connman_dbus_property_changed_basic(const char *path,
+                               const char *interface, const char *key,
+                                                       int type, void *val);
+
 static inline void connman_dbus_dict_open(DBusMessageIter *iter,
                                                        DBusMessageIter *dict)
 {
index 7308a49..d67b0f8 100644 (file)
@@ -24,7 +24,7 @@
 #endif
 
 #include <string.h>
-#include <dbus/dbus.h>
+#include <gdbus.h>
 
 #include "connman.h"
 
@@ -181,6 +181,28 @@ void connman_dbus_property_append_variable_array(DBusMessageIter *iter,
 
 static DBusConnection *connection = NULL;
 
+dbus_bool_t connman_dbus_property_changed_basic(const char *path,
+                               const char *interface, const char *key,
+                                                       int type, void *val)
+{
+       DBusMessage *signal;
+       DBusMessageIter iter;
+
+       if (path == NULL)
+               return FALSE;
+
+       signal = dbus_message_new_signal(path, interface, "PropertyChanged");
+       if (signal == NULL)
+               return FALSE;
+
+       dbus_message_iter_init_append(signal, &iter);
+       connman_dbus_property_append_variant(&iter, key, type, val);
+
+       g_dbus_send_message(connection, signal);
+
+       return TRUE;
+}
+
 DBusConnection *connman_dbus_get_connection(void)
 {
        if (connection == NULL)