summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDenis Kenzior <denkenz@gmail.com>2009-05-21 16:21:15 -0500
committerDenis Kenzior <denkenz@gmail.com>2009-05-21 17:06:29 -0500
commit7de8e45f8a745891e04f611077b0d5b1594e8c60 (patch)
tree8a21b469e65f3ec554d5311c2e738729347b0be6
parent3016d0859dbf9b2340f488d4e3c61e7768fc7eed (diff)
downloadofono-7de8e45f8a745891e04f611077b0d5b1594e8c60.tar.bz2
Add more basic test scripts
-rwxr-xr-xtest/test-manager28
-rwxr-xr-xtest/test-modem42
-rwxr-xr-xtest/test-voicecall73
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()