mirror of git://git.sysmocom.de/ofono
test: playtone waits for single tone playback
To simulate the single tone playback (avoiding the stkagent method to return immediately), a timeout is started (5 seconds). During this time, the user can terminate the session.
This commit is contained in:
parent
5fa986eaab
commit
e0e037539a
|
@ -6,6 +6,10 @@ import sys
|
||||||
import dbus
|
import dbus
|
||||||
import dbus.service
|
import dbus.service
|
||||||
import dbus.mainloop.glib
|
import dbus.mainloop.glib
|
||||||
|
import signal
|
||||||
|
|
||||||
|
def handler(signum, frame):
|
||||||
|
raise Exception("\nSingle tone is finished!")
|
||||||
|
|
||||||
class GoBack(dbus.DBusException):
|
class GoBack(dbus.DBusException):
|
||||||
_dbus_error_name = "org.ofono.Error.GoBack"
|
_dbus_error_name = "org.ofono.Error.GoBack"
|
||||||
|
@ -195,6 +199,20 @@ class StkAgent(dbus.service.Object):
|
||||||
print "Text: %s" % (text)
|
print "Text: %s" % (text)
|
||||||
print "Icon: %d" % (icon)
|
print "Icon: %d" % (icon)
|
||||||
|
|
||||||
|
signal.signal(signal.SIGALRM, handler)
|
||||||
|
signal.alarm(5)
|
||||||
|
|
||||||
|
try:
|
||||||
|
key = raw_input("Press return to end before end of"
|
||||||
|
" single tone (t):")
|
||||||
|
signal.alarm(0)
|
||||||
|
|
||||||
|
if key == 't':
|
||||||
|
raise EndSession("User wishes to terminate"
|
||||||
|
" session");
|
||||||
|
except Exception, exc:
|
||||||
|
print exc
|
||||||
|
|
||||||
@dbus.service.method("org.ofono.SimToolkitAgent",
|
@dbus.service.method("org.ofono.SimToolkitAgent",
|
||||||
in_signature="ssy", out_signature="")
|
in_signature="ssy", out_signature="")
|
||||||
def LoopTone(self, tone, text, icon):
|
def LoopTone(self, tone, text, icon):
|
||||||
|
|
Loading…
Reference in New Issue