Update test script to decode Proxy entries
[framework/connectivity/connman.git] / test / list-services
1 #!/usr/bin/python
2
3 import dbus
4
5 def extract_values(values):
6         val = "{"
7         for key in values.keys():
8                 val += " " + key + "="
9                 val += str(values[key])
10         val += " }"
11         return val
12
13 bus = dbus.SystemBus()
14
15 manager = dbus.Interface(bus.get_object("org.moblin.connman", "/"),
16                                         "org.moblin.connman.Manager")
17
18 properties = manager.GetProperties()
19
20 for path in properties["Services"]:
21         service = dbus.Interface(bus.get_object("org.moblin.connman", path),
22                                                 "org.moblin.connman.Service")
23
24         properties = service.GetProperties()
25
26         print "[ %s ]" % (path)
27
28         for key in properties.keys():
29                 if key in ["IPv4", "IPv4.Configuration", "Proxy", "Ethernet"]:
30                         val = extract_values(properties[key])
31                 elif key in ["Favorite", "Immutable", "AutoConnect",
32                                 "SetupRequired", "PassphraseRequired"]:
33                         if properties[key] == dbus.Boolean(1):
34                                 val = "true"
35                         else:
36                                 val = "false"
37                 elif key in ["Strength"]:
38                         val = int(properties[key])
39                 else:
40                         val = str(properties[key])
41                 print "    %s = %s" % (key, val)
42
43         print