Add some more test scripts for SMS and voice call testing

This commit is contained in:
Marcel Holtmann 2009-09-25 14:04:43 -07:00
parent 6a6213670c
commit 81f2f74dfd
5 changed files with 91 additions and 1 deletions

View File

@ -204,7 +204,8 @@ test_files = test/test-manager test/test-modem test/test-voicecall \
test/test-ss-control-cb test/test-ss-control-cf \
test/test-ss-control-cs \
test/monitor-ofono test/list-modems test/enable-modem \
test/list-operators
test/list-operators test/dial-number test/hangup-all \
test/receive-sms test/send-sms
conf_files = src/ofono.conf plugins/modem.conf

20
test/dial-number Executable file
View File

@ -0,0 +1,20 @@
#!/usr/bin/python
import sys
import dbus
bus = dbus.SystemBus()
manager = dbus.Interface(bus.get_object('org.ofono', '/'),
'org.ofono.Manager')
properties = manager.GetProperties()
path = properties["Modems"][0]
manager = dbus.Interface(bus.get_object('org.ofono', path),
'org.ofono.VoiceCallManager')
path = manager.Dial(sys.argv[1], sys.argv[2])
print path

18
test/hangup-all Executable file
View File

@ -0,0 +1,18 @@
#!/usr/bin/python
import sys
import dbus
bus = dbus.SystemBus()
manager = dbus.Interface(bus.get_object('org.ofono', '/'),
'org.ofono.Manager')
properties = manager.GetProperties()
path = properties["Modems"][0]
manager = dbus.Interface(bus.get_object('org.ofono', path),
'org.ofono.VoiceCallManager')
manager.HangupAll()

33
test/receive-sms Executable file
View File

@ -0,0 +1,33 @@
#!/usr/bin/python
import gobject
import dbus
import dbus.mainloop.glib
def incoming_message(message, details, path, interface):
print "%s" % (message)
for key in details:
val = details[key]
print " %s = %s" % (key, val)
if __name__ == '__main__':
dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
bus = dbus.SystemBus()
bus.add_signal_receiver(incoming_message,
bus_name="org.ofono",
signal_name = "ImmediateMessage",
path_keyword="path",
interface_keyword="interface")
bus.add_signal_receiver(incoming_message,
bus_name="org.ofono",
signal_name = "IncomingMessage",
path_keyword="path",
interface_keyword="interface")
mainloop = gobject.MainLoop()
mainloop.run()

18
test/send-sms Executable file
View File

@ -0,0 +1,18 @@
#!/usr/bin/python
import sys
import dbus
bus = dbus.SystemBus()
manager = dbus.Interface(bus.get_object('org.ofono', '/'),
'org.ofono.Manager')
properties = manager.GetProperties()
path = properties["Modems"][0]
manager = dbus.Interface(bus.get_object('org.ofono', path),
'org.ofono.SmsManager')
manager.SendMessage([ sys.argv[1] ], sys.argv[2])