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
1 changed files with 22 additions and 0 deletions

View File

@ -172,6 +172,16 @@ class Device(IWDDBusAbstract):
with its properties and methods
'''
_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
def device_path(self):
@ -284,6 +294,18 @@ class Device(IWDDBusAbstract):
ordered_networks.append(ordered_network)
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 = ''):
return prefix + 'Device: ' + self.device_path + '\n'\
+ prefix + '\tName:\t\t' + self.name + '\n'\