summaryrefslogtreecommitdiffstats
path: root/test/list-modems
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2009-09-02 03:35:09 -0700
committerMarcel Holtmann <marcel@holtmann.org>2009-09-02 03:35:09 -0700
commit57dce83f0f7d0707eff196d853f6b6284b9335f6 (patch)
treea9da8acc4bfc79bb3a07c25886fab5ffddb1e45e /test/list-modems
parent9deaa6e70f62aaa71e3b72f4c4967e30dac8d204 (diff)
downloadofono-57dce83f0f7d0707eff196d853f6b6284b9335f6.tar.bz2
Add two extra test programs for modem interface
Diffstat (limited to 'test/list-modems')
-rwxr-xr-xtest/list-modems46
1 files changed, 46 insertions, 0 deletions
diff --git a/test/list-modems b/test/list-modems
new file mode 100755
index 00000000..597614be
--- /dev/null
+++ b/test/list-modems
@@ -0,0 +1,46 @@
+#!/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)
+
+ for key in properties.keys():
+ if key in ["Interfaces"]:
+ val = ""
+ for i in properties[key]:
+ val += i + " "
+ else:
+ val = str(properties[key])
+ print " %s = %s" % (key, val)
+
+ for interface in properties["Interfaces"]:
+ object = dbus.Interface(bus.get_object('org.ofono', path),
+ interface)
+
+ properties = object.GetProperties()
+
+ print " [ %s ]" % (interface)
+
+ for key in properties.keys():
+ if key in ["AvailableOperators"]:
+ val = ""
+ for i in properties[key]:
+ val += i + " "
+ else:
+ val = str(properties[key])
+ print " %s = %s" % (key, val)
+
+ print