test: use GetOrderedNetworks() in list-devices

This commit is contained in:
Andrew Zaborowski 2016-07-14 02:38:07 +02:00 committed by Denis Kenzior
parent d371c287bb
commit 07f177ca24
1 changed files with 10 additions and 19 deletions

View File

@ -13,30 +13,21 @@ for path in objects:
if 'net.connman.iwd.Device' not in objects[path]: if 'net.connman.iwd.Device' not in objects[path]:
continue continue
device = objects[path]['net.connman.iwd.Device'] properties = objects[path]['net.connman.iwd.Device']
device = dbus.Interface(bus.get_object("net.connman.iwd", path),
'net.connman.iwd.Device')
print("[ %s ]" % path) print("[ %s ]" % path)
for key in device.keys(): for key in properties:
val = device[key] val = properties[key]
print(" %s = %s" % (key, val)) print(" %s = %s" % (key, val))
print(" Networks:") print(" Sorted networks:")
for path2 in objects:
if not path2.startswith(path) or \
'net.connman.iwd.Network' not in objects[path2]:
continue
network = objects[path2]['net.connman.iwd.Network']
for path2, ssid, rssi, security in device.GetOrderedNetworks():
print(" [ %s ]" % path2) print(" [ %s ]" % path2)
for key in network.keys(): print(" SSID = %s" % (ssid,))
if key in ["SSID"]: print(" Signal strength = %i dBm" % (rssi / 100,))
val = network[key] print(" Security = %s" % (security,))
val = "".join(map(chr, val))
else:
val = network[key]
print(" %s = %s" % (key, val))