3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-22 14:49:24 +01:00
iwd/test/list-devices
2016-07-14 10:04:18 -05:00

34 lines
980 B
Python
Executable File

#!/usr/bin/python3
import sys
import dbus
bus = dbus.SystemBus()
manager = dbus.Interface(bus.get_object("net.connman.iwd", "/"),
"org.freedesktop.DBus.ObjectManager")
objects = manager.GetManagedObjects()
for path in objects:
if 'net.connman.iwd.Device' not in objects[path]:
continue
properties = objects[path]['net.connman.iwd.Device']
device = dbus.Interface(bus.get_object("net.connman.iwd", path),
'net.connman.iwd.Device')
print("[ %s ]" % path)
for key in properties:
val = properties[key]
print(" %s = %s" % (key, val))
print(" Sorted networks:")
for path2, ssid, rssi, security in device.GetOrderedNetworks():
print(" [ %s ]" % path2)
print(" SSID = %s" % (ssid,))
print(" Signal strength = %i dBm" % (rssi / 100,))
print(" Security = %s" % (security,))