diff options
-rwxr-xr-x | test/test-manager | 28 | ||||
-rwxr-xr-x | test/test-modem | 42 | ||||
-rwxr-xr-x | test/test-voicecall | 73 |
3 files changed, 143 insertions, 0 deletions
diff --git a/test/test-manager b/test/test-manager new file mode 100755 index 00000000..fb5b91b5 --- /dev/null +++ b/test/test-manager @@ -0,0 +1,28 @@ +#!/usr/bin/python + +import gobject + +import dbus +import dbus.mainloop.glib + +def property_changed(property, value): + print "Manager property %s changed to %s" % (name, value) + +if __name__ == "__main__": + dbus.mainloop.glib.DBusGMainLoop(set_as_default=True) + + bus = dbus.SystemBus() + + manager = dbus.Interface(bus.get_object('org.ofono', '/'), + 'org.ofono.Manager') + + manager.connect_to_signal("PropertyChanged", property_changed) + + try: + properties = manager.GetProperties() + print properties['Modems'] + except dbus.DBusException, e: + print "Unable to call GetProperties %s" % e + + mainloop = gobject.MainLoop() + mainloop.run() diff --git a/test/test-modem b/test/test-modem new file mode 100755 index 00000000..df69eb1d --- /dev/null +++ b/test/test-modem @@ -0,0 +1,42 @@ +#!/usr/bin/python + +import gobject + +import dbus +import dbus.mainloop.glib + +def property_changed(name, value): + print "Modem property %s changed to %s" % (name, value) + +if __name__ == "__main__": + 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 + + modem = dbus.Interface(bus.get_object('org.ofono', modems[0]), + 'org.ofono.Modem') + + modem.connect_to_signal("PropertyChanged", property_changed) + + properties = modem.GetProperties() + + if properties.has_key('Manufacturer'): + print "Manufacturer: %s" % (properties['Manufacturer']) + + if properties.has_key('Model'): + print "Model: %s" % (properties['Model']) + + if properties.has_key('Revision'): + print "Revision: %s" % (properties['Revision']) + + if properties.has_key('Serial'): + print "Serial: %s" % (properties['Serial']) + + mainloop = gobject.MainLoop() + mainloop.run() 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() |