X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fmanager.c;h=1bf9189cc3bf59656e70eb1081d3f13eee0fdba1;hb=46d7e52dcabccff5e010a6aa7232fbbfea1abecb;hp=6561a78cbada929e992cf9c283fe9627f31fba37;hpb=3e6995b377ef331e8e15267f6be357e7a958203a;p=framework%2Fconnectivity%2Fconnman.git diff --git a/src/manager.c b/src/manager.c index 6561a78..1bf9189 100644 --- a/src/manager.c +++ b/src/manager.c @@ -2,7 +2,7 @@ * * Connection Manager * - * Copyright (C) 2007-2010 Intel Corporation. All rights reserved. + * Copyright (C) 2007-2012 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 @@ -23,24 +23,25 @@ #include #endif +#include + #include #include "connman.h" +static connman_bool_t connman_state_idle; +static DBusMessage *session_mode_pending = NULL; + static DBusMessage *get_properties(DBusConnection *conn, DBusMessage *msg, void *data) { DBusMessage *reply; DBusMessageIter array, dict; - connman_bool_t offlinemode; + connman_bool_t offlinemode, sessionmode; const char *str; DBG("conn %p", conn); - if (__connman_security_check_privilege(msg, - CONNMAN_SECURITY_PRIVILEGE_PUBLIC) < 0) - return __connman_error_permission_denied(msg); - reply = dbus_message_new_method_return(msg); if (reply == NULL) return NULL; @@ -49,44 +50,18 @@ static DBusMessage *get_properties(DBusConnection *conn, connman_dbus_dict_open(&array, &dict); - str = __connman_profile_active_path(); - if (str != NULL) - connman_dbus_dict_append_basic(&dict, "ActiveProfile", - DBUS_TYPE_OBJECT_PATH, &str); - - connman_dbus_dict_append_array(&dict, "Profiles", - DBUS_TYPE_OBJECT_PATH, __connman_profile_list, NULL); - connman_dbus_dict_append_array(&dict, "Services", - DBUS_TYPE_OBJECT_PATH, __connman_service_list, NULL); - connman_dbus_dict_append_array(&dict, "Providers", - DBUS_TYPE_OBJECT_PATH, __connman_provider_list, NULL); - connman_dbus_dict_append_array(&dict, "Technologies", - DBUS_TYPE_OBJECT_PATH, __connman_technology_list, NULL); - str = __connman_notifier_get_state(); connman_dbus_dict_append_basic(&dict, "State", DBUS_TYPE_STRING, &str); - offlinemode = __connman_profile_get_offlinemode(); + offlinemode = __connman_technology_get_offlinemode(); connman_dbus_dict_append_basic(&dict, "OfflineMode", DBUS_TYPE_BOOLEAN, &offlinemode); - connman_dbus_dict_append_array(&dict, "AvailableTechnologies", - DBUS_TYPE_STRING, __connman_notifier_list_registered, NULL); - connman_dbus_dict_append_array(&dict, "EnabledTechnologies", - DBUS_TYPE_STRING, __connman_notifier_list_enabled, NULL); - connman_dbus_dict_append_array(&dict, "ConnectedTechnologies", - DBUS_TYPE_STRING, __connman_notifier_list_connected, NULL); - - str = __connman_service_default(); - if (str != NULL) - connman_dbus_dict_append_basic(&dict, "DefaultTechnology", - DBUS_TYPE_STRING, &str); - - connman_dbus_dict_append_array(&dict, "AvailableDebugs", - DBUS_TYPE_STRING, __connman_debug_list_available, NULL); - connman_dbus_dict_append_array(&dict, "EnabledDebugs", - DBUS_TYPE_STRING, __connman_debug_list_enabled, NULL); + sessionmode = __connman_session_mode(); + connman_dbus_dict_append_basic(&dict, "SessionMode", + DBUS_TYPE_BOOLEAN, + &sessionmode); connman_dbus_dict_close(&array, &dict); @@ -105,13 +80,16 @@ static DBusMessage *set_property(DBusConnection *conn, if (dbus_message_iter_init(msg, &iter) == FALSE) return __connman_error_invalid_arguments(msg); + if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_STRING) + return __connman_error_invalid_arguments(msg); + dbus_message_iter_get_basic(&iter, &name); dbus_message_iter_next(&iter); - dbus_message_iter_recurse(&iter, &value); - if (__connman_security_check_privilege(msg, - CONNMAN_SECURITY_PRIVILEGE_MODIFY) < 0) - return __connman_error_permission_denied(msg); + if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_VARIANT) + return __connman_error_invalid_arguments(msg); + + dbus_message_iter_recurse(&iter, &value); type = dbus_message_iter_get_arg_type(&value); @@ -123,81 +101,51 @@ static DBusMessage *set_property(DBusConnection *conn, dbus_message_iter_get_basic(&value, &offlinemode); - __connman_profile_set_offlinemode(offlinemode); + __connman_technology_set_offlinemode(offlinemode); + } else if (g_str_equal(name, "SessionMode") == TRUE) { + connman_bool_t sessionmode; - __connman_profile_save_default(); - } else if (g_str_equal(name, "ActiveProfile") == TRUE) { - const char *str; + if (type != DBUS_TYPE_BOOLEAN) + return __connman_error_invalid_arguments(msg); - dbus_message_iter_get_basic(&value, &str); + dbus_message_iter_get_basic(&value, &sessionmode); - return __connman_error_not_supported(msg); - } else - return __connman_error_invalid_property(msg); + if (session_mode_pending != NULL) + return __connman_error_in_progress(msg); - return g_dbus_create_reply(msg, DBUS_TYPE_INVALID); -} + __connman_session_set_mode(sessionmode); -static DBusMessage *get_state(DBusConnection *conn, - DBusMessage *msg, void *data) -{ - const char *str; - - DBG("conn %p", conn); - - if (__connman_security_check_privilege(msg, - CONNMAN_SECURITY_PRIVILEGE_PUBLIC) < 0) - return __connman_error_permission_denied(msg); + if (sessionmode == TRUE && connman_state_idle == FALSE) { + session_mode_pending = msg; + return NULL; + } - str = __connman_notifier_get_state(); + } else + return __connman_error_invalid_property(msg); - return g_dbus_create_reply(msg, DBUS_TYPE_STRING, &str, - DBUS_TYPE_INVALID); + return g_dbus_create_reply(msg, DBUS_TYPE_INVALID); } -static DBusMessage *create_profile(DBusConnection *conn, - DBusMessage *msg, void *data) +static void append_technology_structs(DBusMessageIter *iter, void *user_data) { - const char *name, *path; - int err; - - DBG("conn %p", conn); - - dbus_message_get_args(msg, NULL, DBUS_TYPE_STRING, &name, - DBUS_TYPE_INVALID); - - if (__connman_security_check_privilege(msg, - CONNMAN_SECURITY_PRIVILEGE_MODIFY) < 0) - return __connman_error_permission_denied(msg); - - err = __connman_profile_create(name, &path); - if (err < 0) - return __connman_error_failed(msg, -err); - - return g_dbus_create_reply(msg, DBUS_TYPE_OBJECT_PATH, &path, - DBUS_TYPE_INVALID); + __connman_technology_list_struct(iter); } -static DBusMessage *remove_profile(DBusConnection *conn, - DBusMessage *msg, void *data) +static DBusMessage *get_technologies(DBusConnection *conn, + DBusMessage *msg, void *data) { - const char *path; - int err; - - DBG("conn %p", conn); + DBusMessage *reply; - dbus_message_get_args(msg, NULL, DBUS_TYPE_OBJECT_PATH, &path, - DBUS_TYPE_INVALID); + DBG(""); - if (__connman_security_check_privilege(msg, - CONNMAN_SECURITY_PRIVILEGE_MODIFY) < 0) - return __connman_error_permission_denied(msg); + reply = dbus_message_new_method_return(msg); + if (reply == NULL) + return NULL; - err = __connman_profile_remove(path); - if (err < 0) - return __connman_error_failed(msg, -err); + __connman_dbus_append_objpath_dict_array(reply, + append_technology_structs, NULL); - return g_dbus_create_reply(msg, DBUS_TYPE_INVALID); + return reply; } static DBusMessage *remove_provider(DBusConnection *conn, @@ -208,12 +156,8 @@ static DBusMessage *remove_provider(DBusConnection *conn, DBG("conn %p", conn); - dbus_message_get_args(msg, NULL, DBUS_TYPE_STRING, &path, - DBUS_TYPE_INVALID); - - if (__connman_security_check_privilege(msg, - CONNMAN_SECURITY_PRIVILEGE_MODIFY) < 0) - return __connman_error_permission_denied(msg); + dbus_message_get_args(msg, NULL, DBUS_TYPE_OBJECT_PATH, &path, + DBUS_TYPE_INVALID); err = __connman_provider_remove(path); if (err < 0) @@ -222,233 +166,72 @@ static DBusMessage *remove_provider(DBusConnection *conn, return g_dbus_create_reply(msg, DBUS_TYPE_INVALID); } -static DBusMessage *request_scan(DBusConnection *conn, - DBusMessage *msg, void *data) -{ - enum connman_service_type type; - const char *str; - int err; - - DBG("conn %p", conn); - - dbus_message_get_args(msg, NULL, DBUS_TYPE_STRING, &str, - DBUS_TYPE_INVALID); - - if (g_strcmp0(str, "") == 0) - type = CONNMAN_SERVICE_TYPE_UNKNOWN; - else if (g_strcmp0(str, "wifi") == 0) - type = CONNMAN_SERVICE_TYPE_WIFI; - else if (g_strcmp0(str, "wimax") == 0) - type = CONNMAN_SERVICE_TYPE_WIMAX; - else - return __connman_error_invalid_arguments(msg); - - err = __connman_element_request_scan(type); - if (err < 0) { - if (err == -EINPROGRESS) { - connman_error("Invalid return code from scan"); - err = -EINVAL; - } - - return __connman_error_failed(msg, -err); - } - - return g_dbus_create_reply(msg, DBUS_TYPE_INVALID); -} - static DBusConnection *connection = NULL; -static enum connman_service_type technology_type; -static connman_bool_t technology_enabled; -static DBusMessage *technology_pending = NULL; -static guint technology_timeout = 0; - -static void technology_reply(int error) +static void session_mode_notify(void) { - DBG(""); - - if (technology_timeout > 0) { - g_source_remove(technology_timeout); - technology_timeout = 0; - } - - if (technology_pending != NULL) { - if (error > 0) { - DBusMessage *reply; + DBusMessage *reply; - reply = __connman_error_failed(technology_pending, - error); - if (reply != NULL) - g_dbus_send_message(connection, reply); - } else - g_dbus_send_reply(connection, technology_pending, - DBUS_TYPE_INVALID); + reply = g_dbus_create_reply(session_mode_pending, DBUS_TYPE_INVALID); + g_dbus_send_message(connection, reply); - dbus_message_unref(technology_pending); - technology_pending = NULL; - } - - technology_type = CONNMAN_SERVICE_TYPE_UNKNOWN; + dbus_message_unref(session_mode_pending); + session_mode_pending = NULL; } -static gboolean technology_abort(gpointer user_data) +static void idle_state(connman_bool_t idle) { - DBG(""); - technology_timeout = 0; + DBG("idle %d", idle); - technology_reply(ETIMEDOUT); + connman_state_idle = idle; - return FALSE; -} - -static void technology_notify(enum connman_service_type type, - connman_bool_t enabled) -{ - DBG("type %d enabled %d", type, enabled); + if (connman_state_idle == FALSE || session_mode_pending == NULL) + return; - if (type == technology_type && enabled == technology_enabled) - technology_reply(0); + session_mode_notify(); } static struct connman_notifier technology_notifier = { .name = "manager", .priority = CONNMAN_NOTIFIER_PRIORITY_HIGH, - .service_enabled= technology_notify, + .idle_state = idle_state, }; -static DBusMessage *enable_technology(DBusConnection *conn, - DBusMessage *msg, void *data) +static void append_service_structs(DBusMessageIter *iter, void *user_data) { - enum connman_service_type type; - const char *str; - int err; - - DBG("conn %p", conn); - - if (technology_pending != NULL) - return __connman_error_in_progress(msg); - - dbus_message_get_args(msg, NULL, DBUS_TYPE_STRING, &str, - DBUS_TYPE_INVALID); - - if (g_strcmp0(str, "ethernet") == 0) - type = CONNMAN_SERVICE_TYPE_ETHERNET; - else if (g_strcmp0(str, "wifi") == 0) - type = CONNMAN_SERVICE_TYPE_WIFI; - else if (g_strcmp0(str, "wimax") == 0) - type = CONNMAN_SERVICE_TYPE_WIMAX; - else if (g_strcmp0(str, "bluetooth") == 0) - type = CONNMAN_SERVICE_TYPE_BLUETOOTH; - else if (g_strcmp0(str, "cellular") == 0) - type = CONNMAN_SERVICE_TYPE_CELLULAR; - else - return __connman_error_invalid_arguments(msg); - - if (__connman_notifier_is_registered(type) == FALSE) - return __connman_error_not_registered(msg); - - if (__connman_notifier_is_enabled(type) == TRUE) - return __connman_error_already_enabled(msg); - - technology_type = type; - technology_enabled = TRUE; - technology_pending = dbus_message_ref(msg); - - err = __connman_element_enable_technology(type); - if (err < 0 && err != -EINPROGRESS) - technology_reply(-err); - else - technology_timeout = g_timeout_add_seconds(15, - technology_abort, NULL); - - return NULL; + __connman_service_list_struct(iter); } -static DBusMessage *disable_technology(DBusConnection *conn, +static DBusMessage *get_services(DBusConnection *conn, DBusMessage *msg, void *data) { - enum connman_service_type type; - const char *str; - int err; - - DBG("conn %p", conn); - - if (technology_pending != NULL) - return __connman_error_in_progress(msg); - - dbus_message_get_args(msg, NULL, DBUS_TYPE_STRING, &str, - DBUS_TYPE_INVALID); - - if (g_strcmp0(str, "ethernet") == 0) - type = CONNMAN_SERVICE_TYPE_ETHERNET; - else if (g_strcmp0(str, "wifi") == 0) - type = CONNMAN_SERVICE_TYPE_WIFI; - else if (g_strcmp0(str, "wimax") == 0) - type = CONNMAN_SERVICE_TYPE_WIMAX; - else if (g_strcmp0(str, "bluetooth") == 0) - type = CONNMAN_SERVICE_TYPE_BLUETOOTH; - else if (g_strcmp0(str, "cellular") == 0) - type = CONNMAN_SERVICE_TYPE_CELLULAR; - else - return __connman_error_invalid_arguments(msg); - - if (__connman_notifier_is_registered(type) == FALSE) - return __connman_error_not_registered(msg); - - if (__connman_notifier_is_enabled(type) == FALSE) - return __connman_error_already_disabled(msg); + DBusMessage *reply; - technology_type = type; - technology_enabled = FALSE; - technology_pending = dbus_message_ref(msg); + reply = dbus_message_new_method_return(msg); + if (reply == NULL) + return NULL; - err = __connman_element_disable_technology(type); - if (err < 0 && err != -EINPROGRESS) - technology_reply(-err); - else - technology_timeout = g_timeout_add_seconds(10, - technology_abort, NULL); + __connman_dbus_append_objpath_dict_array(reply, + append_service_structs, NULL); - return NULL; + return reply; } -static DBusMessage *connect_service(DBusConnection *conn, +static DBusMessage *connect_provider(DBusConnection *conn, DBusMessage *msg, void *data) { int err; DBG("conn %p", conn); - if (__connman_security_check_privilege(msg, - CONNMAN_SECURITY_PRIVILEGE_MODIFY) < 0) - return __connman_error_permission_denied(msg); - - err = __connman_service_create_and_connect(msg); - if (err < 0) { - if (err == -EINPROGRESS) { - connman_error("Invalid return code from connect"); - err = -EINVAL; - } + if (__connman_session_mode() == TRUE) { + connman_info("Session mode enabled: " + "direct provider connect disabled"); - return __connman_error_failed(msg, -err); + return __connman_error_failed(msg, -EINVAL); } - return NULL; -} - - -static DBusMessage *connect_provider(DBusConnection *conn, - DBusMessage *msg, void *data) -{ - int err; - - DBG("conn %p", conn); - - if (__connman_security_check_privilege(msg, - CONNMAN_SECURITY_PRIVILEGE_MODIFY) < 0) - return __connman_error_permission_denied(msg); - err = __connman_provider_create_and_connect(msg); if (err < 0) { if (err == -EINPROGRESS) { @@ -506,7 +289,7 @@ static DBusMessage *register_counter(DBusConnection *conn, DBusMessage *msg, void *data) { const char *sender, *path; - unsigned int interval; + unsigned int accuracy, period; int err; DBG("conn %p", conn); @@ -514,10 +297,13 @@ static DBusMessage *register_counter(DBusConnection *conn, sender = dbus_message_get_sender(msg); dbus_message_get_args(msg, NULL, DBUS_TYPE_OBJECT_PATH, &path, - DBUS_TYPE_UINT32, &interval, + DBUS_TYPE_UINT32, &accuracy, + DBUS_TYPE_UINT32, &period, DBUS_TYPE_INVALID); - err = __connman_counter_register(sender, path, interval); + /* FIXME: add handling of accuracy parameter */ + + err = __connman_counter_register(sender, path, period); if (err < 0) return __connman_error_failed(msg, -err); @@ -544,150 +330,136 @@ static DBusMessage *unregister_counter(DBusConnection *conn, return g_dbus_create_reply(msg, DBUS_TYPE_INVALID); } -static DBusMessage *request_session(DBusConnection *conn, +static DBusMessage *create_session(DBusConnection *conn, DBusMessage *msg, void *data) { - const char *bearer, *sender, *service_path; - struct connman_service *service; + int err; DBG("conn %p", conn); - sender = dbus_message_get_sender(msg); - - dbus_message_get_args(msg, NULL, DBUS_TYPE_STRING, &bearer, - DBUS_TYPE_INVALID); - - service = __connman_session_request(bearer, sender); - if (service == NULL) - return __connman_error_failed(msg, EINVAL); - - service_path = __connman_service_get_path(service); + err = __connman_session_create(msg); + if (err < 0) + return __connman_error_failed(msg, -err); - return g_dbus_create_reply(msg, DBUS_TYPE_OBJECT_PATH, &service_path, - DBUS_TYPE_INVALID); + return g_dbus_create_reply(msg, DBUS_TYPE_INVALID); } -static DBusMessage *release_session(DBusConnection *conn, +static DBusMessage *destroy_session(DBusConnection *conn, DBusMessage *msg, void *data) { - const char *sender; int err; DBG("conn %p", conn); - sender = dbus_message_get_sender(msg); - - err = __connman_session_release(sender); + err = __connman_session_destroy(msg); if (err < 0) return __connman_error_failed(msg, -err); return g_dbus_create_reply(msg, DBUS_TYPE_INVALID); } -static GDBusMethodTable manager_methods[] = { - { "GetProperties", "", "a{sv}", get_properties }, - { "SetProperty", "sv", "", set_property }, - { "GetState", "", "s", get_state }, - { "CreateProfile", "s", "o", create_profile }, - { "RemoveProfile", "o", "", remove_profile }, - { "RemoveProvider", "s", "", remove_provider }, - { "RequestScan", "s", "", request_scan }, - { "EnableTechnology", "s", "", enable_technology, - G_DBUS_METHOD_FLAG_ASYNC }, - { "DisableTechnology", "s", "", disable_technology, - G_DBUS_METHOD_FLAG_ASYNC }, - { "ConnectService", "a{sv}", "o", connect_service, - G_DBUS_METHOD_FLAG_ASYNC }, - { "ConnectProvider", "a{sv}", "o", connect_provider, - G_DBUS_METHOD_FLAG_ASYNC }, - { "RegisterAgent", "o", "", register_agent }, - { "UnregisterAgent", "o", "", unregister_agent }, - { "RegisterCounter", "ou", "", register_counter }, - { "UnregisterCounter", "o", "", unregister_counter }, - { "RequestSession", "s", "o", request_session }, - { "ReleaseSession", "s", "", release_session }, - { }, -}; - -static GDBusSignalTable manager_signals[] = { - { "PropertyChanged", "sv" }, - { "StateChanged", "s" }, - { }, -}; - -static DBusMessage *nm_sleep(DBusConnection *conn, +static DBusMessage *request_private_network(DBusConnection *conn, DBusMessage *msg, void *data) { - DBusMessage *reply; + const char *sender; + int err; DBG("conn %p", conn); - reply = dbus_message_new_method_return(msg); - if (reply == NULL) - return NULL; + sender = dbus_message_get_sender(msg); - dbus_message_append_args(reply, DBUS_TYPE_INVALID); + err = __connman_private_network_request(msg, sender); + if (err < 0) + return __connman_error_failed(msg, -err); - return reply; + return NULL; } -static DBusMessage *nm_wake(DBusConnection *conn, +static DBusMessage *release_private_network(DBusConnection *conn, DBusMessage *msg, void *data) { - DBusMessage *reply; + const char *path; + int err; DBG("conn %p", conn); - reply = dbus_message_new_method_return(msg); - if (reply == NULL) - return NULL; + dbus_message_get_args(msg, NULL, DBUS_TYPE_OBJECT_PATH, &path, + DBUS_TYPE_INVALID); - dbus_message_append_args(reply, DBUS_TYPE_INVALID); + err = __connman_private_network_release(path); + if (err < 0) + return __connman_error_failed(msg, -err); - return reply; + return g_dbus_create_reply(msg, DBUS_TYPE_INVALID); } -enum { - NM_STATE_UNKNOWN = 0, - NM_STATE_ASLEEP, - NM_STATE_CONNECTING, - NM_STATE_CONNECTED, - NM_STATE_DISCONNECTED +static const GDBusMethodTable manager_methods[] = { + { GDBUS_METHOD("GetProperties", + NULL, GDBUS_ARGS({ "properties", "a{sv}" }), + get_properties) }, + { GDBUS_ASYNC_METHOD("SetProperty", + GDBUS_ARGS({ "name", "s" }, { "value", "v" }), + NULL, set_property) }, + { GDBUS_METHOD("GetTechnologies", + NULL, GDBUS_ARGS({ "technologies", "a(oa{sv})" }), + get_technologies) }, + { GDBUS_METHOD("RemoveProvider", + GDBUS_ARGS({ "provider", "o" }), NULL, + remove_provider) }, + { GDBUS_METHOD("GetServices", + NULL, GDBUS_ARGS({ "services", "a(oa{sv})" }), + get_services) }, + { GDBUS_ASYNC_METHOD("ConnectProvider", + GDBUS_ARGS({ "provider", "a{sv}" }), + GDBUS_ARGS({ "path", "o" }), + connect_provider) }, + { GDBUS_METHOD("RegisterAgent", + GDBUS_ARGS({ "path", "o" }), NULL, + register_agent) }, + { GDBUS_METHOD("UnregisterAgent", + GDBUS_ARGS({ "path", "o" }), NULL, + unregister_agent) }, + { GDBUS_METHOD("RegisterCounter", + GDBUS_ARGS({ "path", "o" }, { "accuracy", "u" }, + { "period", "u" }), + NULL, register_counter) }, + { GDBUS_METHOD("UnregisterCounter", + GDBUS_ARGS({ "path", "o" }), NULL, + unregister_counter) }, + { GDBUS_METHOD("CreateSession", + GDBUS_ARGS({ "settings", "a{sv}" }, + { "notifier", "o" }), + GDBUS_ARGS({ "session", "o" }), + create_session) }, + { GDBUS_METHOD("DestroySession", + GDBUS_ARGS({ "session", "o" }), NULL, + destroy_session) }, + { GDBUS_ASYNC_METHOD("RequestPrivateNetwork", + NULL, GDBUS_ARGS({ "path", "o" }, + { "settings", "a{sv}" }, + { "socket", "h" }), + request_private_network) }, + { GDBUS_METHOD("ReleasePrivateNetwork", + GDBUS_ARGS({ "path", "o" }), NULL, + release_private_network) }, + { }, }; -static DBusMessage *nm_state(DBusConnection *conn, - DBusMessage *msg, void *data) -{ - DBusMessage *reply; - dbus_uint32_t state; - - DBG("conn %p", conn); - - reply = dbus_message_new_method_return(msg); - if (reply == NULL) - return NULL; - - if (__connman_notifier_count_connected() > 0) - state = NM_STATE_CONNECTED; - else - state = NM_STATE_DISCONNECTED; - - dbus_message_append_args(reply, DBUS_TYPE_UINT32, &state, - DBUS_TYPE_INVALID); - - return reply; -} - -static GDBusMethodTable nm_methods[] = { - { "sleep", "", "", nm_sleep }, - { "wake", "", "", nm_wake }, - { "state", "", "u", nm_state }, +static const GDBusSignalTable manager_signals[] = { + { GDBUS_SIGNAL("PropertyChanged", + GDBUS_ARGS({ "name", "s" }, { "value", "v" })) }, + { GDBUS_SIGNAL("TechnologyAdded", + GDBUS_ARGS({ "path", "o" }, + { "properties", "a{sv}" })) }, + { GDBUS_SIGNAL("TechnologyRemoved", + GDBUS_ARGS({ "path", "o" })) }, + { GDBUS_SIGNAL("ServicesChanged", + GDBUS_ARGS({ "changed", "a(oa{sv})" }, + { "removed", "ao" })) }, { }, }; -static gboolean nm_compat = FALSE; - -int __connman_manager_init(gboolean compat) +int __connman_manager_init(void) { DBG(""); @@ -703,12 +475,7 @@ int __connman_manager_init(gboolean compat) manager_methods, manager_signals, NULL, NULL, NULL); - if (compat == TRUE) { - g_dbus_register_interface(connection, NM_PATH, NM_INTERFACE, - nm_methods, NULL, NULL, NULL, NULL); - - nm_compat = TRUE; - } + connman_state_idle = TRUE; return 0; } @@ -717,14 +484,10 @@ void __connman_manager_cleanup(void) { DBG(""); - connman_notifier_unregister(&technology_notifier); - if (connection == NULL) return; - if (nm_compat == TRUE) { - g_dbus_unregister_interface(connection, NM_PATH, NM_INTERFACE); - } + connman_notifier_unregister(&technology_notifier); g_dbus_unregister_interface(connection, CONNMAN_MANAGER_PATH, CONNMAN_MANAGER_INTERFACE);