mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2025-02-16 15:20:42 +01:00
auto-t: iwd.py: allow certain APIs to be used in AP mode
AP mode implements a few DBus methods/properties which are named the same as station: Scan, Scanning, and GetOrderedNetworks. Allow the Device object to work with these in AP mode by calling the correct method if the Mode is 'ap'.
This commit is contained in:
parent
606769dbea
commit
9ef440eb8e
@ -521,13 +521,16 @@ class Device(IWDDBusAbstract):
|
|||||||
def scanning(self):
|
def scanning(self):
|
||||||
'''
|
'''
|
||||||
Reflects whether the device is currently scanning
|
Reflects whether the device is currently scanning
|
||||||
for networks. net.connman.iwd.Network objects are
|
for networks. For station devices net.connman.iwd.Network
|
||||||
updated when this property goes from true to false.
|
objects are updated when this property goes from true to false
|
||||||
|
|
||||||
@rtype: boolean
|
@rtype: boolean
|
||||||
'''
|
'''
|
||||||
props = self._station_properties()
|
if self._properties['Mode'] == 'station':
|
||||||
return bool(props['Scanning'])
|
props = self._station_properties()
|
||||||
|
return bool(props['Scanning'])
|
||||||
|
else:
|
||||||
|
return bool(self._ap.scanning)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def autoconnect(self):
|
def autoconnect(self):
|
||||||
@ -544,12 +547,14 @@ class Device(IWDDBusAbstract):
|
|||||||
Possible exception: BusyEx
|
Possible exception: BusyEx
|
||||||
FailedEx
|
FailedEx
|
||||||
'''
|
'''
|
||||||
self._iface.Scan(dbus_interface=IWD_STATION_INTERFACE,
|
if self._properties['Mode'] == 'station':
|
||||||
|
self._iface.Scan(dbus_interface=IWD_STATION_INTERFACE,
|
||||||
reply_handler=self._success,
|
reply_handler=self._success,
|
||||||
error_handler=self._failure)
|
error_handler=self._failure)
|
||||||
|
if wait:
|
||||||
if wait:
|
self._wait_for_async_op()
|
||||||
self._wait_for_async_op()
|
else:
|
||||||
|
self._ap.scan()
|
||||||
|
|
||||||
def disconnect(self):
|
def disconnect(self):
|
||||||
'''Disconnect from the network
|
'''Disconnect from the network
|
||||||
@ -576,6 +581,9 @@ class Device(IWDDBusAbstract):
|
|||||||
groups the maximum relative signal-strength is the
|
groups the maximum relative signal-strength is the
|
||||||
main sorting factor.
|
main sorting factor.
|
||||||
'''
|
'''
|
||||||
|
if self._properties['Mode'] == 'ap':
|
||||||
|
return self._ap.get_ordered_networks()
|
||||||
|
|
||||||
ordered_networks = []
|
ordered_networks = []
|
||||||
if not full_scan:
|
if not full_scan:
|
||||||
for bus_obj in self._station.GetOrderedNetworks():
|
for bus_obj in self._station.GetOrderedNetworks():
|
||||||
|
Loading…
x
Reference in New Issue
Block a user