11726a82127b58b95d8518d102e83e97b6f29161
[connman] / test / list-networks
1 #!/usr/bin/python
2
3 import dbus
4
5 bus = dbus.SystemBus()
6
7 manager = dbus.Interface(bus.get_object("org.moblin.connman", "/"),
8                                         "org.moblin.connman.Manager")
9
10 elements = manager.ListElements()
11
12 for path in elements:
13         element = dbus.Interface(bus.get_object("org.moblin.connman", path),
14                                                 "org.moblin.connman.Element")
15
16         properties = element.GetProperties()
17
18         if (properties["Type"] == "device"):
19                 print "[ %s ]" % (path)
20
21         if (properties["Type"] == "network"):
22                 if (properties["Enabled"] == 1):
23                         state = "*"
24                 else:
25                         state = " "
26                 print "    %s %s" % (state, properties["WiFi.Name"])