diff options
author | Patrik Flykt <patrik.flykt@linux.intel.com> | 2012-01-05 10:14:21 +0200 |
---|---|---|
committer | Daniel Wagner <daniel.wagner@bmw-carit.de> | 2012-01-05 11:11:08 +0100 |
commit | 472da28189443312faabb07bd26e2d8f3c1e9145 (patch) | |
tree | e47fdef5074c5f558aea326ae922339c195e7180 /src | |
parent | b4bd4ecb4de9a13f5094c5e3d07446ae9dfd9b79 (diff) | |
download | connman-472da28189443312faabb07bd26e2d8f3c1e9145.tar.gz connman-472da28189443312faabb07bd26e2d8f3c1e9145.tar.bz2 connman-472da28189443312faabb07bd26e2d8f3c1e9145.zip |
technology: Implement Manager API GetTechnologies method call
Diffstat (limited to 'src')
-rw-r--r-- | src/connman.h | 1 | ||||
-rw-r--r-- | src/manager.c | 32 | ||||
-rw-r--r-- | src/technology.c | 20 |
3 files changed, 53 insertions, 0 deletions
diff --git a/src/connman.h b/src/connman.h index 07e7f819..44da9b07 100644 --- a/src/connman.h +++ b/src/connman.h @@ -310,6 +310,7 @@ void __connman_wispr_stop(struct connman_service *service); #include <connman/technology.h> void __connman_technology_list(DBusMessageIter *iter, void *user_data); +void __connman_technology_list_struct(DBusMessageIter *array); int __connman_technology_add_device(struct connman_device *device); int __connman_technology_remove_device(struct connman_device *device); diff --git a/src/manager.c b/src/manager.c index e821df3c..f2fffa9b 100644 --- a/src/manager.c +++ b/src/manager.c @@ -129,6 +129,37 @@ static DBusMessage *set_property(DBusConnection *conn, return g_dbus_create_reply(msg, DBUS_TYPE_INVALID); } +static DBusMessage *get_technologies(DBusConnection *conn, + DBusMessage *msg, void *data) +{ + DBusMessage *reply; + DBusMessageIter iter, array; + + DBG(""); + + reply = dbus_message_new_method_return(msg); + if (reply == NULL) + return NULL; + + dbus_message_iter_init_append(reply, &iter); + + dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY, + DBUS_STRUCT_BEGIN_CHAR_AS_STRING + DBUS_TYPE_OBJECT_PATH_AS_STRING + 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 + DBUS_STRUCT_END_CHAR_AS_STRING, &array); + + __connman_technology_list_struct(&array); + + dbus_message_iter_close_container(&iter, &array); + + return reply; +} + static DBusMessage *remove_provider(DBusConnection *conn, DBusMessage *msg, void *data) { @@ -491,6 +522,7 @@ static GDBusMethodTable manager_methods[] = { { "GetProperties", "", "a{sv}", get_properties }, { "SetProperty", "sv", "", set_property, G_DBUS_METHOD_FLAG_ASYNC }, + { "GetTechnologies", "", "a(oa{sv})", get_technologies }, { "RemoveProvider", "o", "", remove_provider }, { "RequestScan", "s", "", request_scan }, { "EnableTechnology", "s", "", enable_technology, diff --git a/src/technology.c b/src/technology.c index 100d138e..2eac7490 100644 --- a/src/technology.c +++ b/src/technology.c @@ -505,6 +505,26 @@ static DBusMessage *get_properties(DBusConnection *conn, return reply; } +void __connman_technology_list_struct(DBusMessageIter *array) +{ + GSList *list; + DBusMessageIter entry; + + for (list = technology_list; list; list = list->next) { + struct connman_technology *technology = list->data; + + if (technology->path == NULL) + continue; + + dbus_message_iter_open_container(array, DBUS_TYPE_STRUCT, + NULL, &entry); + dbus_message_iter_append_basic(&entry, DBUS_TYPE_OBJECT_PATH, + &technology->path); + append_properties(&entry, technology); + dbus_message_iter_close_container(array, &entry); + } +} + static DBusMessage *set_property(DBusConnection *conn, DBusMessage *msg, void *data) { |