From 07f49bc02d0a845681452e50b9e3e861ea6d4306 Mon Sep 17 00:00:00 2001 From: Rahul Rahul Date: Wed, 9 Mar 2016 10:23:14 -0800 Subject: [PATCH] dbus: Add API for adding object path value to a dict --- src/dbus.c | 11 +++++++++++ src/dbus.h | 2 ++ 2 files changed, 13 insertions(+) diff --git a/src/dbus.c b/src/dbus.c index 2c42fe18..2f21bef0 100644 --- a/src/dbus.c +++ b/src/dbus.c @@ -59,6 +59,17 @@ void dbus_dict_append_bool(struct l_dbus_message_builder *builder, l_dbus_message_builder_leave_dict(builder); } +void dbus_dict_append_object(struct l_dbus_message_builder *builder, + const char *key, const char *object_path) +{ + l_dbus_message_builder_enter_dict(builder, "sv"); + l_dbus_message_builder_append_basic(builder, 's', key); + l_dbus_message_builder_enter_variant(builder, "o"); + l_dbus_message_builder_append_basic(builder, 'o', object_path); + l_dbus_message_builder_leave_variant(builder); + l_dbus_message_builder_leave_dict(builder); +} + void dbus_dict_append_bytearray(struct l_dbus_message_builder *builder, const char *key, const uint8_t *arrayval, const int len) diff --git a/src/dbus.h b/src/dbus.h index 39ab772f..6627f450 100644 --- a/src/dbus.h +++ b/src/dbus.h @@ -43,6 +43,8 @@ void dbus_dict_append_string(struct l_dbus_message_builder *builder, const char *key, const char *strval); void dbus_dict_append_bool(struct l_dbus_message_builder *builder, const char *key, bool boolval); +void dbus_dict_append_object(struct l_dbus_message_builder *builder, + const char *key, const char *object_path); void dbus_dict_append_bytearray(struct l_dbus_message_builder *builder, const char *key, const uint8_t *arrayval, const int len);