From 201574bdf1649ead12d4ac27612e3516acd79c43 Mon Sep 17 00:00:00 2001 From: Tim Kourt Date: Tue, 4 Oct 2016 16:44:25 -0700 Subject: [PATCH] auto-t: Add WPS API to device --- autotests/util/iwd.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/autotests/util/iwd.py b/autotests/util/iwd.py index 60b32003..6c461879 100755 --- a/autotests/util/iwd.py +++ b/autotests/util/iwd.py @@ -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'\