Don't load last used network from configuration
[connman] / src / profile.c
index 62d9066..d1aea70 100644 (file)
@@ -2,7 +2,7 @@
  *
  *  Connection Manager
  *
- *  Copyright (C) 2007-2008  Intel Corporation. All rights reserved.
+ *  Copyright (C) 2007-2009  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
 
 #include "connman.h"
 
+int __connman_profile_add_device(struct connman_device *device)
+{
+       DBG("device %p", device);
+
+       return 0;
+}
+
+int __connman_profile_remove_device(struct connman_device *device)
+{
+       DBG("device %p", device);
+
+       return 0;
+}
+
+int __connman_profile_add_network(struct connman_network *network)
+{
+       DBG("network %p", network);
+
+       return 0;
+}
+
+int __connman_profile_remove_network(struct connman_network *network)
+{
+       DBG("network %p", network);
+
+       return 0;
+}
+
+const char *__connman_profile_active(void)
+{
+       DBG("");
+
+       return "/profile/default";
+}
+
 void __connman_profile_list(DBusMessageIter *iter)
 {
-       const char *path = "/profile/default";
+       const char *path = __connman_profile_active();
 
        DBG("");
 
        dbus_message_iter_append_basic(iter, DBUS_TYPE_OBJECT_PATH, &path);
 }
+
+void __connman_profile_list_services(DBusMessageIter *iter)
+{
+       DBG("");
+}
+
+static DBusMessage *get_properties(DBusConnection *conn,
+                                       DBusMessage *msg, void *data)
+{
+       const char *name = "Default";
+       DBusMessage *reply;
+       DBusMessageIter array, dict;
+
+       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_DICT_ENTRY_BEGIN_CHAR_AS_STRING
+                       DBUS_TYPE_STRING_AS_STRING DBUS_TYPE_VARIANT_AS_STRING
+                       DBUS_DICT_ENTRY_END_CHAR_AS_STRING, &dict);
+
+       connman_dbus_dict_append_variant(&dict, "Name",
+                                               DBUS_TYPE_STRING, &name);
+
+       dbus_message_iter_close_container(&array, &dict);
+
+       return reply;
+}
+
+static GDBusMethodTable profile_methods[] = {
+       { "GetProperties", "", "a{sv}", get_properties },
+       { },
+};
+
+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);
+}