client: Move Device.Scan method to Station

This commit is contained in:
Denis Kenzior 2018-09-14 21:20:03 -05:00
parent c47db2635f
commit 189a96e91a
2 changed files with 18 additions and 16 deletions

View File

@ -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,

View File

@ -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" },
{ }
};