3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-12-19 10:02:33 +01:00

auto-t: Add WPS API to device

This commit is contained in:
Tim Kourt 2016-10-04 16:44:25 -07:00 committed by Denis Kenzior
parent 20ca7ac841
commit 201574bdf1

View File

@ -172,6 +172,16 @@ class Device(IWDDBusAbstract):
with its properties and methods with its properties and methods
''' '''
_iface_name = IWD_DEVICE_INTERFACE _iface_name = IWD_DEVICE_INTERFACE
_wps_manager_if = None
@property
def _wps_manager(self):
if self._wps_manager_if is None:
_wps_manager_if =\
dbus.Interface(self._bus.get_object(IWD_SERVICE,
self.device_path),
IWD_WSC_INTERFACE)
return _wps_manager_if
@property @property
def device_path(self): def device_path(self):
@ -284,6 +294,18 @@ class Device(IWDDBusAbstract):
ordered_networks.append(ordered_network) ordered_networks.append(ordered_network)
return ordered_networks return ordered_networks
def wps_push_button(self):
self._wps_manager.PushButton(dbus_interface=IWD_WSC_INTERFACE,
reply_handler=self._success,
error_handler=self._failure)
self._wait_for_async_op()
def wps_cancel(self):
self._wps_manager.Cancel(dbus_interface=IWD_WSC_INTERFACE,
reply_handler=self._success,
error_handler=self._failure)
self._wait_for_async_op()
def __str__(self, prefix = ''): def __str__(self, prefix = ''):
return prefix + 'Device: ' + self.device_path + '\n'\ return prefix + 'Device: ' + self.device_path + '\n'\
+ prefix + '\tName:\t\t' + self.name + '\n'\ + prefix + '\tName:\t\t' + self.name + '\n'\