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 def print_properties(key, value):
35 interface = "net.connman.Profile"
36 elif key == "Services":
37 interface = "net.connman.Service"
44 obj = dbus.Interface(bus.get_object("net.connman", path),
47 properties = obj.GetProperties()
49 for key in properties.keys():
50 if key in ["Services"]:
53 elif key in ["Available", "Remember", "Default",
54 "Favorite", "Immutable", "AutoConnect",
56 "PassphraseRequired"]:
57 if properties[key] == dbus.Boolean(1):
62 elif key in ["IPv4", "IPv4.Configuration",
63 "IPv6", "IPv6.Configuration",
64 "Proxy", "Proxy.Configuration",
65 "Ethernet", "Provider"]:
66 val = extract_values(properties[key])
68 elif key in ["Nameservers", "Nameservers.Configuration",
69 "Domains", "Domains.Configuration",
71 val = extract_list(properties[key])
73 elif key in ["Strength", "Priority"]:
74 val = int(properties[key])
77 val = str(properties[key])
79 print " %s = %s" % (key, val)
81 if "Services" in properties.keys():
83 for path in properties["Services"]:
85 list = list + val[val.rfind("/") + 1:] + " "
86 print " Services = [ %s]" % (list)
89 for key in properties.keys():
90 if key in ["Profiles", "Services"]:
91 print_properties(key, properties[key])
92 elif key in ["AvailableDebugs", "EnabledDebugs"]:
95 for val in properties[key]:
96 list = list + val + " "
97 print " [ %s]" % (list)
98 elif key in ["OfflineMode"]:
100 if properties[key] == dbus.Boolean(1):
106 print " %s" % (properties[key])
109 print ("Technologies")
110 technologies = manager.GetTechnologies()
112 for (path, properties) in technologies:
114 for key in properties.keys():
116 if key in ["Connected", "Powered", "Tethering"]:
117 if properties[key] == dbus.Boolean(1):
122 val = properties[key]
124 print " %s = %s" % (key, val)