eiwd

no dbus iwd with iwctl functionality
git clone https://git.daat.foo/repos/eiwd.git
Log | Files | Refs | Submodules | README | LICENSE

commit a2c777ba847be92d81b1f59315d95bd6da62ed08
parent 973ee269d33be50adbd8dbf633bfda260d927a8a
Author: James Prestwood <prestwoj@gmail.com>
Date:   Fri, 13 Aug 2021 15:45:52 -0700

auto-t: iwd.py: clean up StationDebug

Initialize this once and reference that for each method/property

Diffstat:
Mautotests/util/iwd.py | 32+++++++++++---------------------
1 file changed, 11 insertions(+), 21 deletions(-)

diff --git a/autotests/util/iwd.py b/autotests/util/iwd.py @@ -248,6 +248,12 @@ class StationDebug(IWDDBusAbstract): def autoconnect(self): return self._properties['AutoConnect'] + def connect_bssid(self, address): + self._iface.ConnectBssid(dbus.ByteArray.fromhex(address.replace(':', ''))) + + def roam(self, address): + self._iface.Roam(dbus.ByteArray.fromhex(address.replace(':', ''))) + def scan(self, frequencies): frequencies = dbus.Array([dbus.UInt16(f) for f in frequencies]) self._iface.Scan(frequencies) @@ -278,9 +284,11 @@ class Device(IWDDBusAbstract): self._wps_manager_if = None self._station_if = None self._station_props = None - self._station_debug = None + IWDDBusAbstract.__init__(self, *args, **kwargs) + self._station_debug = StationDebug(*args, **kwargs) + @property def _wps_manager(self): if self._wps_manager_if is None: @@ -397,16 +405,10 @@ class Device(IWDDBusAbstract): @property def autoconnect(self): - if not self._station_debug: - self._station_debug = StationDebug(self._object_path) - return self._station_debug.autoconnect @autoconnect.setter def autoconnect(self, value): - if not self._station_debug: - self._station_debug = StationDebug(self._object_path) - self._station_debug._prop_proxy.Set(IWD_STATION_DEBUG_INTERFACE, 'AutoConnect', value) @@ -602,27 +604,15 @@ class Device(IWDDBusAbstract): self._prop_proxy.Set(IWD_DEVICE_INTERFACE, 'Mode', 'station') def connect_bssid(self, address): - self._station_debug_if = dbus.Interface(self._bus.get_object(IWD_SERVICE, - self.device_path), - IWD_STATION_DEBUG_INTERFACE) - self._station_debug_if.ConnectBssid(dbus.ByteArray.fromhex(address.replace(':', ''))) + self._station_debug.connect_bssid(address) def roam(self, address): - self._station_debug_if = dbus.Interface(self._bus.get_object(IWD_SERVICE, - self.device_path), - IWD_STATION_DEBUG_INTERFACE) - self._station_debug_if.Roam(dbus.ByteArray.fromhex(address.replace(':', ''))) + self._station_debug.roam(address) def debug_scan(self, frequencies): - if not self._station_debug: - self._station_debug = StationDebug(self._object_path) - self._station_debug.scan(frequencies) def wait_for_event(self, event, timeout=10): - if not self._station_debug: - self._station_debug = StationDebug(self._object_path) - self._station_debug.wait_for_event(event, timeout) def __str__(self, prefix = ''):