From c9244afbdbed972f2fbcfefc6b19b73acdb91a18 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Tue, 11 Dec 2012 12:30:50 +0100 Subject: [PATCH] client: Do not include headers from the core --- client/data_manager.c | 1 - client/data_manager.h | 2 -- client/dbus.h | 38 ++++++++++++++++++++++++++++++++++++++ client/monitor.c | 1 - client/services.c | 17 +++++++++-------- client/technology.c | 3 ++- 6 files changed, 49 insertions(+), 13 deletions(-) diff --git a/client/data_manager.c b/client/data_manager.c index f11a385d..895397b5 100644 --- a/client/data_manager.c +++ b/client/data_manager.c @@ -33,7 +33,6 @@ #include -#include "src/connman.h" #include "client/services.h" #include "client/technology.h" #include "client/data_manager.h" diff --git a/client/data_manager.h b/client/data_manager.h index 3fb424c6..211eeb39 100644 --- a/client/data_manager.h +++ b/client/data_manager.h @@ -23,8 +23,6 @@ #include #define SIGNAL_LISTEN_TIMEOUT 10 -#define CONNMAN_MANAGER_PATH "/" -#define CONNMAN_SERVICE "net.connman" struct signal_args { DBusConnection *connection; diff --git a/client/dbus.h b/client/dbus.h index 27f7c5a0..3cde017f 100644 --- a/client/dbus.h +++ b/client/dbus.h @@ -22,6 +22,44 @@ #include +#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); +} + diff --git a/client/monitor.c b/client/monitor.c index 9ae32688..ae585be3 100644 --- a/client/monitor.c +++ b/client/monitor.c @@ -38,7 +38,6 @@ #include "client/services.h" #include "client/technology.h" #include "client/data_manager.h" -#include "src/connman.h" #include "gdbus/gdbus.h" static const char *get_service_name(DBusMessage *message, char *dbus_path) diff --git a/client/services.c b/client/services.c index 99b15079..df809114 100644 --- a/client/services.c +++ b/client/services.c @@ -31,8 +31,9 @@ #include #include +#include + #include "client/services.h" -#include "src/connman.h" #include "dbus.h" static void append_property_array(DBusMessageIter *iter, char *property, @@ -43,7 +44,7 @@ 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); @@ -66,9 +67,9 @@ static void append_property_dict(DBusMessageIter *iter, char *property, 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, @@ -103,8 +104,8 @@ static void append_property_dict(DBusMessageIter *iter, char *property, 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) @@ -421,8 +422,8 @@ int set_proxy_manual(DBusConnection *connection, DBusMessage *message, 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); diff --git a/client/technology.c b/client/technology.c index 3211aec8..9f368580 100644 --- a/client/technology.c +++ b/client/technology.c @@ -30,8 +30,9 @@ #include #include +#include + #include "client/technology.h" -#include "src/connman.h" #include "dbus.h" void extract_properties(DBusMessageIter *dict) -- 2.34.1