3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-20 12:29:34 +01:00
iwd/test/list-known-networks

36 lines
961 B
Plaintext
Raw Normal View History

2016-07-14 02:38:08 +02:00
#!/usr/bin/python3
import sys
import dbus
bus = dbus.SystemBus()
manager = dbus.Interface(bus.get_object('net.connman.iwd', '/'),
'org.freedesktop.DBus.ObjectManager')
2016-07-14 02:38:08 +02:00
forget = None
2016-07-14 02:38:08 +02:00
if len(sys.argv) >= 4 and sys.argv[1] == 'forget':
forget = (sys.argv[2], sys.argv[3])
2016-07-14 02:38:08 +02:00
print('Known Networks:')
for path, interfaces in manager.GetManagedObjects().items():
if 'net.connman.iwd.KnownNetwork' not in interfaces:
continue
network = interfaces['net.connman.iwd.KnownNetwork']
if (network['Name'], network['Type']) == forget:
obj = dbus.Interface(bus.get_object('net.connman.iwd', path),
'net.connman.iwd.KnownNetwork')
obj.Forget()
continue
2016-07-14 02:38:08 +02:00
print("[ %s ]" % network['Name'])
for key in network:
val = network[key]
if type(val) == dbus.Boolean:
val = 'True' if val else 'False'
2016-07-14 02:38:08 +02:00
print(" %s = %s" % (key, val))