diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2010-05-13 17:09:08 +0200 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2010-05-13 17:09:08 +0200 |
commit | c497487e10e78b9ff4fe74baa4d10ac80a31f399 (patch) | |
tree | 27e488fe537dfd0ad084ff04553dcd0657b7c1c3 /test | |
parent | 83a6632160cc24de958206623264772e532b254a (diff) | |
download | connman-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-x | test/get-services | 51 |
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 |