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

client: WSC cancel command

This commit is contained in:
Tim Kourt 2017-05-01 10:23:48 -07:00 committed by Denis Kenzior
parent 87b4f282db
commit ff5e3f3b52
3 changed files with 35 additions and 1 deletions

View File

@ -645,6 +645,20 @@ static const struct command device_commands[] = {
{ } { }
}; };
const struct proxy_interface *device_wsc_get(const char *device_name)
{
const struct device *device;
const struct proxy_interface *proxy =
get_device_proxy_by_name(device_name);
if (!proxy)
return NULL;
device = proxy_interface_get_data(proxy);
return device->wsc;
}
char *device_wsc_family_arg_completion(const char *text, int state) char *device_wsc_family_arg_completion(const char *text, int state)
{ {
return proxy_property_str_completion(&device_interface_type, return proxy_property_str_completion(&device_interface_type,

View File

@ -20,4 +20,6 @@
* *
*/ */
const struct proxy_interface *device_wsc_get(const char *device_name);
char *device_wsc_family_arg_completion(const char *text, int state); char *device_wsc_family_arg_completion(const char *text, int state);

View File

@ -29,11 +29,18 @@
#include "command.h" #include "command.h"
#include "dbus-proxy.h" #include "dbus-proxy.h"
#include "device.h" #include "device.h"
#include "display.h"
static struct proxy_interface_type wsc_interface_type = { static struct proxy_interface_type wsc_interface_type = {
.interface = IWD_WSC_INTERFACE, .interface = IWD_WSC_INTERFACE,
}; };
static void check_errors_method_callback(struct l_dbus_message *message,
void *user_data)
{
dbus_message_has_error(message);
}
static enum cmd_status cmd_push_button(const char *device_name, char *args) static enum cmd_status cmd_push_button(const char *device_name, char *args)
{ {
return CMD_STATUS_UNSUPPORTED; return CMD_STATUS_UNSUPPORTED;
@ -51,7 +58,18 @@ static enum cmd_status cmd_start_pin(const char *device_name, char *args)
static enum cmd_status cmd_cancel(const char *device_name, char *args) static enum cmd_status cmd_cancel(const char *device_name, char *args)
{ {
return CMD_STATUS_UNSUPPORTED; const struct proxy_interface *proxy = device_wsc_get(device_name);
if (!proxy) {
display("Invalid device name '%s'\n", device_name);
return CMD_STATUS_INVALID_VALUE;
}
proxy_interface_method_call(proxy, "Cancel", "",
check_errors_method_callback);
return CMD_STATUS_OK;
} }
static const struct command wsc_commands[] = { static const struct command wsc_commands[] = {