Add test script for showing primary data contexts
authorMarcel Holtmann <marcel@holtmann.org>
Sat, 24 Oct 2009 15:49:08 +0000 (00:49 +0900)
committerMarcel Holtmann <marcel@holtmann.org>
Sat, 24 Oct 2009 15:49:08 +0000 (00:49 +0900)
Makefile.am
test/list-contexts [new file with mode: 0755]

index 4c159d9..821150c 100644 (file)
@@ -229,7 +229,7 @@ test_files = test/test-manager test/test-modem test/test-voicecall \
                test/test-ss-control-cs \
                test/monitor-ofono test/list-modems test/enable-modem \
                test/list-operators test/dial-number test/hangup-all \
-               test/receive-sms test/send-sms
+               test/receive-sms test/send-sms test/list-contexts
 
 conf_files = src/ofono.conf plugins/modem.conf
 
diff --git a/test/list-contexts b/test/list-contexts
new file mode 100755 (executable)
index 0000000..09dbff8
--- /dev/null
@@ -0,0 +1,40 @@
+#!/usr/bin/python
+
+import dbus
+
+bus = dbus.SystemBus()
+
+manager = dbus.Interface(bus.get_object('org.ofono', '/'),
+                                               'org.ofono.Manager')
+
+properties = manager.GetProperties()
+
+for path in properties["Modems"]:
+       modem = dbus.Interface(bus.get_object('org.ofono', path),
+                                                       'org.ofono.Modem')
+
+       properties = modem.GetProperties()
+
+       print "[ %s ]" % (path)
+
+       if "org.ofono.DataConnectionManager" not in properties["Interfaces"]:
+               continue
+
+       netreg = dbus.Interface(bus.get_object('org.ofono', path),
+                                       'org.ofono.DataConnectionManager')
+
+       properties = netreg.GetProperties()
+
+       for path in properties["PrimaryContexts"]:
+               context = dbus.Interface(bus.get_object('org.ofono', path),
+                                       'org.ofono.PrimaryDataContext')
+
+               properties = context.GetProperties()
+
+               print "    [ %s ]" % (path)
+
+               for key in properties.keys():
+                       val = str(properties[key])
+                       print "        %s = %s" % (key, val)
+       
+               print