From 29eb08ead2496bf20d0f47d8026a34c7cdceecd6 Mon Sep 17 00:00:00 2001 From: James Prestwood Date: Mon, 14 Sep 2020 14:04:05 -0700 Subject: [PATCH] auto-t: make AdHoc APIs behave like others The AdHoc functionality in iwd.py was not consistent at all with how all the other classes worked (my bad). Instead we can create a very simple AdHocDevice class which inherits all the DBus magic in the IWDDBusAbstract class. --- autotests/util/iwd.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/autotests/util/iwd.py b/autotests/util/iwd.py index e74a6faf..2713d774 100755 --- a/autotests/util/iwd.py +++ b/autotests/util/iwd.py @@ -206,6 +206,20 @@ class SignalAgent(dbus.service.Object): def handle_new_level(self, path, level): pass +class AdHocDevice(IWDDBusAbstract): + ''' + Class represents an AdHoc device object: net.connman.iwd.AdHoc + ''' + _iface_name = IWD_ADHOC_INTERFACE + + @property + def started(self): + return self._properties['Started'] + + @property + def connected_peers(self): + return self._properties['ConnectedPeers'] + class Device(IWDDBusAbstract): ''' @@ -506,6 +520,8 @@ class Device(IWDDBusAbstract): error_handler=self._failure) self._wait_for_async_op() + return AdHocDevice(self.device_path) + def stop_adhoc(self): self._prop_proxy.Set(IWD_DEVICE_INTERFACE, 'Mode', 'station')