summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2010-05-13 17:09:08 +0200
committerMarcel Holtmann <marcel@holtmann.org>2010-05-13 17:09:08 +0200
commitc497487e10e78b9ff4fe74baa4d10ac80a31f399 (patch)
tree27e488fe537dfd0ad084ff04553dcd0657b7c1c3 /test
parent83a6632160cc24de958206623264772e532b254a (diff)
downloadconnman-c497487e10e78b9ff4fe74baa4d10ac80a31f399.tar.gz
connman-c497487e10e78b9ff4fe74baa4d10ac80a31f399.tar.bz2
connman-c497487e10e78b9ff4fe74baa4d10ac80a31f399.zip
Add method to retrieve sorted list of tuples for services
Diffstat (limited to 'test')
-rwxr-xr-xtest/get-services51
1 files changed, 51 insertions, 0 deletions
diff --git a/test/get-services b/test/get-services
new file mode 100755
index 00000000..1afebc59
--- /dev/null
+++ b/test/get-services
@@ -0,0 +1,51 @@
+#!/usr/bin/python
+
+import dbus
+
+def extract_values(values):
+ val = "{"
+ for key in values.keys():
+ val += " " + key + "="
+ val += str(values[key])
+ val += " }"
+ return val
+
+def extract_list(list):
+ val = "["
+ for i in list:
+ val += " " + str(i)
+ val += " ]"
+ return val
+
+bus = dbus.SystemBus()
+
+manager = dbus.Interface(bus.get_object('org.moblin.connman', '/'),
+ 'org.moblin.connman.Manager')
+
+services = manager.GetServices()
+
+for entry in services:
+ path = entry[0]
+ properties = entry[1]
+
+ print "[ %s ]" % (path)
+
+ for key in properties.keys():
+ if key in ["IPv4", "IPv4.Configuration", "Proxy", "Ethernet"]:
+ val = extract_values(properties[key])
+ elif key in ["Nameservers", "Nameservers.Configuration",
+ "Domains", "Domains.Configuration"]:
+ val = extract_list(properties[key])
+ elif key in ["Favorite", "Immutable", "AutoConnect",
+ "SetupRequired", "PassphraseRequired"]:
+ if properties[key] == dbus.Boolean(1):
+ val = "true"
+ else:
+ val = "false"
+ elif key in ["Strength"]:
+ val = int(properties[key])
+ else:
+ val = str(properties[key])
+ print " %s = %s" % (key, val)
+
+ print