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 def print_properties(key, value):
32 interface = "org.moblin.connman.Profile"
33 elif key == "Devices":
34 interface = "org.moblin.connman.Device"
35 elif key in ["Services", "Providers"]:
36 interface = "org.moblin.connman.Service"
37 elif key == "Technologies":
38 interface = "org.moblin.connman.Technology"
45 obj = dbus.Interface(bus.get_object("org.moblin.connman", path),
48 properties = obj.GetProperties()
50 for key in properties.keys():
51 if key in ["Devices", "Networks", "Services",
52 "Providers", "Technologies"]:
55 elif key in ["Powered", "Scanning", "Connected",
56 "Available", "Remember", "Default",
57 "Favorite", "Immutable", "AutoConnect",
58 "LoginRequired", "SetupRequired",
59 "PassphraseRequired"]:
60 if properties[key] == dbus.Boolean(1):
65 elif key in ["IPv4", "IPv4.Configuration",
66 "IPv6", "IPv6.Configuration",
67 "Proxy", "Ethernet", "Provider"]:
68 val = extract_values(properties[key])
70 elif key in ["Nameservers", "Nameservers.Configuration",
71 "Domains", "Domains.Configuration"]:
72 val = extract_list(properties[key])
74 elif key in ["Strength", "Priority"]:
75 val = int(properties[key])
77 val = str(properties[key])
79 print " %s = %s" % (key, val)
81 if "Devices" in properties.keys():
83 for path in properties["Devices"]:
85 list = list + val[val.rfind("/") + 1:] + " "
86 print " Devices = [ %s]" % (list)
87 if "Networks" in properties.keys():
89 for path in properties["Networks"]:
91 list = list + val[val.rfind("/") + 1:] + " "
92 print " Networks = [ %s]" % (list)
93 if "Services" in properties.keys():
95 for path in properties["Services"]:
97 list = list + val[val.rfind("/") + 1:] + " "
98 print " Services = [ %s]" % (list)
99 if "Providers" in properties.keys():
101 for path in properties["Providers"]:
103 list = list + val[val.rfind("/") + 1:] + " "
104 print " Providers = [ %s]" % (list)
107 for key in properties.keys():
108 if key in ["Profiles", "Devices", "Services", "Providers",
110 print_properties(key, properties[key])
111 elif key in ["AvailableTechnologies", "EnabledTechnologies",
112 "ConnectedTechnologies",
113 "AvailableDebugs", "EnabledDebugs"]:
116 for val in properties[key]:
117 list = list + val + " "
118 print " [ %s]" % (list)
119 elif key in ["OfflineMode", "Tethering"]:
121 if properties[key] == dbus.Boolean(1):
125 elif key in ["DefaultTechnology"]:
127 if properties[key] == "":
130 print " %s" % (properties[key])
133 print " %s" % (properties[key])