Skip to contentSkip to conversation

test: Update with RequestQuickDigit API

PATCH In review Philippe Nunes 2 participants 4 messages Sep 6, 2012 – Sep 12, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 test: Update with RequestQuickDigit API

---
 test/test-stk-menu |   14 ++++++++++++++
 1 file changed, 14 insertions(+)
test/test-stk-menu +14 -0
index a9f92e8..6e7f7b7 100755
@@ -127,6 +127,20 @@ class StkAgent(dbus.service.Object):
 			return key
 
 	@dbus.service.method("org.ofono.SimToolkitAgent",
+				in_signature="sy", out_signature="s")
+	def RequestQuickDigit(self, title, icon):
+		print "Title: (%s)" % (title)
+		print "Icon: (%d)" % (icon)
+		key = raw_input("Quick digit (0-9, *, #, t, b):")
+
+		if key == 'b':
+			raise GoBack("User wishes to go back");
+		elif key == 't':
+			raise EndSession("User wishes to terminate session");
+		else:
+			return key
+
+	@dbus.service.method("org.ofono.SimToolkitAgent",
 				in_signature="sy", out_signature="b")
 	def RequestConfirmation(self, title, icon):
 		print "Title: (%s)" % (title)
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 2/3 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.

---
 test/test-stk-menu |   18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
test/test-stk-menu +18 -0
index 6e7f7b7..f4553d1 100755
@@ -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):
Signature · 1 line
1.7.9.5
#2 lore raw

PATCH 3/3 test: iconId value is not a printable character

In reply to Philippe Nunes
---
 test/list-calls |    9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
test/list-calls +5 -4
index 53124dc..2332b50 100755
@@ -24,7 +24,8 @@ for path, properties in modems:
 		print "    [ %s ]" % (path)
 
 		for key in properties.keys():
-			val = str(properties[key])
-			print "        %s = %s" % (key, val)
-
-		print
+			if key == 'Icon':
+				print "        %s = %d" % (key, properties[key])
+			else:
+				val = str(properties[key])
+				print "        %s = %s" % (key, val)
Signature · 1 line
1.7.9.5
#3 lore raw
In reply to Philippe Nunes

Hi Philippe,

Quoted 4 lines · Philippe Nunes
---
  test/test-stk-menu |   14 ++++++++++++++
  1 file changed, 14 insertions(+)

All three patches have been applied, thanks.

Regards,
-Denis