summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authorPatrik Flykt <patrik.flykt@linux.intel.com>2013-03-27 13:54:00 +0200
committerPatrik Flykt <patrik.flykt@linux.intel.com>2013-04-04 10:26:14 +0300
commitd368f94c5dbff8a75d735b1adf31775f9924c701 (patch)
tree8cb0c8fb2ae611d38ed2b4eb6d1db0230a033eca /client
parenteb5996f53198a68ab1c94995c43bd5b0841b5b87 (diff)
downloadconnman-d368f94c5dbff8a75d735b1adf31775f9924c701.tar.gz
connman-d368f94c5dbff8a75d735b1adf31775f9924c701.tar.bz2
connman-d368f94c5dbff8a75d735b1adf31775f9924c701.zip
client: Use D-Bus helpers for Technology Scan method call
Diffstat (limited to 'client')
-rw-r--r--client/commands.c32
1 files changed, 20 insertions, 12 deletions
diff --git a/client/commands.c b/client/commands.c
index 8ab299a6..f6abdbb9 100644
--- a/client/commands.c
+++ b/client/commands.c
@@ -244,10 +244,24 @@ static int cmd_technologies(char *args[], int num, struct option *options)
technology_print, NULL, DBUS_TYPE_INVALID);
}
+static void scan_return(DBusMessageIter *iter, const char *error,
+ void *user_data)
+{
+ char *path = user_data;
+
+ if (error == NULL) {
+ char *str = strrchr(path, '/');
+ str++;
+ fprintf(stdout, "Scan completed for %s\n", str);
+ } else
+ fprintf(stderr, "Error %s: %s", path, error);
+
+ g_free(user_data);
+}
+
static int cmd_scan(char *args[], int num, struct option *options)
{
- DBusMessage *message;
- int err;
+ char *path;
if (num > 2)
return -E2BIG;
@@ -255,16 +269,10 @@ static int cmd_scan(char *args[], int num, struct option *options)
if (num < 2)
return -EINVAL;
- message = get_message(connection, "GetTechnologies");
- if (message == NULL)
- err = -ENOMEM;
- else {
- err = scan_technology(connection, message, args[1]);
- if (err == 0)
- printf("Scan completed\n");
- }
-
- return 0;
+ path = g_strdup_printf("/net/connman/technology/%s", args[1]);
+ return __connmanctl_dbus_method_call(connection, path,
+ "net.connman.Technology", "Scan",
+ scan_return, path, DBUS_TYPE_INVALID);
}
static void connect_return(DBusMessageIter *iter, const char *error,