aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDenis Kenzior <denkenz@gmail.com>2011-08-11 00:44:36 -0500
committerDenis Kenzior <denkenz@gmail.com>2011-08-11 00:55:30 -0500
commit2902eb07ea37e80119c6a5e6521bc312893a1f41 (patch)
treee30b7b0efbf5ee969ff943b3fb8541bbffcdeb7e
parent92f3676549b5d6347a10dabb0be0a413114d7e45 (diff)
downloadphonesim-2902eb07ea37e80119c6a5e6521bc312893a1f41.tar.gz
simapp: Use 3GPP +CUSATT and +CUSATP and +CUSATEND
-rw-r--r--src/phonesim.cpp17
-rw-r--r--src/simapplication.cpp28
2 files changed, 19 insertions, 26 deletions
diff --git a/src/phonesim.cpp b/src/phonesim.cpp
index b029a55..4790e72 100644
--- a/src/phonesim.cpp
+++ b/src/phonesim.cpp
@@ -961,16 +961,15 @@ bool SimRules::simCsimOk( const QByteArray& payload )
bool SimRules::simCommand( const QString& cmd )
{
- /* Process SIM toolkit begin and end commands by forcing the
- * app back to the main menu. */
- if ( cmd == "AT*TSTB" || cmd == "AT*TSTE" ) {
- if ( !toolkitApp ) {
+ // 3GPP Terminal Response Command
+ if ( cmd.startsWith("AT+CUSATT=") ) {
+ int start = cmd.indexOf( QChar('=') ) + 1;
+ QByteArray response = QAtUtils::fromHex( cmd.mid(start) );
+ QSimTerminalResponse resp = QSimTerminalResponse::fromPdu( response );
+
+ if ( !toolkitApp || !toolkitApp->response( resp ) )
respond( "ERROR" );
- return true;
- }
- respond( "OK" );
- toolkitApp->abort();
return true;
}
@@ -1599,7 +1598,7 @@ void SimRules::respond( const QString& resp, int delay, bool eol )
void SimRules::proactiveCommandNotify( const QByteArray& cmd )
{
- unsolicited( "*TCMD: " + QString::number( cmd.size() ) );
+ unsolicited( "+CUSATP: " + QAtUtils::toHex( cmd ) );
}
void SimRules::callControlEventNotify( const QSimControlEvent& evt )
diff --git a/src/simapplication.cpp b/src/simapplication.cpp
index f098b8a..4cd73a5 100644
--- a/src/simapplication.cpp
+++ b/src/simapplication.cpp
@@ -232,22 +232,16 @@ bool SimApplication::response( const QSimTerminalResponse& resp )
// Answer the AT+CSIM command and send notification of the new command.
if ( !d->rules )
- return false;////
- if ( d->currentCommand.isEmpty() || resp.command().type() == QSimCommand::SetupMenu ) {
- // No new command, so respond with a simple OK.
- d->rules->respond( "+CSIM: 4,9000\\n\\nOK" );
- } else {
- // There is a new command, so send back 91XX to the TERMINAL RESPONSE
- // or ENVELOPE request to indicate that we have another command to
- // be fetched. Then send the unsolicited "*TCMD" notification.
- QByteArray data;
- data += (char)0x91;
- data += (char)(d->currentCommand.size());
- d->rules->respond( "+CSIM: " + QString::number( data.size() * 2 ) + "," +
- QAtUtils::toHex( data ) + "\\n\\nOK" );
- d->rules->unsolicited
- ( "*TCMD: " + QString::number( d->currentCommand.size() ) );
- }
+ return false;
+
+ d->rules->respond("OK");
+
+ // No new command
+ if ( d->currentCommand.isEmpty() ||
+ resp.command().type() == QSimCommand::SetupMenu )
+ return true;
+
+ d->rules->proactiveCommandNotify( d->currentCommand );
return true;
}
@@ -255,7 +249,7 @@ bool SimApplication::response( const QSimTerminalResponse& resp )
void SimApplication::endSession()
{
d->expectedType = QSimCommand::SetupMenu;
- d->rules->unsolicited("*TEND");
+ d->rules->unsolicited( "+CUSATEND" );
}
DemoSimApplication::DemoSimApplication( SimRules *rules, QObject *parent )