From f3ce64de7eb5cffd32dafe6388b8425a5bec137a Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Thu, 7 Aug 2008 09:40:27 +0200 Subject: Add object path for the default profile --- include/dbus.h | 2 ++ src/connman.h | 3 +++ src/main.c | 4 ++++ src/profile.c | 35 +++++++++++++++++++++++++++++++++++ 4 files changed, 44 insertions(+) diff --git a/include/dbus.h b/include/dbus.h index be98a4ef..a76aea24 100644 --- a/include/dbus.h +++ b/include/dbus.h @@ -36,6 +36,8 @@ extern "C" { #define CONNMAN_ELEMENT_INTERFACE CONNMAN_SERVICE ".Element" +#define CONNMAN_PROFILE_INTERFACE CONNMAN_SERVICE ".Profile" + #define CONNMAN_MANAGER_INTERFACE CONNMAN_SERVICE ".Manager" #define CONNMAN_MANAGER_PATH "/" diff --git a/src/connman.h b/src/connman.h index 47d44f93..4249f33f 100644 --- a/src/connman.h +++ b/src/connman.h @@ -39,6 +39,9 @@ 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); +int __connman_profile_init(DBusConnection *conn); +void __connman_profile_cleanup(void); + void __connman_profile_list(DBusMessageIter *iter); #include diff --git a/src/main.c b/src/main.c index 3a5990b5..5f8b4876 100644 --- a/src/main.c +++ b/src/main.c @@ -144,6 +144,8 @@ int main(int argc, char *argv[]) __connman_manager_init(conn, option_compat); + __connman_profile_init(conn); + __connman_plugin_init(); g_free(option_device); @@ -159,6 +161,8 @@ int main(int argc, char *argv[]) __connman_element_cleanup(); + __connman_profile_cleanup(); + __connman_manager_cleanup(); __connman_storage_cleanup(); diff --git a/src/profile.c b/src/profile.c index 62d90668..223ea434 100644 --- a/src/profile.c +++ b/src/profile.c @@ -36,3 +36,38 @@ void __connman_profile_list(DBusMessageIter *iter) dbus_message_iter_append_basic(iter, DBUS_TYPE_OBJECT_PATH, &path); } + +static GDBusMethodTable profile_methods[] = { + { }, +}; + +static DBusConnection *connection = NULL; + +int __connman_profile_init(DBusConnection *conn) +{ + DBG("conn %p", conn); + + connection = dbus_connection_ref(conn); + if (connection == NULL) + return -1; + + g_dbus_register_interface(connection, "/profile/default", + CONNMAN_PROFILE_INTERFACE, + profile_methods, + NULL, NULL, NULL, NULL); + + return 0; +} + +void __connman_profile_cleanup(void) +{ + DBG("conn %p", connection); + + g_dbus_unregister_interface(connection, "/profile/default", + CONNMAN_PROFILE_INTERFACE); + + if (connection == NULL) + return; + + dbus_connection_unref(connection); +} -- cgit v1.2.3