mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-11-22 14:49:24 +01:00
auto-t: remove device.wait_for_connected
I had added this without realizing wait_for_object_condition can do this already using the device object.
This commit is contained in:
parent
2e3ad0f6b3
commit
9bb5ecf27a
@ -48,7 +48,8 @@ class Test(unittest.TestCase):
|
|||||||
wd.wait_for_object_condition(n.network_object, condition)
|
wd.wait_for_object_condition(n.network_object, condition)
|
||||||
|
|
||||||
for d in devices:
|
for d in devices:
|
||||||
d.wait_for_connected()
|
condition = 'obj.state == DeviceState.connected'
|
||||||
|
wd.wait_for_object_condition(d, condition)
|
||||||
|
|
||||||
for d in devices:
|
for d in devices:
|
||||||
d.disconnect()
|
d.disconnect()
|
||||||
|
@ -564,31 +564,6 @@ class Device(IWDDBusAbstract):
|
|||||||
if self._adhoc_timed_out:
|
if self._adhoc_timed_out:
|
||||||
raise TimeoutError("Timed out waiting for peer %s" % addr)
|
raise TimeoutError("Timed out waiting for peer %s" % addr)
|
||||||
|
|
||||||
def wait_for_connected(self):
|
|
||||||
if str(self.state) == "connected":
|
|
||||||
return
|
|
||||||
|
|
||||||
self._connected_success = False
|
|
||||||
self._connected_timed_out = False
|
|
||||||
|
|
||||||
def wait_timeout_cb():
|
|
||||||
self._connected_timed_out = True
|
|
||||||
return False
|
|
||||||
|
|
||||||
def connected_prop_changed(iface, changed, invalid):
|
|
||||||
if changed.get('State', None):
|
|
||||||
if changed['State'] == 'connected':
|
|
||||||
self._connected_success = True
|
|
||||||
|
|
||||||
self._prop_proxy.connect_to_signal('PropertiesChanged',
|
|
||||||
connected_prop_changed)
|
|
||||||
GLib.timeout_add(int(15 * 1000), wait_timeout_cb)
|
|
||||||
context = mainloop.get_context()
|
|
||||||
while not self._connected_success:
|
|
||||||
context.iteration(may_block=True)
|
|
||||||
if self._connected_timed_out:
|
|
||||||
raise TimeoutError("Timed out waiting for connected")
|
|
||||||
|
|
||||||
def __str__(self, prefix = ''):
|
def __str__(self, prefix = ''):
|
||||||
return prefix + 'Device: ' + self.device_path + '\n'\
|
return prefix + 'Device: ' + self.device_path + '\n'\
|
||||||
+ prefix + '\tName:\t\t' + self.name + '\n'\
|
+ prefix + '\tName:\t\t' + self.name + '\n'\
|
||||||
|
Loading…
Reference in New Issue
Block a user