commit 189a96e91aa0fd65926e434d98defac08641adce
parent c47db2635fb2621f040c9639ed3de64b23228dd1
Author: Denis Kenzior <denkenz@gmail.com>
Date: Fri, 14 Sep 2018 21:20:03 -0500
client: Move Device.Scan method to Station
Diffstat:
2 files changed, 18 insertions(+), 16 deletions(-)
diff --git a/client/device.c b/client/device.c
@@ -518,21 +518,6 @@ static void check_errors_method_callback(struct l_dbus_message *message,
dbus_message_has_error(message);
}
-static enum cmd_status cmd_scan(const char *device_name,
- char **argv, int argc)
-{
- const struct proxy_interface *proxy =
- device_proxy_find_by_name(device_name);
-
- if (!proxy)
- return CMD_STATUS_INVALID_ARGS;
-
- proxy_interface_method_call(proxy, "Scan", "",
- check_errors_method_callback);
-
- return CMD_STATUS_TRIGGERED;
-}
-
static enum cmd_status cmd_get_networks(const char *device_name,
char **argv, int argc)
{
@@ -688,7 +673,6 @@ static char *set_property_cmd_arg_completion(const char *text, int state)
static const struct command device_commands[] = {
{ NULL, "list", NULL, cmd_list, "List devices", true },
{ "<wlan>", "show", NULL, cmd_show, "Show device info", true },
- { "<wlan>", "scan", NULL, cmd_scan, "Scan for networks" },
{ "<wlan>", "get-networks",
"[rssi-dbms/rssi-bars]",
cmd_get_networks,
diff --git a/client/station.c b/client/station.c
@@ -202,10 +202,28 @@ static enum cmd_status cmd_disconnect(const char *device_name,
return CMD_STATUS_TRIGGERED;
}
+static enum cmd_status cmd_scan(const char *device_name,
+ char **argv, int argc)
+{
+ const struct proxy_interface *station_i =
+ device_proxy_find(device_name, IWD_STATION_INTERFACE);
+
+ if (!station_i) {
+ display("No station on device: '%s'\n", device_name);
+ return CMD_STATUS_INVALID_VALUE;
+ }
+
+ proxy_interface_method_call(station_i, "Scan", "",
+ check_errors_method_callback);
+
+ return CMD_STATUS_TRIGGERED;
+}
+
static const struct command station_commands[] = {
{ NULL, "list", NULL, cmd_list, "List Ad-Hoc devices", true },
{ "<wlan>", "disconnect",
NULL, cmd_disconnect, "Disconnect" },
+ { "<wlan>", "scan", NULL, cmd_scan, "Scan for networks" },
{ }
};