diff options
author | Denis Kenzior <denkenz@gmail.com> | 2009-05-28 13:51:41 -0500 |
---|---|---|
committer | Denis Kenzior <denkenz@gmail.com> | 2009-05-28 18:28:46 -0500 |
commit | 7a7e1af8337bba777ab7b7086dac5106b67c334e (patch) | |
tree | 5b84e25d317e10d25db07146b7483c765f773b04 /test/test-call-settings | |
parent | 699752eaf15c97e8ea53cfd24dd0e19549ffd712 (diff) |
Add simple test for CallSettings interface
Diffstat (limited to 'test/test-call-settings')
-rwxr-xr-x | test/test-call-settings | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/test/test-call-settings b/test/test-call-settings new file mode 100755 index 00000000..c0894781 --- /dev/null +++ b/test/test-call-settings @@ -0,0 +1,69 @@ +#!/usr/bin/python + +import gobject + +import dbus +import dbus.mainloop.glib +import sys + +def test_exit(): + mainloop.quit() + +def property_changed(name, value): + print "CallSettings property: '%s' changed to '%s'" % (name, value) + + if canexit: + mainloop.quit(); + +if __name__ == "__main__": + if (len(sys.argv) < 3): + print "Useage: %s <property> <newvalue>" % (sys.argv[0]) + print "Properties can be: VoiceCallWaiting, HideCallerId" + sys.exit(1) + + canexit = False + + property = sys.argv[1] + newvalue = sys.argv[2] + + dbus.mainloop.glib.DBusGMainLoop(set_as_default=True) + + bus = dbus.SystemBus() + + manager = dbus.Interface(bus.get_object('org.ofono', '/'), + 'org.ofono.Manager') + + modems = manager.GetProperties()['Modems'] + + cs = dbus.Interface(bus.get_object('org.ofono', modems[0]), + 'org.ofono.CallSettings') + + cs.connect_to_signal("PropertyChanged", property_changed) + + properties = cs.GetProperties() + + print "Current Property values:" + print "Network Status of Call Waiting - Voice: %s" %\ + (properties['VoiceCallWaiting']) + print "Network Status of Called Line Restriction: %s" %\ + (properties['CalledLineRestriction']) + print "Network Status of Calling Line Restriction: %s" %\ + (properties['CallingLineRestriction']) + print "Network Status of Calling Line Presentation: %s" %\ + (properties['CallingLinePresentation']) + print "Network Status of Called Line Presentation: %s" %\ + (properties['CalledLinePresentation']) + print "Hide my Caller Id: %s" % (properties['HideCallerId']) + + try: + cs.SetProperty(property, newvalue) + except dbus.DBusException, e: + print "Unable to set property: ", e + sys.exit(1); + + print "Setting successful" + + canexit = True + + mainloop = gobject.MainLoop() + mainloop.run() |