5 def extract_values(values):
7 for key in values.keys():
9 if key in ["PrefixLength"]:
10 val += "%s" % (int(values[key]))
12 if key in ["Servers", "Excludes"]:
13 val += extract_list(values[key])
15 val += str(values[key])
19 def extract_list(list):
26 bus = dbus.SystemBus()
28 manager = dbus.Interface(bus.get_object("net.connman", "/"),
29 "net.connman.Manager")
31 properties = manager.GetProperties()
33 for key in properties.keys():
34 if key in ["AvailableDebugs", "EnabledDebugs"]:
37 for val in properties[key]:
38 list = list + val + " "
39 print " [ %s]" % (list)
40 elif key in ["OfflineMode", "SessionMode"]:
42 if properties[key] == dbus.Boolean(1):
48 print " %s" % (properties[key])
51 services = manager.GetServices()
53 for (path, properties) in services:
55 for key in properties.keys():
56 if key in ["Available", "Remember", "Default",
57 "Favorite", "Immutable", "AutoConnect",
59 "PassphraseRequired"]:
60 if properties[key] == dbus.Boolean(1):
65 elif key in ["IPv4", "IPv4.Configuration",
66 "IPv6", "IPv6.Configuration",
67 "Proxy", "Proxy.Configuration",
68 "Ethernet", "Provider"]:
69 val = extract_values(properties[key])
71 elif key in ["Nameservers", "Nameservers.Configuration",
72 "Domains", "Domains.Configuration",
74 val = extract_list(properties[key])
76 elif key in ["Strength", "Priority"]:
77 val = int(properties[key])
80 val = str(properties[key])
82 print " %s = %s" % (key, val)
84 print ("Technologies")
85 technologies = manager.GetTechnologies()
87 for (path, properties) in technologies:
89 for key in properties.keys():
91 if key in ["Connected", "Powered", "Tethering"]:
92 if properties[key] == dbus.Boolean(1):
99 print " %s = %s" % (key, val)