All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/6] Add conformance sim application
@ 2011-01-11 14:16 Jeevaka Badrappan
  2011-01-11 14:16 ` [PATCH 1/6] phonesim: add ui support for sim app selection Jeevaka Badrappan
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: Jeevaka Badrappan @ 2011-01-11 14:16 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 1169 bytes --]

Hi,

 Following set of patches adds the ui support for selecting
sim applications and also adds conformance sim application.
DisplayText, Get Inkey, Get Input and MoreTime test cases
are added to the conformance sim application. Logging of the
result in a file can be done but it is not part of this patch.

Regards,
Jeevaka

Jeevaka Badrappan (6):
  phonesim: add ui support for sim app selection
  phonesim: Add conformance sim application
  phonesim: Add DisplayText test cases
  phonesim: Add Get Inkey test cases
  phonesim: Add Get Input test cases
  phonesim: Add MoreTime test case

 Makefile.am                       |    3 +-
 src/conformancesimapplication.cpp | 1732 +++++++++++++++++++++++++++++++++++++
 src/control.cpp                   |    5 +-
 src/controlbase.ui                |   10 +-
 src/hardwaremanipulator.cpp       |   19 +-
 src/hardwaremanipulator.h         |    4 +-
 src/phonesim.cpp                  |   28 +-
 src/phonesim.h                    |    4 +
 src/simapplication.h              |   33 +
 9 files changed, 1808 insertions(+), 30 deletions(-)
 create mode 100644 src/conformancesimapplication.cpp


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/6] phonesim: add ui support for sim app selection
  2011-01-11 14:16 [PATCH 0/6] Add conformance sim application Jeevaka Badrappan
@ 2011-01-11 14:16 ` Jeevaka Badrappan
  2011-01-11 14:16 ` [PATCH 2/6] phonesim: Add conformance sim application Jeevaka Badrappan
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Jeevaka Badrappan @ 2011-01-11 14:16 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 6290 bytes --]

---
 src/control.cpp             |    5 ++---
 src/controlbase.ui          |   10 +++-------
 src/hardwaremanipulator.cpp |   19 ++++++++++---------
 src/hardwaremanipulator.h   |    4 ++--
 src/phonesim.cpp            |   23 +++++++++++++++++------
 src/phonesim.h              |    3 +++
 6 files changed, 37 insertions(+), 27 deletions(-)

diff --git a/src/control.cpp b/src/control.cpp
index 68c5584..2cbb91a 100644
--- a/src/control.cpp
+++ b/src/control.cpp
@@ -457,8 +457,7 @@ void ControlWidget::simInsertRemove()
 
 void ControlWidget::handleNewApp()
 {
-    ui->lblApplicationName->setText( "Current application: " +
-            p->getSimAppName() );
+    ui->cbSimApps->insertItems( 0, p->getSimAppsNameList() );
 }
 
 void Control::handleNewApp()
@@ -468,7 +467,7 @@ void Control::handleNewApp()
 
 void ControlWidget::simAppStart()
 {
-    p->simAppStart();
+    p->simAppStart( ui->cbSimApps->currentIndex() );
 }
 
 void ControlWidget::simAppAbort()
diff --git a/src/controlbase.ui b/src/controlbase.ui
index 669078c..36fe3cd 100644
--- a/src/controlbase.ui
+++ b/src/controlbase.ui
@@ -1288,6 +1288,9 @@ p, li { white-space: pre-wrap; }
          </property>
          <layout class="QHBoxLayout">
           <item>
+           <widget class="QComboBox" name="cbSimApps"/>
+          </item>
+          <item>
            <widget class="QPushButton" name="pbStart">
             <property name="text">
              <string>Start</string>
@@ -1301,13 +1304,6 @@ p, li { white-space: pre-wrap; }
             </property>
            </widget>
           </item>
-          <item>
-           <widget class="QLabel" name="lblApplicationName">
-            <property name="toolTip">
-             <string>Shows current selected application's name</string>
-            </property>
-           </widget>
-          </item>
          </layout>
         </widget>
        </item>
diff --git a/src/hardwaremanipulator.cpp b/src/hardwaremanipulator.cpp
index 8ed8227..c7bbe6a 100644
--- a/src/hardwaremanipulator.cpp
+++ b/src/hardwaremanipulator.cpp
@@ -307,26 +307,27 @@ void HardwareManipulator::setSimPresent( bool present )
     simPresent = present;
 }
 
-QString HardwareManipulator::getSimAppName()
+QStringList HardwareManipulator::getSimAppsNameList()
 {
-    SimApplication *app = rules->simApplication();
+    const QList<SimApplication *> simApps = rules->getSimApps();
+    QStringList nameList;
 
-    if (app)
-        return app->getName();
+    for ( int i = 0; i  < simApps.count(); i++ )
+        nameList.append( simApps.at( i )->getName() );
 
-    return "None";
+    return nameList;
 }
 
 void HardwareManipulator::handleNewApp()
 {
 }
 
-void HardwareManipulator::simAppStart()
+void HardwareManipulator::simAppStart( int appIndex )
 {
-    SimApplication *app = rules->simApplication();
+    const QList<SimApplication *> simApps = rules->getSimApps();
 
-    if (app)
-        return app->start();
+    rules->setSimApplication( simApps.at( appIndex ) );
+    simApps.at( appIndex )->start();
 }
 
 void HardwareManipulator::simAppAbort()
diff --git a/src/hardwaremanipulator.h b/src/hardwaremanipulator.h
index d8ab11e..86afbb5 100644
--- a/src/hardwaremanipulator.h
+++ b/src/hardwaremanipulator.h
@@ -35,7 +35,7 @@ public:
     HardwareManipulator(SimRules *sr, QObject *parent=0);
     QSMSMessageList & getSMSList();
     bool getSimPresent();
-    QString getSimAppName();
+    QStringList getSimAppsNameList();
 
 public slots:
     virtual void handleFromData( const QString& );
@@ -46,7 +46,7 @@ public slots:
     virtual void sendVMNotify( int type, int count, const QList<QVMMessage> &received, const QList<QVMMessage> &deleted, const QString &mailbox );
     virtual void sendUSSD( bool cancel, bool response, const QString &content );
     virtual void setSimPresent( bool present );
-    virtual void simAppStart();
+    virtual void simAppStart( int appIndex );
     virtual void simAppAbort();
     virtual void handleNewApp();
 
diff --git a/src/phonesim.cpp b/src/phonesim.cpp
index 8ca5b23..f0c93f1 100644
--- a/src/phonesim.cpp
+++ b/src/phonesim.cpp
@@ -548,6 +548,9 @@ SimRules::SimRules( int fd, QObject *p,  const QString& filename, HardwareManipu
     defaultToolkitApp = toolkitApp = new DemoSimApplication( this, this );
     connect( _callManager, SIGNAL(controlEvent(QSimControlEvent)),
              toolkitApp, SLOT(controlEvent(QSimControlEvent)) );
+
+    simApps.append( toolkitApp );
+
     if ( machine )
         machine->handleNewApp();
 
@@ -844,6 +847,9 @@ void SimRules::destruct()
     delete defaultToolkitApp;
     toolkitApp = NULL;
 
+    for ( int i = 0; i < simApps.count(); i++ )
+        simApps.removeAt( i );
+
     if ( getMachine() )
         getMachine()->handleNewApp();
 
@@ -877,13 +883,18 @@ HardwareManipulator * SimRules::getMachine() const
 
 void SimRules::setSimApplication( SimApplication *app )
 {
-    if ( toolkitApp != defaultToolkitApp )
-        delete toolkitApp;
-    toolkitApp = ( app ? app : defaultToolkitApp );
-    toolkitApp->start();
+    if ( toolkitApp == app )
+        return;
 
-    if ( getMachine() )
-        getMachine()->handleNewApp();
+    if ( toolkitApp )
+        toolkitApp->abort();
+
+    toolkitApp = app;
+}
+
+const QList<SimApplication *> SimRules::getSimApps()
+{
+    return simApps;
 }
 
 void SimRules::switchTo(const QString& name)
diff --git a/src/phonesim.h b/src/phonesim.h
index cb7a5e1..33b0b31 100644
--- a/src/phonesim.h
+++ b/src/phonesim.h
@@ -284,6 +284,8 @@ public:
     SimApplication *simApplication() const { return toolkitApp; }
     void setSimApplication( SimApplication *app );
 
+    const QList<SimApplication *> getSimApps();
+
 signals:
     void returnQueryVariable( const QString&, const QString & );
     void returnQueryState( const QString& );
@@ -332,6 +334,7 @@ private:
     SimFileSystem *fileSystem;
     SimApplication *defaultToolkitApp;
     SimApplication *toolkitApp;
+    QList<SimApplication *> simApps;
 
     // Get a particular state object.
     SimState *state( const QString& name ) const;
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 2/6] phonesim: Add conformance sim application
  2011-01-11 14:16 [PATCH 0/6] Add conformance sim application Jeevaka Badrappan
  2011-01-11 14:16 ` [PATCH 1/6] phonesim: add ui support for sim app selection Jeevaka Badrappan
@ 2011-01-11 14:16 ` Jeevaka Badrappan
  2011-01-11 14:16 ` [PATCH 3/6] phonesim: Add DisplayText test cases Jeevaka Badrappan
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Jeevaka Badrappan @ 2011-01-11 14:16 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 4746 bytes --]

---
 Makefile.am                       |    3 +-
 src/conformancesimapplication.cpp |   63 +++++++++++++++++++++++++++++++++++++
 src/phonesim.cpp                  |    5 ++-
 src/phonesim.h                    |    1 +
 src/simapplication.h              |   14 ++++++++
 5 files changed, 83 insertions(+), 3 deletions(-)
 create mode 100644 src/conformancesimapplication.cpp

diff --git a/Makefile.am b/Makefile.am
index f124b08..992c1d1 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -26,7 +26,8 @@ src_phonesim_SOURCES = src/main.cpp \
 			src/qsimcommand.h src/qsimcommand.cpp \
 			src/qsimenvelope.h src/qsimenvelope.cpp \
 			src/qsimterminalresponse.h src/qsimterminalresponse.cpp \
-			src/qsimcontrolevent.h src/qsimcontrolevent.cpp
+			src/qsimcontrolevent.h src/qsimcontrolevent.cpp \
+			src/conformancesimapplication.cpp
 
 nodist_src_phonesim_SOURCES = src/ui_controlbase.h \
 				src/moc_control.cpp \
diff --git a/src/conformancesimapplication.cpp b/src/conformancesimapplication.cpp
new file mode 100644
index 0000000..ecc47fb
--- /dev/null
+++ b/src/conformancesimapplication.cpp
@@ -0,0 +1,63 @@
+/****************************************************************************
+**
+** This file contains the SAT conformance test cases
+**
+** Copyright 2011 EB(Elektrobit).
+**
+**
+** This file may be used under the terms of the GNU General Public License
+** version 2.0 as published by the Free Software Foundation and appearing
+** in the file LICENSE.GPL included in the packaging of this file.
+**
+** Please review the following information to ensure GNU General Public
+** Licensing requirements will be met:
+**     http://www.fsf.org/licensing/licenses/info/GPLv2.html.
+**
+**
+****************************************************************************/
+
+#include "simapplication.h"
+#include <qatutils.h>
+#include <qdebug.h>
+#include <QTextCodec>
+#include "qsmsmessage.h"
+
+ConformanceSimApplication::ConformanceSimApplication( SimRules *rules,
+                                                        QObject *parent )
+    : SimApplication( rules, parent )
+{
+}
+
+ConformanceSimApplication::~ConformanceSimApplication()
+{
+}
+
+const QString ConformanceSimApplication::getName()
+{
+    return "Conformance SIM Application";
+}
+
+void ConformanceSimApplication::mainMenu()
+{
+    QSimCommand cmd;
+    QSimMenuItem item;
+    QList<QSimMenuItem> items;
+
+    cmd.setType( QSimCommand::SetupMenu );
+
+    cmd.setMenuItems( items );
+
+    command( cmd, 0, 0 );
+}
+
+void ConformanceSimApplication::mainMenuSelection( int id )
+{
+    switch ( id ) {
+        default:
+        {
+            // Don't know what this item is, so just re-display the main menu.
+            endSession();
+        }
+        break;
+    }
+}
diff --git a/src/phonesim.cpp b/src/phonesim.cpp
index f0c93f1..47425bc 100644
--- a/src/phonesim.cpp
+++ b/src/phonesim.cpp
@@ -546,10 +546,12 @@ SimRules::SimRules( int fd, QObject *p,  const QString& filename, HardwareManipu
     incomingUsed = 0;
     lineUsed = 0;
     defaultToolkitApp = toolkitApp = new DemoSimApplication( this, this );
+    conformanceApp = new ConformanceSimApplication( this, this );
     connect( _callManager, SIGNAL(controlEvent(QSimControlEvent)),
              toolkitApp, SLOT(controlEvent(QSimControlEvent)) );
 
     simApps.append( toolkitApp );
+    simApps.append( conformanceApp );
 
     if ( machine )
         machine->handleNewApp();
@@ -842,8 +844,7 @@ void SimRules::tryReadCommand()
 
 void SimRules::destruct()
 {
-    if ( toolkitApp != defaultToolkitApp )
-        delete toolkitApp;
+    delete conformanceApp;
     delete defaultToolkitApp;
     toolkitApp = NULL;
 
diff --git a/src/phonesim.h b/src/phonesim.h
index 33b0b31..d8fd293 100644
--- a/src/phonesim.h
+++ b/src/phonesim.h
@@ -334,6 +334,7 @@ private:
     SimFileSystem *fileSystem;
     SimApplication *defaultToolkitApp;
     SimApplication *toolkitApp;
+    SimApplication *conformanceApp;
     QList<SimApplication *> simApps;
 
     // Get a particular state object.
diff --git a/src/simapplication.h b/src/simapplication.h
index cd93f7e..925baeb 100644
--- a/src/simapplication.h
+++ b/src/simapplication.h
@@ -138,4 +138,18 @@ private:
     QString timerStatus;
 };
 
+class ConformanceSimApplication : public SimApplication
+{
+    Q_OBJECT
+public:
+    ConformanceSimApplication( SimRules *rules, QObject *parent = 0 );
+    ~ConformanceSimApplication();
+
+    const QString getName();
+
+protected slots:
+    void mainMenu();
+    void mainMenuSelection( int id );
+};
+
 #endif
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 3/6] phonesim: Add DisplayText test cases
  2011-01-11 14:16 [PATCH 0/6] Add conformance sim application Jeevaka Badrappan
  2011-01-11 14:16 ` [PATCH 1/6] phonesim: add ui support for sim app selection Jeevaka Badrappan
  2011-01-11 14:16 ` [PATCH 2/6] phonesim: Add conformance sim application Jeevaka Badrappan
@ 2011-01-11 14:16 ` Jeevaka Badrappan
  2011-01-11 14:16 ` [PATCH 4/6] phonesim: Add Get Inkey " Jeevaka Badrappan
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Jeevaka Badrappan @ 2011-01-11 14:16 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 18595 bytes --]

---
 src/conformancesimapplication.cpp |  519 +++++++++++++++++++++++++++++++++++++
 src/simapplication.h              |    6 +
 2 files changed, 525 insertions(+), 0 deletions(-)

diff --git a/src/conformancesimapplication.cpp b/src/conformancesimapplication.cpp
index ecc47fb..dbc433a 100644
--- a/src/conformancesimapplication.cpp
+++ b/src/conformancesimapplication.cpp
@@ -37,6 +37,41 @@ const QString ConformanceSimApplication::getName()
     return "Conformance SIM Application";
 }
 
+#define ConformanceMenu_DisplayText 1
+
+#define NormalMenu_1_1    1
+#define NormalMenu_1_2    2
+#define NormalMenu_1_3    3
+#define NormalMenu_1_4    4
+#define NormalMenu_1_5    5
+#define NormalMenu_1_6    6
+#define NormalMenu_1_7    7
+#define NormalMenu_1_8    8
+#define NormalMenu_1_9    9
+#define NormalMenu_1_10   10
+#define NormalMenu_1_11   11
+#define NormalMenu_Main   12
+
+#define IconMenu_1A     1
+#define IconMenu_2A     2
+#define IconMenu_3A     3
+#define IconMenu_4A     4
+#define IconMenu_5A     5
+#define IconMenu_6A     6
+#define IconMenu_Main   7
+
+#define Display_Text_Normal              1
+#define Display_Text_No_Response         2
+#define Display_Text_Extension_Text      3
+#define Display_Text_Sustained_Text_1    4
+#define Display_Text_Sustained_Text_2    5
+#define Display_Text_Sustained_Text_3    6
+#define Display_Text_Icon                7
+#define Display_Text_UCS2_Cyrillic       8
+#define Display_Text_Variable_Time_Out   9
+#define Display_Text_Attribute          10
+#define Display_Text_Main               11
+
 void ConformanceSimApplication::mainMenu()
 {
     QSimCommand cmd;
@@ -45,6 +80,10 @@ void ConformanceSimApplication::mainMenu()
 
     cmd.setType( QSimCommand::SetupMenu );
 
+    item.setIdentifier( ConformanceMenu_DisplayText );
+    item.setLabel( "Display Text" );
+    items += item;
+
     cmd.setMenuItems( items );
 
     command( cmd, 0, 0 );
@@ -53,6 +92,12 @@ void ConformanceSimApplication::mainMenu()
 void ConformanceSimApplication::mainMenuSelection( int id )
 {
     switch ( id ) {
+        case ConformanceMenu_DisplayText:
+        {
+            sendDisplayTextMenu();
+        }
+        break;
+
         default:
         {
             // Don't know what this item is, so just re-display the main menu.
@@ -61,3 +106,477 @@ void ConformanceSimApplication::mainMenuSelection( int id )
         break;
     }
 }
+
+void ConformanceSimApplication::sendDisplayTextMenu()
+{
+    QSimCommand cmd;
+    QSimMenuItem item;
+    QList<QSimMenuItem> items;
+
+    cmd.setType( QSimCommand::SelectItem );
+    cmd.setTitle( "Display Text" );
+
+    item.setIdentifier( Display_Text_Normal );
+    item.setLabel( "Normal" );
+    items += item;
+
+    item.setIdentifier( Display_Text_No_Response );
+    item.setLabel( "Support of No response from user" );
+    items += item;
+
+    item.setIdentifier( Display_Text_Extension_Text );
+    item.setLabel( "Display of the extension text" );
+    items += item;
+
+    item.setIdentifier( Display_Text_Sustained_Text_1 );
+    item.setLabel( "Sustained text, unpacked 8-bit data" );
+    items += item;
+
+    item.setIdentifier( Display_Text_Sustained_Text_2 );
+    item.setLabel( "Sustained text, clear message after delay" );
+    items += item;
+
+    item.setIdentifier( Display_Text_Sustained_Text_3 );
+    item.setLabel( "Sustained text, wait for user MMI to clear" );
+    items += item;
+
+    item.setIdentifier( Display_Text_Icon );
+    item.setLabel( "Display of icon" );
+    items += item;
+
+    item.setIdentifier( Display_Text_UCS2_Cyrillic );
+    item.setLabel( "UCS2 display supported in Cyrillic" );
+    items += item;
+
+    item.setIdentifier( Display_Text_Variable_Time_Out );
+    item.setLabel( "Variable Time out" );
+    items += item;
+
+    item.setIdentifier( Display_Text_Attribute );
+    item.setLabel( "Support of Text Attribute" );
+    items += item;
+
+    item.setIdentifier( Display_Text_Main );
+    item.setLabel( "Return to main menu" );
+    items += item;
+
+    cmd.setMenuItems( items );
+
+    command( cmd, this, SLOT(DisplayTextMenu(QSimTerminalResponse)) );
+}
+
+void ConformanceSimApplication::sendDisplayTextNormalMenu()
+{
+    QSimCommand cmd;
+    QSimMenuItem item;
+    QList<QSimMenuItem> items;
+
+    cmd.setType( QSimCommand::SelectItem );
+    cmd.setTitle( "Display Text (Normal)" );
+
+    item.setIdentifier( NormalMenu_1_1 );
+    item.setLabel( "normal priority, Unpacked 8 bit data,successful" );
+    items += item;
+
+    item.setIdentifier( NormalMenu_1_2 );
+    item.setLabel( "Unpacked 8 bit data,screen busy" );
+    items += item;
+
+    item.setIdentifier( NormalMenu_1_3 );
+    item.setLabel( "high priority, Unpacked 8 bit data,successful" );
+    items += item;
+
+    item.setIdentifier( NormalMenu_1_4 );
+    item.setLabel( "Packed, SMS default alphabet,successful" );
+    items += item;
+
+    item.setIdentifier( NormalMenu_1_5 );
+    item.setLabel( "Clear message after delay,successful" );
+    items += item;
+
+    item.setIdentifier( NormalMenu_1_6 );
+    item.setLabel( "Text string with 160 bytes,successful" );
+    items += item;
+
+    item.setIdentifier( NormalMenu_1_7 );
+    item.setLabel( "Backward move, successful" );
+    items += item;
+
+    item.setIdentifier( NormalMenu_1_8 );
+    item.setLabel( "session terminated by user" );
+    items += item;
+
+    item.setIdentifier( NormalMenu_1_9 );
+    item.setLabel( "Null text string, successful" );
+    items += item;
+
+    item.setIdentifier( NormalMenu_1_10 );
+    item.setLabel( "Empty text string, successful" );
+    items += item;
+
+    item.setIdentifier( NormalMenu_Main );
+    item.setLabel( "Return to Display Text main menu" );
+    items += item;
+
+    cmd.setMenuItems( items );
+
+    command( cmd, this, SLOT(DisplayTextNormalMenu(QSimTerminalResponse)) );
+}
+
+void ConformanceSimApplication::sendDisplayTextIconMenu()
+{
+    QSimCommand cmd;
+    QSimMenuItem item;
+    QList<QSimMenuItem> items;
+
+    cmd.setType( QSimCommand::SelectItem );
+    cmd.setTitle( "Display Text (Icon support)" );
+
+    item.setIdentifier( IconMenu_1A );
+    item.setLabel( "basic icon, self-explanatory, successful" );
+    items += item;
+
+    item.setIdentifier( IconMenu_2A );
+    item.setLabel( "display of colour icon, successful" );
+    items += item;
+
+    item.setIdentifier( IconMenu_3A );
+    item.setLabel( "basic icon, not self-explanatory, successful" );
+    items += item;
+
+    item.setIdentifier( IconMenu_4A );
+    item.setLabel( "basic icon, empty text string, unsuccessful" );
+    items += item;
+
+    item.setIdentifier( IconMenu_Main );
+    item.setLabel( "Return to Display Text main menu" );
+    items += item;
+
+    cmd.setMenuItems( items );
+
+    command( cmd, this, SLOT(DisplayTextIconMenu(QSimTerminalResponse)) );
+}
+
+void ConformanceSimApplication::DisplayTextMenu( const QSimTerminalResponse& resp )
+{
+    QSimCommand cmd;
+
+    if ( resp.result() != QSimTerminalResponse::Success ) {
+        /* Unknown response - just go back to the main menu. */
+        endSession();
+
+        return;
+    }
+
+    /* Item selected. */
+    switch ( resp.menuItem() ) {
+        case Display_Text_Normal:
+        {
+            sendDisplayTextNormalMenu();
+        }
+        break;
+
+        case Display_Text_No_Response:
+        {
+            cmd.setType( QSimCommand::DisplayText );
+            cmd.setDestinationDevice( QSimCommand::Display );
+            cmd.setClearAfterDelay( false );
+            cmd.setText( "<TIME-OUT>" );
+            command( cmd, this, SLOT(sendDisplayTextMenu()) );
+        }
+        break;
+
+        case Display_Text_Extension_Text:
+        {
+            cmd.setType( QSimCommand::DisplayText );
+            cmd.setDestinationDevice( QSimCommand::Display );
+            cmd.setClearAfterDelay( false );
+            cmd.setText( "This command instructs the ME to display a"
+                    " text message and/or an icon (see 6.5.4). "
+                    "It allows the SIM to define the priority"
+                    " of that message, and the text string format."
+                    " Two types of priority are defined:- display "
+                    " normal priority text and/");
+            command( cmd, this, SLOT(sendDisplayTextMenu()) );
+        }
+        break;
+
+        case Display_Text_Sustained_Text_1:
+        {
+            cmd.setType( QSimCommand::DisplayText );
+            cmd.setDestinationDevice( QSimCommand::Display );
+            cmd.setClearAfterDelay( false );
+            cmd.setText( "Toolkit Test 1" );
+            cmd.setImmediateResponse( true );
+            command( cmd, this, SLOT(sendDisplayTextMenu()) );
+        }
+        break;
+
+        case Display_Text_Sustained_Text_2:
+        {
+            cmd.setType( QSimCommand::DisplayText );
+            cmd.setDestinationDevice( QSimCommand::Display );
+            cmd.setClearAfterDelay( true );
+            cmd.setText( "Toolkit Test 2" );
+            cmd.setImmediateResponse( true );
+            command( cmd, this, SLOT(sendDisplayTextMenu()) );
+        }
+        break;
+
+        case Display_Text_Sustained_Text_3:
+        {
+            cmd.setType( QSimCommand::DisplayText );
+            cmd.setDestinationDevice( QSimCommand::Display );
+            cmd.setClearAfterDelay( false );
+            cmd.setText( "Toolkit Test 3" );
+            cmd.setImmediateResponse( true );
+            command( cmd, this, SLOT(sendDisplayTextMenu()) );
+        }
+        break;
+
+        case Display_Text_Icon:
+        {
+            sendDisplayTextIconMenu();
+        }
+        break;
+
+        case Display_Text_UCS2_Cyrillic:
+        {
+            cmd.setType( QSimCommand::DisplayText );
+            cmd.setDestinationDevice( QSimCommand::Display );
+            cmd.setClearAfterDelay( false );
+            QTextCodec *codec = QTextCodec::codecForName( "utf8" );
+            cmd.setText( codec->toUnicode( "ЗДРАВСТВУЙТЕ" ) );
+            command( cmd, this, SLOT(sendDisplayTextMenu()),
+                    QSimCommand::UCS2Strings );
+        }
+        break;
+
+        case Display_Text_Variable_Time_Out:
+        {
+            cmd.setType( QSimCommand::DisplayText );
+            cmd.setDestinationDevice( QSimCommand::Display );
+            cmd.setClearAfterDelay( false );
+            cmd.setText( "10 Second" );
+            cmd.setDuration( 10000 );
+            command( cmd, this, SLOT(sendDisplayTextMenu()) );
+        }
+        break;
+
+        case Display_Text_Attribute:
+        {
+            QByteArray ba;
+            ba.resize( 4 );
+            ba[0] = 0x00;
+            ba[1] = 0x10;
+            ba[2] = 0x00;
+            ba[3] = 0xB4;
+
+            cmd.setType( QSimCommand::DisplayText );
+            cmd.setDestinationDevice( QSimCommand::Display );
+            cmd.setClearAfterDelay( false );
+            cmd.setText( "Text Attribute 1" );
+            cmd.setTextAttribute( ba );
+            command( cmd, this, SLOT(sendDisplayTextMenu()) );
+        }
+        break;
+
+        default:
+            endSession();
+        break;
+    }
+}
+
+void ConformanceSimApplication::DisplayTextNormalMenu(
+                    const QSimTerminalResponse& resp )
+{
+    QSimCommand cmd;
+
+    if ( resp.result() != QSimTerminalResponse::Success ) {
+        /* Unknown response - just go back to the main menu. */
+        endSession();
+
+        return;
+    }
+
+    /* Item selected. */
+    switch ( resp.menuItem() ) {
+        case NormalMenu_1_1:
+        case NormalMenu_1_2:
+        {
+            cmd.setType( QSimCommand::DisplayText );
+            cmd.setDestinationDevice( QSimCommand::Display );
+            cmd.setClearAfterDelay( false );
+            cmd.setText( "Toolkit Test 1" );
+            command( cmd, this, SLOT(sendDisplayTextNormalMenu()) );
+        }
+        break;
+
+        case NormalMenu_1_3:
+        {
+            cmd.setType( QSimCommand::DisplayText );
+            cmd.setDestinationDevice( QSimCommand::Display );
+            cmd.setHighPriority( true );
+            cmd.setClearAfterDelay( false );
+            cmd.setText( "Toolkit Test 2" );
+            command( cmd, this, SLOT(sendDisplayTextNormalMenu()) );
+        }
+        break;
+
+        case NormalMenu_1_4:
+        {
+            cmd.setType( QSimCommand::DisplayText );
+            cmd.setDestinationDevice( QSimCommand::Display );
+            cmd.setClearAfterDelay( false );
+            cmd.setText( "Toolkit Test 3" );
+            command( cmd, this, SLOT(sendDisplayTextNormalMenu()),
+                    QSimCommand::PackedStrings );
+        }
+        break;
+
+        case NormalMenu_1_5:
+        {
+            cmd.setType( QSimCommand::DisplayText );
+            cmd.setDestinationDevice( QSimCommand::Display );
+            cmd.setClearAfterDelay( true );
+            cmd.setText( "Toolkit Test 4" );
+            command( cmd, this, SLOT(sendDisplayTextNormalMenu()) );
+        }
+        break;
+
+        case NormalMenu_1_6:
+        {
+            cmd.setType( QSimCommand::DisplayText );
+            cmd.setDestinationDevice( QSimCommand::Display );
+            cmd.setClearAfterDelay( false );
+            cmd.setText( "This command instructs the ME to display a"
+                    " text message. It allows the SIM to define"
+                    " the priority of that message, and the text"
+                    " string format. Two types of prio" );
+            command( cmd, this, SLOT(sendDisplayTextNormalMenu()) );
+        }
+        break;
+
+        case NormalMenu_1_7:
+        {
+            cmd.setType( QSimCommand::DisplayText );
+            cmd.setDestinationDevice( QSimCommand::Display );
+            cmd.setClearAfterDelay( false );
+            cmd.setText( "<GO-BACKWARDS>" );
+            command( cmd, this, SLOT(sendDisplayTextNormalMenu()) );
+        }
+        break;
+
+        case NormalMenu_1_8:
+        {
+            cmd.setType( QSimCommand::DisplayText );
+            cmd.setDestinationDevice( QSimCommand::Display );
+            cmd.setClearAfterDelay( false );
+            cmd.setText( "<ABORT>" );
+            command( cmd, this, SLOT(sendDisplayTextNormalMenu()) );
+        }
+        break;
+
+        case NormalMenu_1_9:
+        {
+            cmd.setType( QSimCommand::DisplayText );
+            cmd.setDestinationDevice( QSimCommand::Display );
+            cmd.setClearAfterDelay( false );
+            cmd.setText("");
+            command( cmd, this, SLOT(sendDisplayTextNormalMenu()) );
+        }
+        break;
+
+        case NormalMenu_1_10:
+        {
+            cmd.setType( QSimCommand::DisplayText );
+            cmd.setDestinationDevice( QSimCommand::Display );
+            cmd.setClearAfterDelay( false );
+            cmd.setText( QString() );
+            command( cmd, this, SLOT(sendDisplayTextNormalMenu()) );
+        }
+        break;
+
+        case NormalMenu_Main:
+        {
+            sendDisplayTextMenu();
+        }
+        break;
+
+        default:
+            endSession();
+        break;
+    }
+}
+
+void ConformanceSimApplication::DisplayTextIconMenu(
+                    const QSimTerminalResponse& resp )
+{
+    QSimCommand cmd;
+
+    if ( resp.result() != QSimTerminalResponse::Success ) {
+        /* Unknown response - just go back to the main menu. */
+        endSession();
+
+        return;
+    }
+
+    /* Item selected. */
+    switch ( resp.menuItem() ) {
+        case IconMenu_1A:
+        {
+            cmd.setType( QSimCommand::DisplayText );
+            cmd.setDestinationDevice( QSimCommand::Display );
+            cmd.setClearAfterDelay( false );
+            cmd.setText( "Basic Icon" );
+            cmd.setIconId( 1 );
+            cmd.setIconSelfExplanatory( true );
+            command( cmd, this, SLOT(sendDisplayTextIconMenu()) );
+        }
+        break;
+
+        case IconMenu_2A:
+        {
+            cmd.setType( QSimCommand::DisplayText );
+            cmd.setDestinationDevice( QSimCommand::Display );
+            cmd.setClearAfterDelay( false );
+            cmd.setText( "Colour Icon" );
+            cmd.setIconId( 2 );
+            cmd.setIconSelfExplanatory( true );
+            command( cmd, this, SLOT(sendDisplayTextIconMenu()) );
+        }
+        break;
+
+        case IconMenu_3A:
+        {
+            cmd.setType( QSimCommand::DisplayText );
+            cmd.setDestinationDevice( QSimCommand::Display );
+            cmd.setClearAfterDelay( false );
+            cmd.setText( "Basic Icon" );
+            cmd.setIconId( 1 );
+            command( cmd, this, SLOT(sendDisplayTextIconMenu()) );
+        }
+        break;
+
+        case IconMenu_4A:
+        {
+            cmd.setType( QSimCommand::DisplayText );
+            cmd.setDestinationDevice( QSimCommand::Display );
+            cmd.setClearAfterDelay( false );
+            cmd.setText( QString() );
+            cmd.setIconId( 1 );
+            command( cmd, this, SLOT(sendDisplayTextIconMenu()) );
+        }
+        break;
+
+        case IconMenu_Main:
+        {
+            sendDisplayTextMenu();
+        }
+        break;
+
+        default:
+            endSession();
+        break;
+    }
+}
\ No newline at end of file
diff --git a/src/simapplication.h b/src/simapplication.h
index 925baeb..edfa33f 100644
--- a/src/simapplication.h
+++ b/src/simapplication.h
@@ -150,6 +150,12 @@ public:
 protected slots:
     void mainMenu();
     void mainMenuSelection( int id );
+    void sendDisplayTextMenu();
+    void DisplayTextMenu( const QSimTerminalResponse& resp );
+    void DisplayTextNormalMenu( const QSimTerminalResponse& resp );
+    void sendDisplayTextNormalMenu();
+    void sendDisplayTextIconMenu();
+    void DisplayTextIconMenu( const QSimTerminalResponse& resp );
 };
 
 #endif
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 4/6] phonesim: Add Get Inkey test cases
  2011-01-11 14:16 [PATCH 0/6] Add conformance sim application Jeevaka Badrappan
                   ` (2 preceding siblings ...)
  2011-01-11 14:16 ` [PATCH 3/6] phonesim: Add DisplayText test cases Jeevaka Badrappan
@ 2011-01-11 14:16 ` Jeevaka Badrappan
  2011-01-11 14:16 ` [PATCH 5/6] phonesim: Add Get Input " Jeevaka Badrappan
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Jeevaka Badrappan @ 2011-01-11 14:16 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 18235 bytes --]

---
 src/conformancesimapplication.cpp |  501 ++++++++++++++++++++++++++++++++++++-
 src/simapplication.h              |    7 +
 2 files changed, 507 insertions(+), 1 deletions(-)

diff --git a/src/conformancesimapplication.cpp b/src/conformancesimapplication.cpp
index dbc433a..663fbe1 100644
--- a/src/conformancesimapplication.cpp
+++ b/src/conformancesimapplication.cpp
@@ -38,6 +38,7 @@ const QString ConformanceSimApplication::getName()
 }
 
 #define ConformanceMenu_DisplayText 1
+#define ConformanceMenu_GetInkey    2
 
 #define NormalMenu_1_1    1
 #define NormalMenu_1_2    2
@@ -72,6 +73,18 @@ const QString ConformanceSimApplication::getName()
 #define Display_Text_Attribute          10
 #define Display_Text_Main               11
 
+#define GetInkeyMenu_Normal              1
+#define GetInkeyMenu_No_Response         2
+#define GetInkeyMenu_Cyrillic_Display_1  3
+#define GetInkeyMenu_Cyrillic_Display_2  4
+#define GetInkeyMenu_Cyrillic_Entry      5
+#define GetInkeyMenu_YesNo_Response      6
+#define GetInkeyMenu_Icon                7
+#define GetInkeyMenu_Help                8
+#define GetInkeyMenu_Variable_Timeout    9
+#define GetInkeyMenu_Text_Attribute     10
+#define GetInkeyMenu_Main               11
+
 void ConformanceSimApplication::mainMenu()
 {
     QSimCommand cmd;
@@ -84,6 +97,10 @@ void ConformanceSimApplication::mainMenu()
     item.setLabel( "Display Text" );
     items += item;
 
+    item.setIdentifier( ConformanceMenu_GetInkey );
+    item.setLabel( "Get Inkey" );
+    items += item;
+
     cmd.setMenuItems( items );
 
     command( cmd, 0, 0 );
@@ -98,6 +115,12 @@ void ConformanceSimApplication::mainMenuSelection( int id )
         }
         break;
 
+        case ConformanceMenu_GetInkey:
+        {
+            sendGetInkeyMenu();
+        }
+        break;
+
         default:
         {
             // Don't know what this item is, so just re-display the main menu.
@@ -579,4 +602,480 @@ void ConformanceSimApplication::DisplayTextIconMenu(
             endSession();
         break;
     }
-}
\ No newline at end of file
+}
+
+void ConformanceSimApplication::sendGetInkeyMenu()
+{
+    QSimCommand cmd;
+    QSimMenuItem item;
+    QList<QSimMenuItem> items;
+
+    cmd.setType( QSimCommand::SelectItem );
+    cmd.setTitle( "Get Inkey" );
+
+    item.setIdentifier( GetInkeyMenu_Normal );
+    item.setLabel( "Normal" );
+    items += item;
+
+    item.setIdentifier( GetInkeyMenu_No_Response );
+    item.setLabel( "No response from user" );
+    items += item;
+
+    item.setIdentifier( GetInkeyMenu_Cyrillic_Display_1 );
+    item.setLabel( "UCS2 display in Cyrillic" );
+    items += item;
+
+    item.setIdentifier( GetInkeyMenu_Cyrillic_Display_2 );
+    item.setLabel( "max. length UCS2 display in Cyrillic" );
+    items += item;
+
+    item.setIdentifier( GetInkeyMenu_Cyrillic_Entry );
+    item.setLabel( "UCS2 entry in Cyrillic" );
+    items += item;
+
+    item.setIdentifier( GetInkeyMenu_YesNo_Response );
+    item.setLabel( "Yes/No response for the input" );
+    items += item;
+
+    item.setIdentifier( GetInkeyMenu_Icon );
+    item.setLabel( "Display of icon" );
+    items += item;
+
+    item.setIdentifier( GetInkeyMenu_Help );
+    item.setLabel( "Help Information" );
+    items += item;
+
+    item.setIdentifier( GetInkeyMenu_Variable_Timeout );
+    item.setLabel( "Variable Time out" );
+    items += item;
+
+    item.setIdentifier( GetInkeyMenu_Text_Attribute );
+    item.setLabel( "Support of Text Attribute" );
+    items += item;
+
+    item.setIdentifier( GetInkeyMenu_Main );
+    item.setLabel( "Return to main menu" );
+    items += item;
+
+    cmd.setMenuItems( items );
+
+    command( cmd, this, SLOT(GetInkeyMenu(QSimTerminalResponse)) );
+}
+
+void ConformanceSimApplication::sendGetInkeyNormalMenu()
+{
+    QSimCommand cmd;
+    QSimMenuItem item;
+    QList<QSimMenuItem> items;
+
+    cmd.setType( QSimCommand::SelectItem );
+    cmd.setTitle( "Get Inkey (Normal)" );
+
+    item.setIdentifier( NormalMenu_1_1 );
+    item.setLabel( "Digits only for character set, unpacked 8-bit" );
+    items += item;
+
+    item.setIdentifier( NormalMenu_1_2 );
+    item.setLabel( "Digits only for character set, packed text string" );
+    items += item;
+
+    item.setIdentifier( NormalMenu_1_3 );
+    item.setLabel( "Backward move" );
+    items += item;
+
+    item.setIdentifier( NormalMenu_1_4 );
+    item.setLabel( "Abort" );
+    items += item;
+
+    item.setIdentifier( NormalMenu_1_5 );
+    item.setLabel( "SMS default alphabet for character set, unpacked 8-bit" );
+    items += item;
+
+    item.setIdentifier( NormalMenu_1_6 );
+    item.setLabel( "Max length for the Text String, successful" );
+    items += item;
+
+    item.setIdentifier( NormalMenu_Main );
+    item.setLabel( "Return to Get Inkey main menu" );
+    items += item;
+
+    cmd.setMenuItems( items );
+
+    command( cmd, this, SLOT(GetInkeyNormalMenu(QSimTerminalResponse)) );
+}
+
+void ConformanceSimApplication::sendGetInkeyIconMenu()
+{
+    QSimCommand cmd;
+    QSimMenuItem item;
+    QList<QSimMenuItem> items;
+
+    cmd.setType( QSimCommand::SelectItem );
+    cmd.setTitle( "Get Inkey (Icon support)" );
+
+    item.setIdentifier( IconMenu_1A );
+    item.setLabel( "basic icon, self-explanatory, successful" );
+    items += item;
+
+    item.setIdentifier( IconMenu_2A );
+    item.setLabel( "display of colour icon, successful" );
+    items += item;
+
+    item.setIdentifier( IconMenu_3A );
+    item.setLabel( "basic icon, not self-explanatory, successful" );
+    items += item;
+
+    item.setIdentifier( IconMenu_4A );
+    item.setLabel( "Colour icon, non self-explanatory, successful" );
+    items += item;
+
+    item.setIdentifier( IconMenu_5A );
+    item.setLabel( "basic icon, null text string, unsuccessful" );
+    items += item;
+
+    item.setIdentifier( IconMenu_6A );
+    item.setLabel( "basic icon, empty text string, unsuccessful" );
+    items += item;
+
+    item.setIdentifier( IconMenu_Main );
+    item.setLabel( "Return to Get Inkey main menu" );
+    items += item;
+
+    cmd.setMenuItems( items );
+
+    command( cmd, this, SLOT(GetInkeyIconMenu(QSimTerminalResponse)) );
+}
+
+void ConformanceSimApplication::sendHelpInfo( const QSimTerminalResponse& resp )
+{
+    if ( resp.result() == QSimTerminalResponse::HelpInformationRequested ) {
+            QSimCommand cmd;
+
+            cmd.setType( QSimCommand::DisplayText );
+            cmd.setDestinationDevice( QSimCommand::Display );
+            cmd.setClearAfterDelay( false );
+            cmd.setText( "Help information" );
+            command( cmd, this, SLOT(GetInkeyMenu(QSimTerminalResponse)) );
+    } else
+            endSession();
+}
+
+void ConformanceSimApplication::GetInkeyMenu( const QSimTerminalResponse& resp )
+{
+    QSimCommand cmd;
+
+    if ( resp.command().type() == QSimCommand::DisplayText &&
+                resp.result() == QSimTerminalResponse::Success ) {
+            cmd.setType( QSimCommand::GetInkey );
+            cmd.setDestinationDevice( QSimCommand::ME );
+            cmd.setWantDigits(true);
+            cmd.setHasHelp( true );
+            cmd.setText( "Enter \"+\"" );
+            command( cmd, this, SLOT(sendGetInkeyMenu()) );
+            return;
+    }
+
+    if ( resp.result() != QSimTerminalResponse::Success ) {
+        /* Unknown response - just go back to the main menu. */
+        endSession();
+
+        return;
+    }
+
+    /* Item selected. */
+    switch ( resp.menuItem() ) {
+        case GetInkeyMenu_Normal:
+        {
+            sendGetInkeyNormalMenu();
+        }
+        break;
+
+        case GetInkeyMenu_No_Response:
+        {
+            cmd.setType( QSimCommand::GetInkey );
+            cmd.setDestinationDevice( QSimCommand::ME );
+            cmd.setWantDigits(true);
+            cmd.setText( "<TIME-OUT>" );
+            command( cmd, this, SLOT(sendGetInkeyMenu()) );
+        }
+        break;
+
+        case GetInkeyMenu_Cyrillic_Display_1:
+        {
+            cmd.setType( QSimCommand::GetInkey );
+            cmd.setDestinationDevice( QSimCommand::ME );
+            cmd.setWantDigits(true);
+            QTextCodec *codec = QTextCodec::codecForName( "utf8" );
+            cmd.setText( codec->toUnicode( "ЗДРАВСТВУЙТЕ" ) );
+            command( cmd, this, SLOT(sendGetInkeyMenu()),
+                    QSimCommand::UCS2Strings );
+        }
+        break;
+
+        case GetInkeyMenu_Cyrillic_Display_2:
+        {
+            cmd.setType( QSimCommand::GetInkey );
+            cmd.setDestinationDevice( QSimCommand::ME );
+            cmd.setWantDigits(true);
+            QTextCodec *codec = QTextCodec::codecForName( "utf8" );
+            cmd.setText( codec->toUnicode( "ЗДРАВСТВУЙТЕЗДРАВСТВУЙТЕ"
+                                "ЗДРАВСТВУЙТЕЗДРАВСТВУЙТЕ"
+                                "ЗДРАВСТВУЙТЕЗДРАВСТВУЙ" ) );
+            command( cmd, this, SLOT(sendGetInkeyMenu()),
+                    QSimCommand::UCS2Strings );
+        }
+        break;
+
+        case GetInkeyMenu_Cyrillic_Entry:
+        {
+            cmd.setType( QSimCommand::GetInkey );
+            cmd.setDestinationDevice( QSimCommand::ME );
+            cmd.setWantDigits( false );
+            cmd.setUcs2Input( true );
+            cmd.setText( "Enter" );
+            command( cmd, this, SLOT(sendGetInkeyMenu()) );
+        }
+        break;
+
+        case GetInkeyMenu_YesNo_Response:
+        {
+            cmd.setType( QSimCommand::GetInkey );
+            cmd.setDestinationDevice( QSimCommand::ME );
+            cmd.setWantYesNo( true );
+            cmd.setText( "Enter YES" );
+            command( cmd, this, SLOT(sendGetInkeyMenu()) );
+        }
+        break;
+
+        case GetInkeyMenu_Icon:
+        {
+            sendGetInkeyIconMenu();
+        }
+        break;
+
+        case GetInkeyMenu_Help:
+        {
+            cmd.setType( QSimCommand::GetInkey );
+            cmd.setDestinationDevice( QSimCommand::ME );
+            cmd.setWantDigits(true);
+            cmd.setHasHelp( true );
+            cmd.setText( "Enter \"+\"" );
+            command( cmd, this, SLOT(sendHelpInfo(QSimTerminalResponse)) );
+        }
+        break;
+
+        case GetInkeyMenu_Variable_Timeout:
+        {
+            cmd.setType( QSimCommand::GetInkey );
+            cmd.setDestinationDevice( QSimCommand::ME );
+            cmd.setWantDigits(true);
+            cmd.setText( "Enter \"+\"" );
+            cmd.setDuration( 10000 );
+            command( cmd, this, SLOT(sendGetInkeyMenu()) );
+        }
+        break;
+
+        case GetInkeyMenu_Text_Attribute:
+        {
+            QByteArray ba;
+            ba.resize( 4 );
+            ba[0] = 0x00;
+            ba[1] = 0x09;
+            ba[2] = 0x00;
+            ba[3] = 0xB4;
+
+            cmd.setType( QSimCommand::GetInkey );
+            cmd.setDestinationDevice( QSimCommand::ME );
+            cmd.setWantDigits(true);
+            cmd.setText( "Enter \"+\"" );
+            cmd.setTextAttribute( ba );
+            command( cmd, this, SLOT(sendGetInkeyMenu()) );
+        }
+        break;
+
+        default:
+            endSession();
+        break;
+    }
+}
+
+void ConformanceSimApplication::GetInkeyNormalMenu( const QSimTerminalResponse& resp )
+{
+    QSimCommand cmd;
+
+    if ( resp.result() != QSimTerminalResponse::Success ) {
+        /* Unknown response - just go back to the main menu. */
+        endSession();
+
+        return;
+    }
+
+    /* Item selected. */
+    switch ( resp.menuItem() ) {
+        case NormalMenu_1_1:
+        {
+            cmd.setType( QSimCommand::GetInkey );
+            cmd.setDestinationDevice( QSimCommand::ME );
+            cmd.setWantDigits(true);
+            cmd.setText( "Enter \"+\"" );
+            command( cmd, this, SLOT(sendGetInkeyNormalMenu()) );
+        }
+        break;
+
+        case NormalMenu_1_2:
+        {
+            cmd.setType( QSimCommand::GetInkey );
+            cmd.setDestinationDevice( QSimCommand::ME );
+            cmd.setWantDigits(true);
+            cmd.setText( "Enter \"0\"" );
+            command( cmd, this, SLOT(sendGetInkeyNormalMenu()),
+                    QSimCommand::PackedStrings );
+        }
+        break;
+
+        case NormalMenu_1_3:
+        {
+            cmd.setType( QSimCommand::GetInkey );
+            cmd.setDestinationDevice( QSimCommand::ME );
+            cmd.setWantDigits(true);
+            cmd.setText( "<GO-BACKWARDS>" );
+            command( cmd, this, SLOT(sendGetInkeyNormalMenu()) );
+        }
+        break;
+
+        case NormalMenu_1_4:
+        {
+            cmd.setType( QSimCommand::GetInkey );
+            cmd.setDestinationDevice( QSimCommand::ME );
+            cmd.setWantDigits(true);
+            cmd.setText( "<ABORT>" );
+            command( cmd, this, SLOT(sendGetInkeyNormalMenu()) );
+        }
+        break;
+
+        case NormalMenu_1_5:
+        {
+            cmd.setType( QSimCommand::GetInkey );
+            cmd.setDestinationDevice( QSimCommand::ME );
+            cmd.setWantDigits(false);
+            cmd.setText( "Enter \"q\"" );
+            command( cmd, this, SLOT(sendGetInkeyNormalMenu()) );
+        }
+        break;
+
+        case NormalMenu_1_6:
+        {
+            cmd.setType( QSimCommand::GetInkey );
+            cmd.setDestinationDevice( QSimCommand::ME );
+            cmd.setWantDigits(false);
+            cmd.setText( "Enter \"x\". This command instructs the ME to display "
+                         "text, and to expect the user to enter a single character."
+                         " Any response entered by the user shall be passed t" );
+            command( cmd, this, SLOT(sendGetInkeyNormalMenu()) );
+        }
+        break;
+
+        case NormalMenu_Main:
+        {
+            sendGetInkeyMenu();
+        }
+        break;
+
+        default:
+            endSession();
+        break;
+    }
+}
+
+void ConformanceSimApplication::GetInkeyIconMenu( const QSimTerminalResponse& resp )
+{
+    QSimCommand cmd;
+
+    if ( resp.result() != QSimTerminalResponse::Success ) {
+        /* Unknown response - just go back to the main menu. */
+        endSession();
+
+        return;
+    }
+
+    /* Item selected. */
+    switch ( resp.menuItem() ) {
+        case IconMenu_1A:
+        {
+            cmd.setType( QSimCommand::GetInkey );
+            cmd.setDestinationDevice( QSimCommand::ME );
+            cmd.setWantDigits(true);
+            cmd.setText( "<NO-ICON>" );
+            cmd.setIconId( 1 );
+            cmd.setIconSelfExplanatory( true );
+            command( cmd, this, SLOT(sendGetInkeyIconMenu()) );
+        }
+        break;
+
+        case IconMenu_2A:
+        {
+            cmd.setType( QSimCommand::GetInkey );
+            cmd.setDestinationDevice( QSimCommand::ME );
+            cmd.setWantDigits(true);
+            cmd.setText( "<BASIC-ICON>" );
+            cmd.setIconId( 1 );
+            command( cmd, this, SLOT(sendGetInkeyIconMenu()) );
+        }
+        break;
+
+        case IconMenu_3A:
+        {
+            cmd.setType( QSimCommand::GetInkey );
+            cmd.setDestinationDevice( QSimCommand::ME );
+            cmd.setWantDigits(true);
+            cmd.setText( "<NO-ICON>" );
+            cmd.setIconId( 2 );
+            cmd.setIconSelfExplanatory( true );
+            command( cmd, this, SLOT(sendGetInkeyIconMenu()) );
+        }
+        break;
+
+        case IconMenu_4A:
+        {
+            cmd.setType( QSimCommand::GetInkey );
+            cmd.setDestinationDevice( QSimCommand::ME );
+            cmd.setWantDigits(true);
+            cmd.setText( "<COLOUR-ICON>" );
+            cmd.setIconId( 2 );
+            command( cmd, this, SLOT(sendGetInkeyIconMenu()) );
+        }
+        break;
+
+        case IconMenu_5A:
+        {
+            cmd.setType( QSimCommand::GetInkey );
+            cmd.setDestinationDevice( QSimCommand::ME );
+            cmd.setWantDigits(true);
+            cmd.setText( "" );
+            cmd.setIconId( 1 );
+            command( cmd, this, SLOT(sendGetInkeyIconMenu()) );
+        }
+        break;
+
+        case IconMenu_6A:
+        {
+            cmd.setType( QSimCommand::GetInkey );
+            cmd.setDestinationDevice( QSimCommand::ME );
+            cmd.setWantDigits(true);
+            cmd.setText( QString() );
+            cmd.setIconId( 1 );
+            command( cmd, this, SLOT(sendGetInkeyIconMenu()) );
+        }
+        break;
+
+        case IconMenu_Main:
+        {
+            sendGetInkeyMenu();
+        }
+        break;
+
+        default:
+            endSession();
+        break;
+    }
+}
diff --git a/src/simapplication.h b/src/simapplication.h
index edfa33f..0dcad38 100644
--- a/src/simapplication.h
+++ b/src/simapplication.h
@@ -156,6 +156,13 @@ protected slots:
     void sendDisplayTextNormalMenu();
     void sendDisplayTextIconMenu();
     void DisplayTextIconMenu( const QSimTerminalResponse& resp );
+    void sendGetInkeyMenu();
+    void GetInkeyMenu( const QSimTerminalResponse& resp );
+    void GetInkeyNormalMenu( const QSimTerminalResponse& resp );
+    void sendGetInkeyNormalMenu();
+    void sendGetInkeyIconMenu();
+    void GetInkeyIconMenu( const QSimTerminalResponse& resp );
+    void sendHelpInfo( const QSimTerminalResponse& resp );
 };
 
 #endif
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 5/6] phonesim: Add Get Input test cases
  2011-01-11 14:16 [PATCH 0/6] Add conformance sim application Jeevaka Badrappan
                   ` (3 preceding siblings ...)
  2011-01-11 14:16 ` [PATCH 4/6] phonesim: Add Get Inkey " Jeevaka Badrappan
@ 2011-01-11 14:16 ` Jeevaka Badrappan
  2011-01-11 14:16 ` [PATCH 6/6] phonesim: Add MoreTime test case Jeevaka Badrappan
  2011-01-12 23:27 ` [PATCH 0/6] Add conformance sim application Denis Kenzior
  6 siblings, 0 replies; 8+ messages in thread
From: Jeevaka Badrappan @ 2011-01-11 14:16 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 23284 bytes --]

---
 src/conformancesimapplication.cpp |  636 +++++++++++++++++++++++++++++++++++++
 src/simapplication.h              |    6 +
 2 files changed, 642 insertions(+), 0 deletions(-)

diff --git a/src/conformancesimapplication.cpp b/src/conformancesimapplication.cpp
index 663fbe1..f51d36c 100644
--- a/src/conformancesimapplication.cpp
+++ b/src/conformancesimapplication.cpp
@@ -39,6 +39,7 @@ const QString ConformanceSimApplication::getName()
 
 #define ConformanceMenu_DisplayText 1
 #define ConformanceMenu_GetInkey    2
+#define ConformanceMenu_GetInput    3
 
 #define NormalMenu_1_1    1
 #define NormalMenu_1_2    2
@@ -85,6 +86,19 @@ const QString ConformanceSimApplication::getName()
 #define GetInkeyMenu_Text_Attribute     10
 #define GetInkeyMenu_Main               11
 
+#define GetInputMenu_Normal              1
+#define GetInputMenu_No_Response         2
+#define GetInputMenu_Cyrillic_Display_1  3
+#define GetInputMenu_Cyrillic_Display_2  4
+#define GetInputMenu_Cyrillic_Entry_1    5
+#define GetInputMenu_Cyrillic_Entry_2    6
+#define GetInputMenu_Default_Text_1      7
+#define GetInputMenu_Default_Text_2      8
+#define GetInputMenu_Icon                9
+#define GetInputMenu_Help               10
+#define GetInputMenu_Text_Attribute     11
+#define GetInputMenu_Main               12
+
 void ConformanceSimApplication::mainMenu()
 {
     QSimCommand cmd;
@@ -101,6 +115,10 @@ void ConformanceSimApplication::mainMenu()
     item.setLabel( "Get Inkey" );
     items += item;
 
+    item.setIdentifier( ConformanceMenu_GetInput );
+    item.setLabel( "Get Input" );
+    items += item;
+
     cmd.setMenuItems( items );
 
     command( cmd, 0, 0 );
@@ -121,6 +139,12 @@ void ConformanceSimApplication::mainMenuSelection( int id )
         }
         break;
 
+        case ConformanceMenu_GetInput:
+        {
+            sendGetInputMenu();
+        }
+        break;
+
         default:
         {
             // Don't know what this item is, so just re-display the main menu.
@@ -1079,3 +1103,615 @@ void ConformanceSimApplication::GetInkeyIconMenu( const QSimTerminalResponse& re
         break;
     }
 }
+
+void ConformanceSimApplication::sendGetInputMenu()
+{
+    QSimCommand cmd;
+    QSimMenuItem item;
+    QList<QSimMenuItem> items;
+
+    cmd.setType( QSimCommand::SelectItem );
+    cmd.setTitle( "Get Input" );
+
+    item.setIdentifier( GetInputMenu_Normal );
+    item.setLabel( "Normal" );
+    items += item;
+
+    item.setIdentifier( GetInputMenu_No_Response );
+    item.setLabel( "No response from user" );
+    items += item;
+
+    item.setIdentifier( GetInputMenu_Cyrillic_Display_1 );
+    item.setLabel( "UCS2 display in Cyrillic" );
+    items += item;
+
+    item.setIdentifier( GetInputMenu_Cyrillic_Display_2 );
+    item.setLabel( "max.length UCS2 display in Cyrillic" );
+    items += item;
+
+    item.setIdentifier( GetInputMenu_Cyrillic_Entry_1 );
+    item.setLabel( "UCS2 entry in Cyrillic" );
+    items += item;
+
+    item.setIdentifier( GetInputMenu_Cyrillic_Entry_2 );
+    item.setLabel( "max.length UCS2 entry in Cyrillic" );
+    items += item;
+
+    item.setIdentifier( GetInputMenu_Default_Text_1 );
+    item.setLabel( "Default Text" );
+    items += item;
+
+    item.setIdentifier( GetInputMenu_Default_Text_2 );
+    item.setLabel( "Default Text with max. length" );
+    items += item;
+
+    item.setIdentifier( GetInputMenu_Icon );
+    item.setLabel( "Display of icon" );
+    items += item;
+
+    item.setIdentifier( GetInputMenu_Help );
+    item.setLabel( "Help Information" );
+    items += item;
+
+    item.setIdentifier( GetInputMenu_Text_Attribute );
+    item.setLabel( "Support of Text Attribute" );
+    items += item;
+
+    item.setIdentifier( GetInputMenu_Main );
+    item.setLabel( "Return to main menu" );
+    items += item;
+
+    cmd.setMenuItems( items );
+
+    command( cmd, this, SLOT(GetInputMenu(QSimTerminalResponse)) );
+}
+
+void ConformanceSimApplication::sendGetInputNormalMenu()
+{
+    QSimCommand cmd;
+    QSimMenuItem item;
+    QList<QSimMenuItem> items;
+
+    cmd.setType( QSimCommand::SelectItem );
+    cmd.setTitle( "Get Input (Normal)" );
+
+    item.setIdentifier( NormalMenu_1_1 );
+    item.setLabel( "digits only, SMS default alphabet, echo text" );
+    items += item;
+
+    item.setIdentifier( NormalMenu_1_2 );
+    item.setLabel( "digits only, SMS default alphabet, echo text, packed SMS" );
+    items += item;
+
+    item.setIdentifier( NormalMenu_1_3 );
+    item.setLabel( "character set, SMS default alphabet, echo text" );
+    items += item;
+
+    item.setIdentifier( NormalMenu_1_4 );
+    item.setLabel( "digits only, SMS default alphabet, hide text" );
+    items += item;
+
+    item.setIdentifier( NormalMenu_1_5 );
+    item.setLabel( "digits only, SMS default alphabet, echo text" );
+    items += item;
+
+    item.setIdentifier( NormalMenu_1_6 );
+    item.setLabel( "backwards move" );
+    items += item;
+
+    item.setIdentifier( NormalMenu_1_7 );
+    item.setLabel( "abort" );
+    items += item;
+
+    item.setIdentifier( NormalMenu_1_8 );
+    item.setLabel( "response length range 160-160" );
+    items += item;
+
+    item.setIdentifier( NormalMenu_1_9 );
+    item.setLabel( "response length range 0-1" );
+    items += item;
+
+    item.setIdentifier( NormalMenu_1_10 );
+    item.setLabel( "null length for the text string" );
+    items += item;
+
+    item.setIdentifier( NormalMenu_1_11 );
+    item.setLabel( "empty text string" );
+    items += item;
+
+    item.setIdentifier( NormalMenu_Main );
+    item.setLabel( "Return to Get Input main menu" );
+    items += item;
+
+    cmd.setMenuItems( items );
+
+    command( cmd, this, SLOT(GetInputNormalMenu(QSimTerminalResponse)) );
+}
+
+void ConformanceSimApplication::sendGetInputIconMenu()
+{
+    QSimCommand cmd;
+    QSimMenuItem item;
+    QList<QSimMenuItem> items;
+
+    cmd.setType( QSimCommand::SelectItem );
+    cmd.setTitle( "Get Input (Icon support)" );
+
+    item.setIdentifier( IconMenu_1A );
+    item.setLabel( "basic icon, self-explanatory, successful" );
+    items += item;
+
+    item.setIdentifier( IconMenu_2A );
+    item.setLabel( "basic icon, non self-explanatory, successful" );
+    items += item;
+
+    item.setIdentifier( IconMenu_3A );
+    item.setLabel( "Colour icon, self-explanatory, successful" );
+    items += item;
+
+    item.setIdentifier( IconMenu_4A );
+    item.setLabel( "Colour icon, non self-explanatory, successful" );
+    items += item;
+
+    item.setIdentifier( IconMenu_5A );
+    item.setLabel( "basic icon, null text string, unsuccessful" );
+    items += item;
+
+    item.setIdentifier( IconMenu_6A );
+    item.setLabel( "basic icon, empty text string, unsuccessful" );
+    items += item;
+
+    item.setIdentifier( IconMenu_Main );
+    item.setLabel( "Return to Get Input main menu" );
+    items += item;
+
+    cmd.setMenuItems( items );
+
+    command( cmd, this, SLOT(GetInputIconMenu(QSimTerminalResponse)) );
+}
+
+void ConformanceSimApplication::GetInputMenu( const QSimTerminalResponse& resp )
+{
+    QSimCommand cmd;
+
+    if ( resp.result() != QSimTerminalResponse::Success ) {
+        /* Unknown response - just go back to the main menu. */
+        endSession();
+
+        return;
+    }
+
+    /* Item selected. */
+    switch ( resp.menuItem() ) {
+        case GetInputMenu_Normal:
+        {
+            sendGetInputNormalMenu();
+        }
+        break;
+
+        case GetInputMenu_No_Response:
+        {
+            cmd.setType( QSimCommand::GetInput );
+            cmd.setDestinationDevice( QSimCommand::ME );
+            cmd.setWantDigits(true);
+            cmd.setEcho( true );
+            cmd.setText( "<TIME-OUT>" );
+            cmd.setMinimumLength( 0 );
+            cmd.setMaximumLength( 10 );
+            command( cmd, this, SLOT(sendGetInputMenu()) );
+        }
+        break;
+
+        case GetInputMenu_Cyrillic_Display_1:
+        {
+            cmd.setType( QSimCommand::GetInput );
+            cmd.setDestinationDevice( QSimCommand::ME );
+            cmd.setEcho( true );
+            cmd.setWantDigits( false );
+            QTextCodec *codec = QTextCodec::codecForName( "utf8" );
+            cmd.setText( codec->toUnicode( "ЗДРАВСТВУЙТЕ" ) );
+            cmd.setMinimumLength( 5 );
+            cmd.setMaximumLength( 5 );
+            command( cmd, this, SLOT(sendGetInputMenu()),
+                    QSimCommand::UCS2Strings );
+        }
+        break;
+
+        case GetInputMenu_Cyrillic_Display_2:
+        {
+            cmd.setType( QSimCommand::GetInput );
+            cmd.setDestinationDevice( QSimCommand::ME );
+            cmd.setEcho( true );
+            cmd.setWantDigits( false );
+            QTextCodec *codec = QTextCodec::codecForName( "utf8" );
+            cmd.setText( codec->toUnicode( "ЗДРАВСТВУЙТЕЗДРАВСТВУЙТЕ"
+                                "ЗДРАВСТВУЙТЕЗДРАВСТВУЙТЕ"
+                                "ЗДРАВСТВУЙТЕЗДРАВСТВУЙ" ) );
+            cmd.setMinimumLength( 5 );
+            cmd.setMaximumLength( 5 );
+            command( cmd, this, SLOT(sendGetInputMenu()),
+                    QSimCommand::UCS2Strings );
+        }
+        break;
+
+        case GetInputMenu_Cyrillic_Entry_1:
+        {
+            cmd.setType( QSimCommand::GetInput );
+            cmd.setDestinationDevice( QSimCommand::ME );
+            cmd.setWantDigits( false );
+            cmd.setUcs2Input( true );
+            cmd.setText( "Enter Hello" );
+            cmd.setMinimumLength( 12 );
+            cmd.setMaximumLength( 12 );
+            command( cmd, this, SLOT(sendGetInputMenu()) );
+        }
+        break;
+
+        case GetInputMenu_Cyrillic_Entry_2:
+        {
+            cmd.setType( QSimCommand::GetInput );
+            cmd.setDestinationDevice( QSimCommand::ME );
+            cmd.setWantDigits( false );
+            cmd.setUcs2Input( true );
+            cmd.setText( "Enter Hello" );
+            cmd.setMinimumLength( 5 );
+            cmd.setMaximumLength(0xFF);
+            command( cmd, this, SLOT(sendGetInputMenu()) );
+        }
+        break;
+
+        case GetInputMenu_Default_Text_1:
+        {
+            cmd.setType( QSimCommand::GetInput );
+            cmd.setDestinationDevice( QSimCommand::ME );
+            cmd.setWantDigits(true);
+            cmd.setEcho( true );
+            cmd.setText( "Enter 12345" );
+            cmd.setMinimumLength( 5 );
+            cmd.setMaximumLength( 5 );
+            cmd.setDefaultText( "12345" );
+            command( cmd, this, SLOT(sendGetInputMenu()) );
+        }
+        break;
+
+        case GetInputMenu_Default_Text_2:
+        {
+            cmd.setType( QSimCommand::GetInput );
+            cmd.setDestinationDevice( QSimCommand::ME );
+            cmd.setWantDigits(true);
+            cmd.setEcho( true );
+            cmd.setText( "Enter:" );
+            cmd.setMinimumLength( 160 );
+            cmd.setMaximumLength( 160 );
+            cmd.setDefaultText( "***1111111111###***2222222222###***3333333333"
+                                "###***4444444444###***5555555555###***6666666"
+                                "666###***7777777777###***8888888888###***9999"
+                                "999999###***0000000000###" );
+            command( cmd, this, SLOT(sendGetInputMenu()) );
+        }
+        break;
+
+        case GetInputMenu_Icon:
+        {
+            sendGetInputIconMenu();
+        }
+        break;
+
+        case GetInputMenu_Help:
+        {
+            cmd.setType( QSimCommand::GetInput );
+            cmd.setDestinationDevice( QSimCommand::ME );
+            cmd.setWantDigits(true);
+            cmd.setEcho( true );
+            cmd.setHasHelp( true );
+            cmd.setText( "Enter 12345" );
+            cmd.setMinimumLength( 5 );
+            cmd.setMaximumLength( 5 );
+            command( cmd, this, SLOT(sendGetInputMenu()) );
+        }
+        break;
+
+        case GetInputMenu_Text_Attribute:
+        {
+            QByteArray ba;
+            ba.resize( 4 );
+            ba[0] = 0x00;
+            ba[1] = 0x0B;
+            ba[2] = 0x00;
+            ba[3] = 0xB4;
+
+            cmd.setType( QSimCommand::GetInput );
+            cmd.setDestinationDevice( QSimCommand::ME );
+            cmd.setWantDigits(true);
+            cmd.setEcho( true );
+            cmd.setText( "Enter 12345" );
+            cmd.setMinimumLength( 5 );
+            cmd.setMaximumLength( 5 );
+            cmd.setTextAttribute( ba );
+            command( cmd, this, SLOT(sendGetInputMenu()) );
+        }
+        break;
+
+        default:
+            endSession();
+        break;
+    }
+}
+
+void ConformanceSimApplication::GetInputNormalMenu( const QSimTerminalResponse& resp )
+{
+    QSimCommand cmd;
+
+    if ( resp.result() != QSimTerminalResponse::Success ) {
+        /* Unknown response - just go back to the main menu. */
+        endSession();
+
+        return;
+    }
+
+    /* Item selected. */
+    switch ( resp.menuItem() ) {
+        case NormalMenu_1_1:
+        {
+            cmd.setType( QSimCommand::GetInput );
+            cmd.setDestinationDevice( QSimCommand::ME );
+            cmd.setWantDigits(true);
+            cmd.setEcho( true );
+            cmd.setText( "Enter 12345" );
+            cmd.setMinimumLength( 5 );
+            cmd.setMaximumLength( 5 );
+            command( cmd, this, SLOT(sendGetInputNormalMenu()) );
+        }
+        break;
+
+        case NormalMenu_1_2:
+        {
+            cmd.setType( QSimCommand::GetInput );
+            cmd.setDestinationDevice( QSimCommand::ME );
+            cmd.setWantDigits(true);
+            cmd.setEcho( true );
+            cmd.setPackedInput( true );
+            cmd.setText( "Enter 67*#+" );
+            cmd.setMinimumLength( 5 );
+            cmd.setMaximumLength( 5 );
+            command( cmd, this, SLOT(sendGetInputNormalMenu()),
+                    QSimCommand::PackedStrings );
+        }
+        break;
+
+        case NormalMenu_1_3:
+        {
+            cmd.setType( QSimCommand::GetInput );
+            cmd.setDestinationDevice( QSimCommand::ME );
+            cmd.setWantDigits( false );
+            cmd.setEcho( true );
+            cmd.setText( "Enter AbCdE" );
+            cmd.setMinimumLength( 5 );
+            cmd.setMaximumLength( 5 );
+            command( cmd, this, SLOT(sendGetInputNormalMenu()) );
+        }
+        break;
+
+        case NormalMenu_1_4:
+        {
+            cmd.setType( QSimCommand::GetInput );
+            cmd.setDestinationDevice( QSimCommand::ME );
+            cmd.setWantDigits(true);
+            cmd.setUcs2Input( false );
+            cmd.setEcho( false );
+            cmd.setText( "Password 1<SEND>2345678" );
+            cmd.setMinimumLength( 4 );
+            cmd.setMaximumLength( 8 );
+            command( cmd, this, SLOT(sendGetInputNormalMenu()) );
+        }
+        break;
+
+        case NormalMenu_1_5:
+        {
+            cmd.setType( QSimCommand::GetInput );
+            cmd.setDestinationDevice( QSimCommand::ME );
+            cmd.setWantDigits(true);
+            cmd.setEcho( true );
+            cmd.setText( "Enter 1..9,0..9,0(1)" );
+            cmd.setMinimumLength( 1 );
+            cmd.setMaximumLength( 20 );
+            command( cmd, this, SLOT(sendGetInputNormalMenu()) );
+        }
+        break;
+
+        case NormalMenu_1_6:
+        {
+            cmd.setType( QSimCommand::GetInput );
+            cmd.setDestinationDevice( QSimCommand::ME );
+            cmd.setWantDigits(true);
+            cmd.setEcho( true );
+            cmd.setText( "<GO-BACKWARDS>" );
+            cmd.setMinimumLength( 0 );
+            cmd.setMaximumLength( 8 );
+            command( cmd, this, SLOT(sendGetInputNormalMenu()) );
+        }
+        break;
+
+        case NormalMenu_1_7:
+        {
+            cmd.setType( QSimCommand::GetInput );
+            cmd.setDestinationDevice( QSimCommand::ME );
+            cmd.setWantDigits(true);
+            cmd.setEcho( true );
+            cmd.setText( "<ABORT>" );
+            cmd.setMinimumLength( 0 );
+            cmd.setMaximumLength( 8 );
+            command( cmd, this, SLOT(sendGetInputNormalMenu()) );
+        }
+        break;
+
+        case NormalMenu_1_8:
+        {
+            cmd.setType( QSimCommand::GetInput );
+            cmd.setDestinationDevice( QSimCommand::ME );
+            cmd.setWantDigits(true);
+            cmd.setEcho( true );
+            cmd.setText( "***1111111111###***2222222222###***3333333333###***44"
+                         "44444444###***5555555555###***6666666666###***7777777"
+                         "777###***8888888888###***9999999999###***0000000000###" );
+            cmd.setMinimumLength( 160 );
+            cmd.setMaximumLength( 160 );
+            command( cmd, this, SLOT(sendGetInputNormalMenu()) );
+        }
+        break;
+
+        case NormalMenu_1_9:
+        {
+            cmd.setType( QSimCommand::GetInput );
+            cmd.setDestinationDevice( QSimCommand::ME );
+            cmd.setWantDigits(true);
+            cmd.setEcho( true );
+            cmd.setText( "<SEND>" );
+            cmd.setMinimumLength( 0 );
+            cmd.setMaximumLength( 1 );
+            command( cmd, this, SLOT(sendGetInputNormalMenu()) );
+        }
+        break;
+
+        case NormalMenu_1_10:
+        {
+            cmd.setType( QSimCommand::GetInput );
+            cmd.setDestinationDevice( QSimCommand::ME );
+            cmd.setWantDigits(true);
+            cmd.setEcho( true );
+            cmd.setText( QString() );
+            cmd.setMinimumLength( 1 );
+            cmd.setMaximumLength( 5 );
+            command( cmd, this, SLOT(sendGetInputNormalMenu()) );
+        }
+        break;
+
+        case NormalMenu_1_11:
+        {
+            cmd.setType( QSimCommand::GetInput );
+            cmd.setDestinationDevice( QSimCommand::ME );
+            cmd.setWantDigits(true);
+            cmd.setEcho( true );
+            cmd.setText( "" );
+            cmd.setMinimumLength( 1 );
+            cmd.setMaximumLength( 5 );
+            command( cmd, this, SLOT(sendGetInputNormalMenu()) );
+        }
+        break;
+
+        case NormalMenu_Main:
+        {
+            sendGetInputMenu();
+        }
+        break;
+
+        default:
+            endSession();
+        break;
+    }
+}
+
+void ConformanceSimApplication::GetInputIconMenu( const QSimTerminalResponse& resp )
+{
+    QSimCommand cmd;
+
+    if ( resp.result() != QSimTerminalResponse::Success ) {
+        /* Unknown response - just go back to the main menu. */
+        endSession();
+
+        return;
+    }
+
+    /* Item selected. */
+    switch ( resp.menuItem() ) {
+        case IconMenu_1A:
+        {
+            cmd.setType( QSimCommand::GetInput );
+            cmd.setDestinationDevice( QSimCommand::ME );
+            cmd.setWantDigits(true);
+            cmd.setText( "<NO-ICON>" );
+            cmd.setMinimumLength( 0 );
+            cmd.setMaximumLength( 10 );
+            cmd.setIconId( 1 );
+            cmd.setIconSelfExplanatory( true );
+            command( cmd, this, SLOT(sendGetInputIconMenu()) );
+        }
+        break;
+
+        case IconMenu_2A:
+        {
+            cmd.setType( QSimCommand::GetInput );
+            cmd.setDestinationDevice( QSimCommand::ME );
+            cmd.setWantDigits(true);
+            cmd.setText( "<BASIC-ICON>" );
+            cmd.setMinimumLength( 0 );
+            cmd.setMaximumLength( 10 );
+            cmd.setIconId( 1 );
+            command( cmd, this, SLOT(sendGetInputIconMenu()) );
+        }
+        break;
+
+        case IconMenu_3A:
+        {
+            cmd.setType( QSimCommand::GetInput );
+            cmd.setDestinationDevice( QSimCommand::ME );
+            cmd.setWantDigits(true);
+            cmd.setText( "<NO-ICON>" );
+            cmd.setMinimumLength( 0 );
+            cmd.setMaximumLength( 10 );
+            cmd.setIconId( 2 );
+            cmd.setIconSelfExplanatory( true );
+            command( cmd, this, SLOT(sendGetInputIconMenu()) );
+        }
+        break;
+
+        case IconMenu_4A:
+        {
+            cmd.setType( QSimCommand::GetInput );
+            cmd.setDestinationDevice( QSimCommand::ME );
+            cmd.setWantDigits(true);
+            cmd.setText( "<COLOUR-ICON>" );
+            cmd.setIconId( 2 );
+            cmd.setMinimumLength( 0 );
+            cmd.setMaximumLength( 10 );
+            command( cmd, this, SLOT(sendGetInputIconMenu()) );
+        }
+        break;
+
+        case IconMenu_5A:
+        {
+            cmd.setType( QSimCommand::GetInput );
+            cmd.setDestinationDevice( QSimCommand::ME );
+            cmd.setWantDigits(true);
+            cmd.setText( "" );
+            cmd.setMinimumLength( 0 );
+            cmd.setMaximumLength( 10 );
+            cmd.setIconId( 1 );
+            command( cmd, this, SLOT(sendGetInputIconMenu()) );
+        }
+        break;
+
+        case IconMenu_6A:
+        {
+            cmd.setType( QSimCommand::GetInput );
+            cmd.setDestinationDevice( QSimCommand::ME );
+            cmd.setWantDigits(true);
+            cmd.setText( QString() );
+            cmd.setMinimumLength( 0 );
+            cmd.setMaximumLength( 10 );
+            cmd.setIconId( 1 );
+            command( cmd, this, SLOT(sendGetInputIconMenu()) );
+        }
+        break;
+
+        case IconMenu_Main:
+        {
+            sendGetInputMenu();
+        }
+        break;
+
+        default:
+            endSession();
+        break;
+    }
+}
\ No newline at end of file
diff --git a/src/simapplication.h b/src/simapplication.h
index 0dcad38..61250e5 100644
--- a/src/simapplication.h
+++ b/src/simapplication.h
@@ -163,6 +163,12 @@ protected slots:
     void sendGetInkeyIconMenu();
     void GetInkeyIconMenu( const QSimTerminalResponse& resp );
     void sendHelpInfo( const QSimTerminalResponse& resp );
+    void sendGetInputMenu();
+    void GetInputMenu( const QSimTerminalResponse& resp );
+    void GetInputNormalMenu( const QSimTerminalResponse& resp );
+    void sendGetInputNormalMenu();
+    void sendGetInputIconMenu();
+    void GetInputIconMenu( const QSimTerminalResponse& resp );
 };
 
 #endif
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 6/6] phonesim: Add MoreTime test case
  2011-01-11 14:16 [PATCH 0/6] Add conformance sim application Jeevaka Badrappan
                   ` (4 preceding siblings ...)
  2011-01-11 14:16 ` [PATCH 5/6] phonesim: Add Get Input " Jeevaka Badrappan
@ 2011-01-11 14:16 ` Jeevaka Badrappan
  2011-01-12 23:27 ` [PATCH 0/6] Add conformance sim application Denis Kenzior
  6 siblings, 0 replies; 8+ messages in thread
From: Jeevaka Badrappan @ 2011-01-11 14:16 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 1642 bytes --]

---
 src/conformancesimapplication.cpp |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/src/conformancesimapplication.cpp b/src/conformancesimapplication.cpp
index f51d36c..5eb9d07 100644
--- a/src/conformancesimapplication.cpp
+++ b/src/conformancesimapplication.cpp
@@ -40,6 +40,7 @@ const QString ConformanceSimApplication::getName()
 #define ConformanceMenu_DisplayText 1
 #define ConformanceMenu_GetInkey    2
 #define ConformanceMenu_GetInput    3
+#define ConformanceMenu_MoreTime    4
 
 #define NormalMenu_1_1    1
 #define NormalMenu_1_2    2
@@ -119,6 +120,10 @@ void ConformanceSimApplication::mainMenu()
     item.setLabel( "Get Input" );
     items += item;
 
+    item.setIdentifier( ConformanceMenu_MoreTime );
+    item.setLabel( "More Time" );
+    items += item;
+
     cmd.setMenuItems( items );
 
     command( cmd, 0, 0 );
@@ -126,6 +131,8 @@ void ConformanceSimApplication::mainMenu()
 
 void ConformanceSimApplication::mainMenuSelection( int id )
 {
+    QSimCommand cmd;
+
     switch ( id ) {
         case ConformanceMenu_DisplayText:
         {
@@ -145,6 +152,14 @@ void ConformanceSimApplication::mainMenuSelection( int id )
         }
         break;
 
+        case ConformanceMenu_MoreTime:
+        {
+            cmd.setType( QSimCommand::MoreTime );
+            cmd.setDestinationDevice( QSimCommand::ME );
+            command( cmd, this, SLOT(endSession()) );
+        }
+        break;
+
         default:
         {
             // Don't know what this item is, so just re-display the main menu.
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH 0/6] Add conformance sim application
  2011-01-11 14:16 [PATCH 0/6] Add conformance sim application Jeevaka Badrappan
                   ` (5 preceding siblings ...)
  2011-01-11 14:16 ` [PATCH 6/6] phonesim: Add MoreTime test case Jeevaka Badrappan
@ 2011-01-12 23:27 ` Denis Kenzior
  6 siblings, 0 replies; 8+ messages in thread
From: Denis Kenzior @ 2011-01-12 23:27 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 498 bytes --]

Hi Jeevaka,

On 01/11/2011 08:16 AM, Jeevaka Badrappan wrote:
> Hi,
> 
>  Following set of patches adds the ui support for selecting
> sim applications and also adds conformance sim application.
> DisplayText, Get Inkey, Get Input and MoreTime test cases
> are added to the conformance sim application. Logging of the
> result in a file can be done but it is not part of this patch.
> 
> Regards,
> Jeevaka
> 

Looks good to me, all 6 patches have been applied.

Regards,
-Denis

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2011-01-12 23:27 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-11 14:16 [PATCH 0/6] Add conformance sim application Jeevaka Badrappan
2011-01-11 14:16 ` [PATCH 1/6] phonesim: add ui support for sim app selection Jeevaka Badrappan
2011-01-11 14:16 ` [PATCH 2/6] phonesim: Add conformance sim application Jeevaka Badrappan
2011-01-11 14:16 ` [PATCH 3/6] phonesim: Add DisplayText test cases Jeevaka Badrappan
2011-01-11 14:16 ` [PATCH 4/6] phonesim: Add Get Inkey " Jeevaka Badrappan
2011-01-11 14:16 ` [PATCH 5/6] phonesim: Add Get Input " Jeevaka Badrappan
2011-01-11 14:16 ` [PATCH 6/6] phonesim: Add MoreTime test case Jeevaka Badrappan
2011-01-12 23:27 ` [PATCH 0/6] Add conformance sim application Denis Kenzior

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.