Add extra test script for listing services
authorMarcel Holtmann <marcel@holtmann.org>
Tue, 19 May 2009 04:27:13 +0000 (21:27 -0700)
committerMarcel Holtmann <marcel@holtmann.org>
Tue, 19 May 2009 04:27:13 +0000 (21:27 -0700)
test/Makefile.am
test/list-services [new file with mode: 0755]

index 85e8977..a4ec186 100644 (file)
@@ -1,5 +1,6 @@
 
-EXTRA_DIST = get-state list-profiles list-connections select-connection \
+EXTRA_DIST = get-state list-profiles list-services \
+               list-connections select-connection \
                list-devices enable-device disable-device start-scanning \
                list-networks select-network disable-network create-network \
                set-passphrase set-address set-policy set-priority \
diff --git a/test/list-services b/test/list-services
new file mode 100755 (executable)
index 0000000..522e122
--- /dev/null
@@ -0,0 +1,27 @@
+#!/usr/bin/python
+
+import dbus
+
+bus = dbus.SystemBus()
+
+manager = dbus.Interface(bus.get_object("org.moblin.connman", "/"),
+                                       "org.moblin.connman.Manager")
+
+properties = manager.GetProperties()
+
+for path in properties["Services"]:
+       service = dbus.Interface(bus.get_object("org.moblin.connman", path),
+                                               "org.moblin.connman.Service")
+
+       properties = service.GetProperties()
+
+       print "[ %s ]" % (path)
+
+       for key in properties.keys():
+               if key in ["Strength"]:
+                       val = int(properties[key])
+               else:
+                       val = str(properties[key])
+               print "    %s = %s" % (key, val)
+
+       print