#include <dbus/dbus.h>
+#define CONNMAN_SERVICE "net.connman"
+
+#define CONNMAN_MANAGER_INTERFACE CONNMAN_SERVICE ".Manager"
+#define CONNMAN_MANAGER_PATH "/"
+
+#define CONNMAN_SERVICE_INTERFACE CONNMAN_SERVICE ".Service"
+
void dbus_property_append_basic(DBusMessageIter *iter,
const char *key, int type, void *val);
+static inline void dbus_dict_open(DBusMessageIter *iter, DBusMessageIter *dict)
+{
+ dbus_message_iter_open_container(iter, DBUS_TYPE_ARRAY,
+ DBUS_DICT_ENTRY_BEGIN_CHAR_AS_STRING
+ DBUS_TYPE_STRING_AS_STRING DBUS_TYPE_VARIANT_AS_STRING
+ DBUS_DICT_ENTRY_END_CHAR_AS_STRING, dict);
+}
+
+static inline void dbus_dict_open_variant(DBusMessageIter *iter,
+ DBusMessageIter *dict)
+{
+ dbus_message_iter_open_container(iter, DBUS_TYPE_VARIANT,
+ DBUS_TYPE_ARRAY_AS_STRING
+ DBUS_DICT_ENTRY_BEGIN_CHAR_AS_STRING
+ DBUS_TYPE_STRING_AS_STRING DBUS_TYPE_VARIANT_AS_STRING
+ DBUS_DICT_ENTRY_END_CHAR_AS_STRING, dict);
+}
+
+static inline void dbus_array_open(DBusMessageIter *iter, DBusMessageIter *dict)
+{
+ dbus_message_iter_open_container(iter, DBUS_TYPE_VARIANT,
+ DBUS_TYPE_ARRAY_AS_STRING
+ DBUS_TYPE_STRING_AS_STRING,
+ dict);
+}
+
+static inline void dbus_dict_close(DBusMessageIter *iter, DBusMessageIter *dict)
+{
+ dbus_message_iter_close_container(iter, dict);
+}
+
#include <unistd.h>
#include <errno.h>
+#include <glib.h>
+
#include "client/services.h"
-#include "src/connman.h"
#include "dbus.h"
static void append_property_array(DBusMessageIter *iter, char *property,
dbus_message_iter_append_basic(iter, DBUS_TYPE_STRING, &property);
- connman_dbus_array_open(iter, &value);
+ dbus_array_open(iter, &value);
dbus_message_iter_open_container(&value, DBUS_TYPE_ARRAY,
DBUS_TYPE_STRING_AS_STRING, &array);
dbus_message_iter_append_basic(iter, DBUS_TYPE_STRING, &property);
/* Top most level is a{sv} */
- connman_dbus_dict_open_variant(iter, &value);
+ dbus_dict_open_variant(iter, &value);
- connman_dbus_dict_open(&value, &dict);
+ dbus_dict_open(&value, &dict);
for (i = 0; i < num_args; i++) {
dbus_message_iter_open_container(&dict, DBUS_TYPE_DICT_ENTRY,
dbus_message_iter_close_container(&dict, &entry);
}
/* Close {sv}, then close a{sv} */
- connman_dbus_dict_close(&value, &dict);
- connman_dbus_dict_close(iter, &value);
+ dbus_dict_close(&value, &dict);
+ dbus_dict_close(iter, &value);
}
void iterate_array(DBusMessageIter *iter)
dbus_message_iter_init_append(message_send, &iter);
dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &property);
- connman_dbus_dict_open_variant(&iter, &value);
- connman_dbus_dict_open(&value, &dict);
+ dbus_dict_open_variant(&iter, &value);
+ dbus_dict_open(&value, &dict);
dbus_message_iter_open_container(&dict, DBUS_TYPE_DICT_ENTRY, NULL,
&entry);
dbus_message_iter_append_basic(&entry, DBUS_TYPE_STRING, &method);