5 def extract_values(values):
7 for key in values.keys():
9 if key in ["PrefixLength"]:
10 val += "%s" % (int(values[key]))
12 val += str(values[key])
16 def extract_list(list):
23 bus = dbus.SystemBus()
25 manager = dbus.Interface(bus.get_object("org.moblin.connman", "/"),
26 "org.moblin.connman.Manager")
28 properties = manager.GetProperties()
30 for path in properties["Providers"]:
31 service = dbus.Interface(bus.get_object("org.moblin.connman", path),
32 "org.moblin.connman.Service")
34 properties = service.GetProperties()
36 print "[ %s ]" % (path)
38 for key in properties.keys():
39 if key in ["IPv4", "IPv4.Configuration",
40 "IPv6", "IPv6.Configuration",
41 "Proxy", "Ethernet", "Provider"]:
42 val = extract_values(properties[key])
43 elif key in ["Nameservers", "Nameservers.Configuration",
44 "Domains", "Domains.Configuration"]:
45 val = extract_list(properties[key])
46 elif key in ["Favorite", "Immutable", "AutoConnect",
47 "LoginRequired", "SetupRequired",
48 "PassphraseRequired"]:
49 if properties[key] == dbus.Boolean(1):
53 elif key in ["Strength"]:
54 val = int(properties[key])
57 print " %s = %s" % (key, val)