mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2025-01-03 10:32:33 +01:00
auto-t: iwd.py: clean up StationDebug
Initialize this once and reference that for each method/property
This commit is contained in:
parent
973ee269d3
commit
a2c777ba84
@ -248,6 +248,12 @@ class StationDebug(IWDDBusAbstract):
|
|||||||
def autoconnect(self):
|
def autoconnect(self):
|
||||||
return self._properties['AutoConnect']
|
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):
|
def scan(self, frequencies):
|
||||||
frequencies = dbus.Array([dbus.UInt16(f) for f in frequencies])
|
frequencies = dbus.Array([dbus.UInt16(f) for f in frequencies])
|
||||||
self._iface.Scan(frequencies)
|
self._iface.Scan(frequencies)
|
||||||
@ -278,9 +284,11 @@ class Device(IWDDBusAbstract):
|
|||||||
self._wps_manager_if = None
|
self._wps_manager_if = None
|
||||||
self._station_if = None
|
self._station_if = None
|
||||||
self._station_props = None
|
self._station_props = None
|
||||||
self._station_debug = None
|
|
||||||
IWDDBusAbstract.__init__(self, *args, **kwargs)
|
IWDDBusAbstract.__init__(self, *args, **kwargs)
|
||||||
|
|
||||||
|
self._station_debug = StationDebug(*args, **kwargs)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def _wps_manager(self):
|
def _wps_manager(self):
|
||||||
if self._wps_manager_if is None:
|
if self._wps_manager_if is None:
|
||||||
@ -397,16 +405,10 @@ class Device(IWDDBusAbstract):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def autoconnect(self):
|
def autoconnect(self):
|
||||||
if not self._station_debug:
|
|
||||||
self._station_debug = StationDebug(self._object_path)
|
|
||||||
|
|
||||||
return self._station_debug.autoconnect
|
return self._station_debug.autoconnect
|
||||||
|
|
||||||
@autoconnect.setter
|
@autoconnect.setter
|
||||||
def autoconnect(self, value):
|
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,
|
self._station_debug._prop_proxy.Set(IWD_STATION_DEBUG_INTERFACE,
|
||||||
'AutoConnect', value)
|
'AutoConnect', value)
|
||||||
|
|
||||||
@ -602,27 +604,15 @@ class Device(IWDDBusAbstract):
|
|||||||
self._prop_proxy.Set(IWD_DEVICE_INTERFACE, 'Mode', 'station')
|
self._prop_proxy.Set(IWD_DEVICE_INTERFACE, 'Mode', 'station')
|
||||||
|
|
||||||
def connect_bssid(self, address):
|
def connect_bssid(self, address):
|
||||||
self._station_debug_if = dbus.Interface(self._bus.get_object(IWD_SERVICE,
|
self._station_debug.connect_bssid(address)
|
||||||
self.device_path),
|
|
||||||
IWD_STATION_DEBUG_INTERFACE)
|
|
||||||
self._station_debug_if.ConnectBssid(dbus.ByteArray.fromhex(address.replace(':', '')))
|
|
||||||
|
|
||||||
def roam(self, address):
|
def roam(self, address):
|
||||||
self._station_debug_if = dbus.Interface(self._bus.get_object(IWD_SERVICE,
|
self._station_debug.roam(address)
|
||||||
self.device_path),
|
|
||||||
IWD_STATION_DEBUG_INTERFACE)
|
|
||||||
self._station_debug_if.Roam(dbus.ByteArray.fromhex(address.replace(':', '')))
|
|
||||||
|
|
||||||
def debug_scan(self, frequencies):
|
def debug_scan(self, frequencies):
|
||||||
if not self._station_debug:
|
|
||||||
self._station_debug = StationDebug(self._object_path)
|
|
||||||
|
|
||||||
self._station_debug.scan(frequencies)
|
self._station_debug.scan(frequencies)
|
||||||
|
|
||||||
def wait_for_event(self, event, timeout=10):
|
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)
|
self._station_debug.wait_for_event(event, timeout)
|
||||||
|
|
||||||
def __str__(self, prefix = ''):
|
def __str__(self, prefix = ''):
|
||||||
|
Loading…
Reference in New Issue
Block a user