From aa549a200ff5b44782935501dc1d0e20de62bd5d Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Thu, 7 Aug 2008 09:21:46 +0200 Subject: [PATCH] Add initial skeleton for profile support --- src/Makefile.am | 4 ++-- src/connman.h | 2 ++ src/manager.c | 26 ++++++++++++++++++++++++++ src/profile.c | 38 ++++++++++++++++++++++++++++++++++++++ 4 files changed, 68 insertions(+), 2 deletions(-) create mode 100644 src/profile.c diff --git a/src/Makefile.am b/src/Makefile.am index a1a7dac..e4ad954 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -11,8 +11,8 @@ DISTCLEANFILES = $(service_DATA) sbin_PROGRAMS = connmand -connmand_SOURCES = main.c connman.h log.c plugin.c element.c \ - storage.c manager.c agent.c +connmand_SOURCES = main.c connman.h log.c plugin.c profile.c element.c \ + storage.c manager.c agent.c connmand_LDADD = @SQLITE_LIBS@ @GDBUS_LIBS@ @GMODULE_LIBS@ @GTHREAD_LIBS@ diff --git a/src/connman.h b/src/connman.h index df1aabb..47d44f9 100644 --- a/src/connman.h +++ b/src/connman.h @@ -39,6 +39,8 @@ void __connman_agent_cleanup(void); int __connman_agent_register(const char *sender, const char *path); int __connman_agent_unregister(const char *sender, const char *path); +void __connman_profile_list(DBusMessageIter *iter); + #include int __connman_log_init(gboolean detach, gboolean debug); diff --git a/src/manager.c b/src/manager.c index 8ba4f02..c4ea0fb 100644 --- a/src/manager.c +++ b/src/manager.c @@ -75,6 +75,30 @@ static DBusMessage *unregister_agent(DBusConnection *conn, return reply; } +static DBusMessage *list_profiles(DBusConnection *conn, + DBusMessage *msg, void *data) +{ + DBusMessage *reply; + DBusMessageIter array, iter; + + DBG("conn %p", conn); + + reply = dbus_message_new_method_return(msg); + if (reply == NULL) + return NULL; + + dbus_message_iter_init_append(reply, &array); + + dbus_message_iter_open_container(&array, DBUS_TYPE_ARRAY, + DBUS_TYPE_OBJECT_PATH_AS_STRING, &iter); + + __connman_profile_list(&iter); + + dbus_message_iter_close_container(&array, &iter); + + return reply; +} + static DBusMessage *list_elements(DBusConnection *conn, DBusMessage *msg, void *data) { @@ -127,6 +151,8 @@ static GDBusMethodTable manager_methods[] = { { "RegisterAgent", "o", "", register_agent }, { "UnregisterAgent", "o", "", unregister_agent }, + { "ListProfiles", "", "ao", list_profiles }, + { "ListElements", "", "ao", list_elements }, { "ListDevices", "", "ao", list_devices }, { }, diff --git a/src/profile.c b/src/profile.c new file mode 100644 index 0000000..62d9066 --- /dev/null +++ b/src/profile.c @@ -0,0 +1,38 @@ +/* + * + * Connection Manager + * + * Copyright (C) 2007-2008 Intel Corporation. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include +#include + +#include "connman.h" + +void __connman_profile_list(DBusMessageIter *iter) +{ + const char *path = "/profile/default"; + + DBG(""); + + dbus_message_iter_append_basic(iter, DBUS_TYPE_OBJECT_PATH, &path); +} -- 2.7.4