summaryrefslogtreecommitdiffstats
path: root/test/list-contexts
diff options
context:
space:
mode:
Diffstat (limited to 'test/list-contexts')
-rwxr-xr-xtest/list-contexts40
1 files changed, 40 insertions, 0 deletions
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