Open Source Telephony
 help / color / mirror / Atom feed
From: Andrzej Zaborowski <andrew.zaborowski@intel.com>
To: ofono@ofono.org
Subject: [PATCH 2/2] phonesim: Add SIM Refresh commands to sim app menu.
Date: Tue, 23 Nov 2010 14:34:46 +0100	[thread overview]
Message-ID: <1290519286-25046-2-git-send-email-andrew.zaborowski@intel.com> (raw)
In-Reply-To: <1290519286-25046-1-git-send-email-andrew.zaborowski@intel.com>

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

---
 src/simapplication.cpp |  104 ++++++++++++++++++++++++++++++++++++++++++++++++
 src/simapplication.h   |    2 +
 2 files changed, 106 insertions(+), 0 deletions(-)

diff --git a/src/simapplication.cpp b/src/simapplication.cpp
index d9e3b77..5f99490 100644
--- a/src/simapplication.cpp
+++ b/src/simapplication.cpp
@@ -289,6 +289,7 @@ const QString DemoSimApplication::getName()
 #define MainMenu_SendSMS    14
 #define MainMenu_Polling    15
 #define MainMenu_Timers     16
+#define MainMenu_Refresh    17
 
 #define SportsMenu_Chess        1
 #define SportsMenu_Painting     2
@@ -438,6 +439,10 @@ void DemoSimApplication::mainMenu()
     item.setLabel( "Timers" );
     items += item;
 
+    item.setIdentifier( MainMenu_Refresh );
+    item.setLabel( "SIM Refresh" );
+    items += item;
+
     cmd.setMenuItems( items );
 
     command( cmd, 0, 0 );
@@ -568,6 +573,12 @@ void DemoSimApplication::mainMenuSelection( int id )
         }
         break;
 
+        case MainMenu_Refresh:
+        {
+            sendRefreshMenu();
+        }
+        break;
+
         default:
         {
             // Don't know what this item is, so just re-display the main menu.
@@ -2215,3 +2226,96 @@ bool DemoSimApplication::envelope( const QSimEnvelope& env )
 
     return true;
 }
+
+void DemoSimApplication::sendRefreshMenu()
+{
+    QSimCommand cmd;
+    QSimMenuItem item;
+    QList<QSimMenuItem> items;
+
+    cmd.setType( QSimCommand::SelectItem );
+    cmd.setTitle( "SIM Refresh menu" );
+
+    /* Use qualifier value + 1 for id */
+    item.setIdentifier( 1 );
+    item.setLabel( "NAA Initialization+Full File Change Notification" );
+    items += item;
+
+    item.setIdentifier( 2 );
+    item.setLabel( "File Change Notification (EFmsisdn,EFecc,EFfdn)" );
+    items += item;
+
+    item.setIdentifier( 3 );
+    item.setLabel( "NAA Initialization+File Change Notification" );
+    items += item;
+
+    item.setIdentifier( 4 );
+    item.setLabel( "NAA Initialization" );
+    items += item;
+
+    item.setIdentifier( 5 );
+    item.setLabel( "UICC Reset" );
+    items += item;
+
+    item.setIdentifier( 6 );
+    item.setLabel( "NAA Application Reset" );
+    items += item;
+
+    item.setIdentifier( 7 );
+    item.setLabel( "NAA Session Reset" );
+    items += item;
+
+    cmd.setMenuItems( items );
+
+    command( cmd, this, SLOT(refreshMenuResp(QSimTerminalResponse)) );
+}
+
+void DemoSimApplication::refreshMenuResp( const QSimTerminalResponse& resp )
+{
+    QSimCommand cmd;
+
+    if ( resp.result() != QSimTerminalResponse::Success ) {
+        /* Unknown response - just go back to the main menu. */
+        endSession();
+
+        return;
+    }
+
+    /* Item selected. */
+
+    cmd.setType( QSimCommand::Refresh );
+    cmd.setQualifier( resp.menuItem() - 1 );
+    cmd.setDestinationDevice( QSimCommand::ME );
+    cmd.setText( "" );
+
+    if ( cmd.refreshType() == QSimCommand::FileChange ||
+            cmd.refreshType() == QSimCommand::InitAndFileChange ||
+            cmd.refreshType() == QSimCommand::NaaSessionReset ) {
+        QByteArray files;
+        files += (char) 0x03;
+        /* EFmsisdn */
+        files += (char) 0x3f;
+        files += (char) 0x00;
+        files += (char) 0x7f;
+        files += (char) 0xff;
+        files += (char) 0x6f;
+        files += (char) 0x40;
+        /* EFecc */
+        files += (char) 0x3f;
+        files += (char) 0x00;
+        files += (char) 0x7f;
+        files += (char) 0xff;
+        files += (char) 0x6f;
+        files += (char) 0xb7;
+        /* EFfdn */
+        files += (char) 0x3f;
+        files += (char) 0x00;
+        files += (char) 0x7f;
+        files += (char) 0xff;
+        files += (char) 0x6f;
+        files += (char) 0x3b;
+        cmd.addExtensionField( 0x92, files );
+    }
+
+    command( cmd, this, SLOT(endSession()) );
+}
diff --git a/src/simapplication.h b/src/simapplication.h
index dbf061d..076a668 100644
--- a/src/simapplication.h
+++ b/src/simapplication.h
@@ -124,6 +124,8 @@ protected slots:
     void sendTimersMenu();
     void timersMenuResp( const QSimTerminalResponse& resp );
     void timersCmdResp( const QSimTerminalResponse& resp );
+    void sendRefreshMenu();
+    void refreshMenuResp( const QSimTerminalResponse& resp );
 
 private:
     int sticksLeft;
-- 
1.7.1.86.g0e460.dirty


  reply	other threads:[~2010-11-23 13:34 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-23 13:34 [PATCH 1/2] phonesim: Add Timer Management commands to sim app menu Andrzej Zaborowski
2010-11-23 13:34 ` Andrzej Zaborowski [this message]
2010-11-25 22:51   ` [PATCH 2/2] phonesim: Add SIM Refresh " Denis Kenzior
2010-11-25 22:50 ` [PATCH 1/2] phonesim: Add Timer Management " Denis Kenzior

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1290519286-25046-2-git-send-email-andrew.zaborowski@intel.com \
    --to=andrew.zaborowski@intel.com \
    --cc=ofono@ofono.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox