3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-12-24 06:52:37 +01:00

client: Move Device.Disconnect to Station

This commit is contained in:
Denis Kenzior 2018-09-14 21:16:42 -05:00
parent 6b46beef45
commit 81dd689611
2 changed files with 25 additions and 17 deletions

View File

@ -533,21 +533,6 @@ static enum cmd_status cmd_scan(const char *device_name,
return CMD_STATUS_TRIGGERED; return CMD_STATUS_TRIGGERED;
} }
static enum cmd_status cmd_disconnect(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, "Disconnect", "",
check_errors_method_callback);
return CMD_STATUS_TRIGGERED;
}
static enum cmd_status cmd_get_networks(const char *device_name, static enum cmd_status cmd_get_networks(const char *device_name,
char **argv, int argc) char **argv, int argc)
{ {
@ -724,8 +709,6 @@ static const struct command device_commands[] = {
cmd_connect_hidden_network, cmd_connect_hidden_network,
"Connect to hidden network", "Connect to hidden network",
false }, false },
{ "<wlan>", "disconnect",
NULL, cmd_disconnect, "Disconnect" },
{ } { }
}; };

View File

@ -129,6 +129,12 @@ static struct proxy_interface_type station_interface_type = {
.ops = &station_ops, .ops = &station_ops,
}; };
static void check_errors_method_callback(struct l_dbus_message *message,
void *user_data)
{
dbus_message_has_error(message);
}
static void display_station_inline(const char *margin, const void *data) static void display_station_inline(const char *margin, const void *data)
{ {
const struct proxy_interface *station_i = data; const struct proxy_interface *station_i = data;
@ -179,8 +185,27 @@ static enum cmd_status cmd_list(const char *device_name, char **argv, int argc)
return CMD_STATUS_DONE; return CMD_STATUS_DONE;
} }
static enum cmd_status cmd_disconnect(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, "Disconnect", "",
check_errors_method_callback);
return CMD_STATUS_TRIGGERED;
}
static const struct command station_commands[] = { static const struct command station_commands[] = {
{ NULL, "list", NULL, cmd_list, "List Ad-Hoc devices", true }, { NULL, "list", NULL, cmd_list, "List Ad-Hoc devices", true },
{ "<wlan>", "disconnect",
NULL, cmd_disconnect, "Disconnect" },
{ } { }
}; };