* [PATCH] test: add a script for STK conformance tests
@ 2010-12-16 16:04 Lucas, GuillaumeX
2010-12-17 15:32 ` Denis Kenzior
0 siblings, 1 reply; 3+ messages in thread
From: Lucas, GuillaumeX @ 2010-12-16 16:04 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 8192 bytes --]
From: Guillaume Lucas <guillaumex.lucas@intel.com>
To be able to run STK conformance tests at ofono
level, we need to have a STK agent registered. The
test-stk-conformance script provided here do that.
This script is for conformance so all the data input
of the agent are displayed to be able to check them.
The existing test-stk-menu is usable only when there
is a STK menu provided by the (U)SIM card.
---
test/test-stk-conformance | 226 +++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 226 insertions(+), 0 deletions(-)
create mode 100755 test/test-stk-conformance
diff --git a/test/test-stk-conformance b/test/test-stk-conformance
new file mode 100755
index 0000000..bb28e40
--- /dev/null
+++ b/test/test-stk-conformance
@@ -0,0 +1,226 @@
+#!/usr/bin/python
+
+import gobject
+
+import sys
+import dbus
+import dbus.service
+import dbus.mainloop.glib
+import os
+
+class GoBack(dbus.DBusException):
+ _dbus_error_name = "org.ofono.Error.GoBack"
+
+class EndSession(dbus.DBusException):
+ _dbus_error_name = "org.ofono.Error.EndSession"
+
+class Busy(dbus.DBusException):
+ _dbus_error_name = "org.ofono.Error.Busy"
+
+class StkAgent(dbus.service.Object):
+ exit_on_release = True
+
+ def set_exit_on_release(self, exit_on_release):
+ self.exit_on_release = exit_on_release
+
+ @dbus.service.method("org.ofono.SimToolkitAgent",
+ in_signature="", out_signature="")
+ def Release(self):
+ print "Release"
+ if self.exit_on_release:
+ mainloop.quit()
+
+ @dbus.service.method("org.ofono.SimToolkitAgent",
+ in_signature="sya(sy)n", out_signature="y")
+ def RequestSelection(self, title, icon, items, default):
+ print "Title: (%s)" % (title)
+ print "Icon: (%d)" % (icon)
+ index = 0;
+ for item in items:
+ print "%d. %s (icon: %d)" % (index, item[0], item[1])
+ index += 1
+
+ print "\nDefault: %d" % (default)
+ select = raw_input("Enter Selection (t, b):")
+
+ if select == 'b':
+ raise GoBack("User wishes to go back")
+ elif select == 't':
+ raise EndSession("User wishes to terminate session")
+ else:
+ return int(select);
+
+ @dbus.service.method("org.ofono.SimToolkitAgent",
+ in_signature="syb", out_signature="")
+ def DisplayText(self, title, icon, urgent):
+ print "DisplayText (%s)" % (title)
+ print "Icon: (%d)" % (icon)
+ print "Urgent: (%d)" % (urgent)
+ userin = raw_input("Press return to clear ('t' terminates, "
+ "'b' goest back, 'n' busy):")
+
+ if userin == 'b':
+ raise GoBack("User wishes to go back")
+ elif userin == 't':
+ raise EndSession("User wishes to terminate session")
+ elif userin == 'n':
+ raise Busy("User wishes to simulate busy screen")
+
+ @dbus.service.method("org.ofono.SimToolkitAgent",
+ in_signature="sysyyb", out_signature="s")
+ def RequestInput(self, title, icon, default, min_chars, max_chars,
+ hide_typing):
+ print "Title: (%s)" % (title)
+ print "Icon: (%d)" % (icon)
+ print "Default: (%s)" % (default)
+ print "Hide typing: (%s)" % (hide_typing)
+ print "Enter characters, min: %d, max: %d:" % (min_chars,
+ max_chars)
+ userin = raw_input("")
+
+ return userin
+
+ @dbus.service.method("org.ofono.SimToolkitAgent",
+ in_signature="sysyyb", out_signature="s")
+ def RequestDigits(self, title, icon, default, min_chars, max_chars,
+ hide_typing):
+ print "Title: (%s)" % (title)
+ print "Icon: (%d)" % (icon)
+ print "Default: (%s)" % (default)
+ print "Hide typing: (%s)" % (hide_typing)
+ print "Enter digits, min: %d, max: %d:" % (min_chars,
+ max_chars)
+ userin = raw_input("'t' terminates, 'b' goes back:");
+
+ if userin == 'b':
+ raise GoBack("User wishes to go back")
+ elif userin == 't':
+ raise EndSession("User wishes to terminate session")
+ else:
+ return userin
+
+ @dbus.service.method("org.ofono.SimToolkitAgent",
+ in_signature="sy", out_signature="s")
+ def RequestKey(self, title, icon):
+ print "Title: (%s)" % (title)
+ print "Icon: (%d)" % (icon)
+ key = raw_input("Enter Key (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="s")
+ def RequestDigit(self, title, icon):
+ print "Title: (%s)" % (title)
+ print "Icon: (%d)" % (icon)
+ key = raw_input("Enter Digit (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)
+ print "Icon: (%d)" % (icon)
+ key = raw_input("Enter Confirmation (t, b, y, n):")
+
+ if key == 'b':
+ raise GoBack("User wishes to go back");
+ elif key == 't':
+ raise EndSession("User wishes to terminate session");
+ elif key == 'y':
+ return True
+ else:
+ return False
+
+ @dbus.service.method("org.ofono.SimToolkitAgent",
+ in_signature="sy", out_signature="b")
+ def ConfirmCallSetup(self, info, icon):
+ print "Information: (%s)" % (info)
+ print "Icon: (%d)" % (icon)
+ key = raw_input("Enter Confirmation (t, y, n):")
+
+ if key == 't':
+ raise EndSession("User wishes to terminate session");
+ elif key == 'y':
+ return True
+ else:
+ return False
+
+ @dbus.service.method("org.ofono.SimToolkitAgent",
+ in_signature="ssy", out_signature="")
+ def PlayTone(self, tone, title, icon):
+ print "PlayTone: (%s, %s, %d)" % (tone, title, icon)
+ userin = raw_input("Press enter to end playing (t):")
+
+ if userin == 't':
+ raise EndSession("User wishes to terminate session")
+
+ @dbus.service.method("org.ofono.SimToolkitAgent",
+ in_signature="ssy", out_signature="")
+ def LoopTone(self, tone, title, icon):
+ print "LoopTone: (%s, %s, %d)" % (tone, title, icon)
+ userin = raw_input("Press enter to end playing (t):")
+
+ if userin == 't':
+ raise EndSession("User wishes to terminate session")
+
+ @dbus.service.method("org.ofono.SimToolkitAgent",
+ in_signature="", out_signature="")
+ def Cancel(self):
+ print "Cancel"
+
+def property_changed(name, value):
+ print "SimToolkit property: '%s' changed to '%s'" % (name, value)
+
+def stdin_handler(fd, condition):
+ s = os.read(fd.fileno(), 160).rstrip()
+
+ if s == 't':
+ stk.UnregisterAgent(path)
+ mainloop.quit()
+
+ return True
+
+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.GetModems()
+
+ for path, properties in modems:
+ if "org.ofono.SimToolkit" not in properties["Interfaces"]:
+ continue
+
+ stk = dbus.Interface(bus.get_object('org.ofono', path),
+ 'org.ofono.SimToolkit')
+
+ stk.connect_to_signal("PropertyChanged", property_changed)
+
+ properties = stk.GetProperties()
+
+ path = "/test/agent"
+ agent = StkAgent(bus, path)
+
+ stk.RegisterAgent(path)
+
+ gobject.io_add_watch(sys.stdin, gobject.IO_IN, stdin_handler)
+
+ print "STK Agent is now registered"
+ print "Use t + <return> to quit the program when there is no session on going"
+
+ mainloop = gobject.MainLoop()
+ mainloop.run()
--
1.7.0.4
---------------------------------------------------------------------
Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: "Les Montalets"- 2, rue de Paris,
92196 Meudon Cedex, France
Registration Number: 302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros
This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] test: add a script for STK conformance tests
2010-12-16 16:04 [PATCH] test: add a script for STK conformance tests Lucas, GuillaumeX
@ 2010-12-17 15:32 ` Denis Kenzior
2010-12-20 8:40 ` Lucas, GuillaumeX
0 siblings, 1 reply; 3+ messages in thread
From: Denis Kenzior @ 2010-12-17 15:32 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 931 bytes --]
Hi Guillaume,
On 12/16/2010 10:04 AM, Lucas, GuillaumeX wrote:
> From: Guillaume Lucas <guillaumex.lucas@intel.com>
>
> To be able to run STK conformance tests at ofono
> level, we need to have a STK agent registered. The
> test-stk-conformance script provided here do that.
> This script is for conformance so all the data input
> of the agent are displayed to be able to check them.
> The existing test-stk-menu is usable only when there
> is a STK menu provided by the (U)SIM card.
> ---
> test/test-stk-conformance | 226 +++++++++++++++++++++++++++++++++++++++++++++
> 1 files changed, 226 insertions(+), 0 deletions(-)
> create mode 100755 test/test-stk-conformance
>
I really don't like the amount of code copying going on here. Have you
considered extending the current test-stk-menu with the ability to run
as the 'default' agent instead? Maybe via a command line option?
Regards,
-Denis
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: [PATCH] test: add a script for STK conformance tests
2010-12-17 15:32 ` Denis Kenzior
@ 2010-12-20 8:40 ` Lucas, GuillaumeX
0 siblings, 0 replies; 3+ messages in thread
From: Lucas, GuillaumeX @ 2010-12-20 8:40 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 1932 bytes --]
Hi Denis,
> -----Original Message-----
> From: Denis Kenzior [mailto:denkenz(a)gmail.com]
> Sent: Friday, December 17, 2010 4:32 PM
> To: ofono(a)ofono.org
> Cc: Lucas, GuillaumeX
> Subject: Re: [PATCH] test: add a script for STK conformance tests
>
> Hi Guillaume,
>
> On 12/16/2010 10:04 AM, Lucas, GuillaumeX wrote:
> > From: Guillaume Lucas <guillaumex.lucas@intel.com>
> >
> > To be able to run STK conformance tests at ofono
> > level, we need to have a STK agent registered. The
> > test-stk-conformance script provided here do that.
> > This script is for conformance so all the data input
> > of the agent are displayed to be able to check them.
> > The existing test-stk-menu is usable only when there
> > is a STK menu provided by the (U)SIM card.
> > ---
> > test/test-stk-conformance | 226
> +++++++++++++++++++++++++++++++++++++++++++++
> > 1 files changed, 226 insertions(+), 0 deletions(-)
> > create mode 100755 test/test-stk-conformance
> >
>
> I really don't like the amount of code copying going on here. Have you
> considered extending the current test-stk-menu with the ability to run
> as the 'default' agent instead? Maybe via a command line option?
>
You're right, it will be probably better to extend the current stk test script.
I'll review my changes in this way.
Regards,
Guillaume
---------------------------------------------------------------------
Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: "Les Montalets"- 2, rue de Paris,
92196 Meudon Cedex, France
Registration Number: 302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros
This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-12-20 8:40 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-16 16:04 [PATCH] test: add a script for STK conformance tests Lucas, GuillaumeX
2010-12-17 15:32 ` Denis Kenzior
2010-12-20 8:40 ` Lucas, GuillaumeX
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.