From: Philippe Nunes <philippe.nunes@linux.intel.com>
To: ofono@ofono.org
Subject: [PATCH 2/3] test: playtone waits for single tone playback
Date: Thu, 06 Sep 2012 16:38:46 +0200 [thread overview]
Message-ID: <1346942327-4448-2-git-send-email-philippe.nunes@linux.intel.com> (raw)
In-Reply-To: <1346942327-4448-1-git-send-email-philippe.nunes@linux.intel.com>
[-- Attachment #1: Type: text/plain, Size: 1288 bytes --]
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.
---
| 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
--git a/test/test-stk-menu b/test/test-stk-menu
index 6e7f7b7..f4553d1 100755
--- a/test/test-stk-menu
+++ b/test/test-stk-menu
@@ -6,6 +6,10 @@ import sys
import dbus
import dbus.service
import dbus.mainloop.glib
+import signal
+
+def handler(signum, frame):
+ raise Exception("\nSingle tone is finished!")
class GoBack(dbus.DBusException):
_dbus_error_name = "org.ofono.Error.GoBack"
@@ -195,6 +199,20 @@ class StkAgent(dbus.service.Object):
print "Text: %s" % (text)
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",
in_signature="ssy", out_signature="")
def LoopTone(self, tone, text, icon):
--
1.7.9.5
next prev parent reply other threads:[~2012-09-06 14:38 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-06 14:38 [PATCH 1/3] test: Update with RequestQuickDigit API Philippe Nunes
2012-09-06 14:38 ` Philippe Nunes [this message]
2012-09-06 14:38 ` [PATCH 3/3] test: iconId value is not a printable character Philippe Nunes
2012-09-12 4:27 ` [PATCH 1/3] test: Update with RequestQuickDigit API Denis Kenzior
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1346942327-4448-2-git-send-email-philippe.nunes@linux.intel.com \
--to=philippe.nunes@linux.intel.com \
--cc=ofono@ofono.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox