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("org.moblin.connman", "/"),
29 "org.moblin.connman.Manager")
31 properties = manager.GetProperties()
33 def print_properties(key, value):
35 interface = "org.moblin.connman.Profile"
36 elif key == "Devices":
37 interface = "org.moblin.connman.Device"
38 elif key in ["Services", "Providers"]:
39 interface = "org.moblin.connman.Service"
40 elif key == "Technologies":
41 interface = "org.moblin.connman.Technology"
48 obj = dbus.Interface(bus.get_object("org.moblin.connman", path),
51 properties = obj.GetProperties()
53 for key in properties.keys():
54 if key in ["Devices", "Networks", "Services",
55 "Providers", "Technologies"]:
58 elif key in ["Powered", "Scanning", "Connected",
59 "Available", "Remember", "Default",
60 "Favorite", "Immutable", "AutoConnect",
61 "LoginRequired", "SetupRequired",
62 "PassphraseRequired"]:
63 if properties[key] == dbus.Boolean(1):
68 elif key in ["IPv4", "IPv4.Configuration",
69 "IPv6", "IPv6.Configuration",
70 "Proxy", "Proxy.Configuration",
71 "Ethernet", "Provider"]:
72 val = extract_values(properties[key])
74 elif key in ["Nameservers", "Nameservers.Configuration",
75 "Domains", "Domains.Configuration"]:
76 val = extract_list(properties[key])
78 elif key in ["Strength", "Priority"]:
79 val = int(properties[key])
81 val = str(properties[key])
83 print " %s = %s" % (key, val)
85 if "Devices" in properties.keys():
87 for path in properties["Devices"]:
89 list = list + val[val.rfind("/") + 1:] + " "
90 print " Devices = [ %s]" % (list)
91 if "Networks" in properties.keys():
93 for path in properties["Networks"]:
95 list = list + val[val.rfind("/") + 1:] + " "
96 print " Networks = [ %s]" % (list)
97 if "Services" in properties.keys():
99 for path in properties["Services"]:
101 list = list + val[val.rfind("/") + 1:] + " "
102 print " Services = [ %s]" % (list)
103 if "Providers" in properties.keys():
105 for path in properties["Providers"]:
107 list = list + val[val.rfind("/") + 1:] + " "
108 print " Providers = [ %s]" % (list)
111 for key in properties.keys():
112 if key in ["Profiles", "Devices", "Services", "Providers",
114 print_properties(key, properties[key])
115 elif key in ["AvailableTechnologies", "EnabledTechnologies",
116 "ConnectedTechnologies",
117 "AvailableDebugs", "EnabledDebugs"]:
120 for val in properties[key]:
121 list = list + val + " "
122 print " [ %s]" % (list)
123 elif key in ["OfflineMode", "Tethering"]:
125 if properties[key] == dbus.Boolean(1):
129 elif key in ["DefaultTechnology"]:
131 if properties[key] == "":
134 print " %s" % (properties[key])
137 print " %s" % (properties[key])