Open Source Telephony
 help / color / mirror / Atom feed
From: Nicolas Bertrand <nicolas.bertrand@linux.intel.com>
To: ofono@ofono.org
Subject: [PATCH 1/3] phonesim: accept STK command without application
Date: Fri, 24 Aug 2012 10:32:33 +0200	[thread overview]
Message-ID: <1345797155-27517-2-git-send-email-nicolas.bertrand@linux.intel.com> (raw)
In-Reply-To: <1345797155-27517-1-git-send-email-nicolas.bertrand@linux.intel.com>

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

If the STK command is rightly formated, send OK even if
the sim application does not handle it. it's needed to
be able to manualy send STK command.
---
 src/phonesim.cpp |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/phonesim.cpp b/src/phonesim.cpp
index 276ae47..aa4f8a2 100644
--- a/src/phonesim.cpp
+++ b/src/phonesim.cpp
@@ -985,8 +985,10 @@ bool SimRules::simCommand( const QString& cmd )
         QByteArray response = QAtUtils::fromHex( cmd.mid(start) );
         QSimTerminalResponse resp = QSimTerminalResponse::fromPdu( response );
 
-        if ( !toolkitApp || !toolkitApp->response( resp ) )
+        if ( ( resp.command().type() == QSimCommand::NoCommand ) || !toolkitApp )
             respond( "ERROR" );
+        else if ( !toolkitApp->response( resp ) )
+            respond( "OK" );
 
         return true;
     }
@@ -997,8 +999,10 @@ bool SimRules::simCommand( const QString& cmd )
         QByteArray envelope = QAtUtils::fromHex( cmd.mid(start) );
         QSimEnvelope env = QSimEnvelope::fromPdu( envelope );
 
-        if (!toolkitApp || !toolkitApp->envelope( env ) )
+        if ( ( env.type() == QSimEnvelope::NoEnvelope ) || !toolkitApp )
             respond( "ERROR" );
+        else if ( !toolkitApp->envelope( env ) )
+            respond( "OK" );
 
         return true;
     }
-- 
1.7.9.5


  reply	other threads:[~2012-08-24  8:32 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-24  8:32 [PATCH 0/3] Add STK APDU editor Nicolas Bertrand
2012-08-24  8:32 ` Nicolas Bertrand [this message]
2012-08-24  8:32 ` [PATCH 2/3] controlbase_ui: Add manual stk command editor Nicolas Bertrand
2012-08-24  8:32 ` [PATCH 3/3] control: Link functionnality to STK " Nicolas Bertrand
2012-08-28 14:47 ` [PATCH 0/3] Add STK APDU editor 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=1345797155-27517-2-git-send-email-nicolas.bertrand@linux.intel.com \
    --to=nicolas.bertrand@linux.intel.com \
    --cc=ofono@ofono.org \
    /path/to/YOUR_REPLY

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

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