Skip to contentSkip to conversation

Add reply / signal utilities to g_dbus_util

PATCH New Denis Kenzior 1 participant 1 message Feb 10, 2010 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 2/8 Add reply / signal utilities to g_dbus_util

Connman/BlueZ/oFono share the same API structure and thus share the same basic code to build GetProperties() replies and PropertyChanged signal emissions. These utilities are duplicated across projects.

This patch adds the three most commonly used utilities for building the GetProperties dictionaries and PropertyChanged signal emissions.

---
 Makefile.am   |    3 +-
 gdbus/gdbus.h |   31 ++++++++
 gdbus/util.c  |  226 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 259 insertions(+), 1 deletions(-)
 create mode 100644 gdbus/util.c
Makefile.am +2 -1
index 7cd2194..13c7452 100644
@@ -39,7 +39,8 @@ builtin_sources =
 builtin_libadd =
 builtin_cflags =
 
-gdbus_sources = gdbus/gdbus.h gdbus/mainloop.c gdbus/object.c gdbus/watch.c
+gdbus_sources = gdbus/gdbus.h gdbus/mainloop.c gdbus/object.c gdbus/watch.c \
+		gdbus/util.c
 
 gisi_sources = gisi/phonet.h gisi/modem.h gisi/netlink.h gisi/netlink.c \
 		gisi/socket.h gisi/socket.c gisi/client.h gisi/client.c \
gdbus/gdbus.h +31 -0
index 77b8aee..941f924 100644
@@ -135,6 +135,37 @@ guint g_dbus_add_signal_watch(DBusConnection *connection,
 gboolean g_dbus_remove_watch(DBusConnection *connection, guint tag);
 void g_dbus_remove_all_watches(DBusConnection *connection);
 
+gboolean g_dbus_properties_dict_append(DBusMessageIter *dict,
+					const char *key,
+					int type, void *value);
+
+gboolean g_dbus_properties_dict_append_string_array(DBusMessageIter *dict,
+				const char *key, int type, char **val);
+
+gboolean g_dbus_properties_dict_append_fixed_array(DBusMessageIter *dict,
+							const char *key,
+							int type, void *val,
+							int len);
+
+gboolean g_dbus_emit_property_changed(DBusConnection *conn,
+					const char *path,
+					const char *interface,
+					const char *name,
+					int type, void *value);
+
+gboolean g_dbus_emit_string_array_property_changed(DBusConnection *conn,
+							const char *path,
+							const char *interface,
+							const char *name,
+							int type,
+							char **values);
+
+gboolean g_dbus_emit_fixed_array_property_changed(DBusConnection *conn,
+							const char *path,
+							const char *interface,
+							const char *name,
+							int type, void *value,
+							int len);
 #ifdef __cplusplus
 }
 #endif
gdbus/util.c new file +226 -0

226 lines not on this page · raw message

Signature · 1 line
1.6.4.4