diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2009-07-16 11:49:38 +0200 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2009-07-16 11:49:38 +0200 |
commit | eb95dabb34e70d91d2e0197b7670c366075191e0 (patch) | |
tree | 429f8021fa7942c7f720586794ce64e817dd4b68 /src/manager.c | |
parent | 0288f219724f9f615975fc1d2d2ce34287bf47f7 (diff) | |
download | connman-eb95dabb34e70d91d2e0197b7670c366075191e0.tar.gz connman-eb95dabb34e70d91d2e0197b7670c366075191e0.tar.bz2 connman-eb95dabb34e70d91d2e0197b7670c366075191e0.zip |
Add global method call to request scanning
Diffstat (limited to 'src/manager.c')
-rw-r--r-- | src/manager.c | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/src/manager.c b/src/manager.c index 3a79bc52..85025b36 100644 --- a/src/manager.c +++ b/src/manager.c @@ -244,6 +244,40 @@ static DBusMessage *remove_profile(DBusConnection *conn, return __connman_error_not_supported(msg); } +static DBusMessage *request_scan(DBusConnection *conn, + DBusMessage *msg, void *data) +{ + enum connman_device_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_DEVICE_TYPE_UNKNOWN; + else if (g_strcmp0(str, "wifi") == 0) + type = CONNMAN_DEVICE_TYPE_WIFI; + else if (g_strcmp0(str, "wimax") == 0) + type = CONNMAN_DEVICE_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 DBusMessage *connect_service(DBusConnection *conn, DBusMessage *msg, void *data) { @@ -258,7 +292,7 @@ static DBusMessage *connect_service(DBusConnection *conn, err = __connman_service_create_and_connect(msg); if (err < 0) { if (err == -EINPROGRESS) { - connman_error("Invalid return code from callbacks"); + connman_error("Invalid return code from connect"); err = -EINVAL; } @@ -321,6 +355,7 @@ static GDBusMethodTable manager_methods[] = { { "SetProperty", "sv", "", set_property }, { "AddProfile", "s", "o", add_profile }, { "RemoveProfile", "o", "", remove_profile }, + { "RequestScan", "s", "", request_scan }, { "ConnectService", "a{sv}", "o", connect_service, G_DBUS_METHOD_FLAG_ASYNC }, { "RegisterAgent", "o", "", register_agent }, |