diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2008-08-07 09:40:27 +0200 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2008-08-07 09:40:27 +0200 |
commit | f3ce64de7eb5cffd32dafe6388b8425a5bec137a (patch) | |
tree | 2be4a176a0d01508a12842f625ce712932d9cafe | |
parent | efadc037b1fd86443fdff951214eb3b57a14c879 (diff) | |
download | connman-f3ce64de7eb5cffd32dafe6388b8425a5bec137a.tar.gz connman-f3ce64de7eb5cffd32dafe6388b8425a5bec137a.tar.bz2 connman-f3ce64de7eb5cffd32dafe6388b8425a5bec137a.zip |
Add object path for the default profile
-rw-r--r-- | include/dbus.h | 2 | ||||
-rw-r--r-- | src/connman.h | 3 | ||||
-rw-r--r-- | src/main.c | 4 | ||||
-rw-r--r-- | src/profile.c | 35 |
4 files changed, 44 insertions, 0 deletions
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 <connman/log.h> @@ -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); +} |