diff options
author | Denis Kenzior <denkenz@gmail.com> | 2009-05-21 16:21:15 -0500 |
---|---|---|
committer | Denis Kenzior <denkenz@gmail.com> | 2009-05-21 17:06:29 -0500 |
commit | 7de8e45f8a745891e04f611077b0d5b1594e8c60 (patch) | |
tree | 8a21b469e65f3ec554d5311c2e738729347b0be6 /test/test-voicecall | |
parent | 3016d0859dbf9b2340f488d4e3c61e7768fc7eed (diff) | |
download | ofono-7de8e45f8a745891e04f611077b0d5b1594e8c60.tar.bz2 |
Add more basic test scripts
Diffstat (limited to 'test/test-voicecall')
-rwxr-xr-x | test/test-voicecall | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/test/test-voicecall b/test/test-voicecall new file mode 100755 index 00000000..2c43058e --- /dev/null +++ b/test/test-voicecall @@ -0,0 +1,73 @@ +#!/usr/bin/python + +import gobject + +import dbus +import dbus.mainloop.glib + +def print_calls(value): + for p in value: + call = dbus.Interface(bus.get_object('org.ofono', p), + 'org.ofono.VoiceCall') + properties = call.GetProperties() + status = properties['State'] + lineid = properties['LineIdentification'] + + print "Call %s, Status: %s, LineId: %s" %\ + (p, status, lineid) + +def voicecalls_property_changed(name, value): + if name == 'Calls': + print "Call list modification>" + if len(value) == 0: + print "No calls in systems" + else: + print_calls(value) + else: + print "VoiceCallManager property: '%s' changed to '%s'" %\ + (name, value) + +def voicecall_property_changed(name, value): + print "Voicecall property: '%s' changed to '%s'" % (name, value) + +if __name__ == "__main__": + global vcmanager + + 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'] + print modems + + vcmanager = dbus.Interface(bus.get_object('org.ofono', modems[0]), + 'org.ofono.VoiceCallManager') + + vcmanager.connect_to_signal("PropertyChanged", + voicecalls_property_changed) + + properties = vcmanager.GetProperties() + + print properties['Calls'] + + voicecalls_property_changed('Calls', properties['Calls']) + + print "Dialing...." + obj = vcmanager.Dial("444555", "enabled") + print "Dialing in progress, got obj: %s" % (obj) + + call = dbus.Interface(bus.get_object('org.ofono', obj), + 'org.ofono.VoiceCall') + + properties = call.GetProperties() + + print "State: %s, Number: %s" %\ + (properties['State'], properties['LineIdentification']) + + call.connect_to_signal("PropertyChanged", voicecall_property_changed) + + mainloop = gobject.MainLoop() + mainloop.run() |