summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2009-10-25 00:49:08 +0900
committerMarcel Holtmann <marcel@holtmann.org>2009-10-25 00:49:08 +0900
commit0516900c72f29172418fea04ca77159cea0c1d57 (patch)
tree0faccdf05da8dbb1288f5727ee6a2bc584540241
parent8864778c02e25f41df338c71db693bad1bca7154 (diff)
downloadofono-0516900c72f29172418fea04ca77159cea0c1d57.tar.bz2
Add test script for showing primary data contexts
-rw-r--r--Makefile.am2
-rwxr-xr-xtest/list-contexts40
2 files changed, 41 insertions, 1 deletions
diff --git a/Makefile.am b/Makefile.am
index 4c159d91..821150c7 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -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
index 00000000..09dbff8e
--- /dev/null
+++ b/test/list-contexts
@@ -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