Add object path for the default profile
authorMarcel Holtmann <marcel@holtmann.org>
Thu, 7 Aug 2008 07:40:27 +0000 (09:40 +0200)
committerMarcel Holtmann <marcel@holtmann.org>
Thu, 7 Aug 2008 07:40:27 +0000 (09:40 +0200)
include/dbus.h
src/connman.h
src/main.c
src/profile.c

index be98a4e..a76aea2 100644 (file)
@@ -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       "/"
 
index 47d44f9..4249f33 100644 (file)
@@ -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>
index 3a5990b..5f8b487 100644 (file)
@@ -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();
index 62d9066..223ea43 100644 (file)
@@ -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);
+}