From 36a56c493664eb4fe74f640e4d01d18131ce0a03 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Thu, 23 Apr 2009 17:04:33 +0100 Subject: [PATCH] Export active profile path and ident information --- src/connman.h | 3 ++- src/manager.c | 2 +- src/profile.c | 25 ++++++++++++++++++------- src/service.c | 2 +- 4 files changed, 22 insertions(+), 10 deletions(-) diff --git a/src/connman.h b/src/connman.h index 4339251..0edade4 100644 --- a/src/connman.h +++ b/src/connman.h @@ -54,7 +54,8 @@ int __connman_profile_init(DBusConnection *conn); void __connman_profile_cleanup(void); void __connman_profile_list(DBusMessageIter *iter); -const char *__connman_profile_active(void); +const char *__connman_profile_active_ident(void); +const char *__connman_profile_active_path(void); void __connman_profile_changed(void); diff --git a/src/manager.c b/src/manager.c index 0a59057..6c079ff 100644 --- a/src/manager.c +++ b/src/manager.c @@ -185,7 +185,7 @@ static DBusMessage *get_properties(DBusConnection *conn, DBUS_TYPE_STRING_AS_STRING DBUS_TYPE_VARIANT_AS_STRING DBUS_DICT_ENTRY_END_CHAR_AS_STRING, &dict); - str = __connman_profile_active(); + str = __connman_profile_active_path(); if (str != NULL) connman_dbus_dict_append_variant(&dict, "ActiveProfile", DBUS_TYPE_OBJECT_PATH, &str); diff --git a/src/profile.c b/src/profile.c index f12bdb8..729c7de 100644 --- a/src/profile.c +++ b/src/profile.c @@ -28,15 +28,22 @@ #include "connman.h" -#define PROFILE_DEFAULT "/profile/default" +#define PROFILE_DEFAULT_IDENT "default" static DBusConnection *connection = NULL; -const char *__connman_profile_active(void) +const char *__connman_profile_active_ident(void) { DBG(""); - return PROFILE_DEFAULT; + return PROFILE_DEFAULT_IDENT; +} + +const char *__connman_profile_active_path(void) +{ + DBG(""); + + return "/profile/" PROFILE_DEFAULT_IDENT; } static void append_services(DBusMessageIter *entry) @@ -60,7 +67,7 @@ static void append_services(DBusMessageIter *entry) void __connman_profile_changed(void) { - const char *path = __connman_profile_active(); + const char *path = __connman_profile_active_path(); DBusMessage *signal; DBusMessageIter entry; @@ -141,7 +148,7 @@ int __connman_profile_remove_network(struct connman_network *network) void __connman_profile_list(DBusMessageIter *iter) { - const char *path = __connman_profile_active(); + const char *path = __connman_profile_active_path(); DBG(""); @@ -193,13 +200,15 @@ static GDBusSignalTable profile_signals[] = { int __connman_profile_init(DBusConnection *conn) { + const char *path = __connman_profile_active_path(); + DBG("conn %p", conn); connection = dbus_connection_ref(conn); if (connection == NULL) return -1; - g_dbus_register_interface(connection, PROFILE_DEFAULT, + g_dbus_register_interface(connection, path, CONNMAN_PROFILE_INTERFACE, profile_methods, profile_signals, NULL, NULL, NULL); @@ -209,9 +218,11 @@ int __connman_profile_init(DBusConnection *conn) void __connman_profile_cleanup(void) { + const char *path = __connman_profile_active_path(); + DBG("conn %p", connection); - g_dbus_unregister_interface(connection, PROFILE_DEFAULT, + g_dbus_unregister_interface(connection, path, CONNMAN_PROFILE_INTERFACE); if (connection == NULL) diff --git a/src/service.c b/src/service.c index 9522294..ec09cc1 100644 --- a/src/service.c +++ b/src/service.c @@ -705,7 +705,7 @@ struct connman_service *connman_service_get(const char *identifier) static int service_register(struct connman_service *service) { - const char *path = __connman_profile_active(); + const char *path = __connman_profile_active_path(); DBG("service %p", service); -- 2.7.4