* [PATCH 1/4] phonesim: Add Send Short Message commands to sim app menu.
@ 2010-11-21 15:51 Andrzej Zaborowski
2010-11-21 15:51 ` [PATCH 2/4] phonesim: Add SIM Polling " Andrzej Zaborowski
` (3 more replies)
0 siblings, 4 replies; 7+ messages in thread
From: Andrzej Zaborowski @ 2010-11-21 15:51 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 6315 bytes --]
---
src/simapplication.cpp | 148 +++++++++++++++++++++++++++++++++++++++++++++++-
src/simapplication.h | 5 ++
2 files changed, 152 insertions(+), 1 deletions(-)
diff --git a/src/simapplication.cpp b/src/simapplication.cpp
index 7dc580f..9742fd9 100644
--- a/src/simapplication.cpp
+++ b/src/simapplication.cpp
@@ -21,6 +21,7 @@
#include <qatutils.h>
#include <qdebug.h>
#include <QTextCodec>
+#include "qsmsmessage.h"
class SimApplicationPrivate
{
@@ -258,7 +259,8 @@ void SimApplication::endSession()
}
DemoSimApplication::DemoSimApplication( SimRules *rules, QObject *parent )
- : SimApplication( rules, parent )
+ : SimApplication( rules, parent ), smsDestNumber( "12345" ),
+ smsText( "Hello" )
{
}
@@ -284,6 +286,7 @@ const QString DemoSimApplication::getName()
#define MainMenu_SendSS 11
#define MainMenu_Language 12
#define MainMenu_SendUSSD 13
+#define MainMenu_SendSMS 14
#define SportsMenu_Chess 1
#define SportsMenu_Painting 2
@@ -342,6 +345,13 @@ const QString DemoSimApplication::getName()
#define SendUSSD_Error 4
#define SendUSSD_Main 5
+enum SendSMSMenuItems {
+ SendSMS_Unpacked = 1,
+ SendSMS_Packed,
+ SendSMS_SetDestination,
+ SendSMS_SetContents,
+};
+
void DemoSimApplication::mainMenu()
{
QSimCommand cmd;
@@ -402,6 +412,10 @@ void DemoSimApplication::mainMenu()
item.setLabel( "Send USSD" );
items += item;
+ item.setIdentifier( MainMenu_SendSMS );
+ item.setLabel( "Send SMS request" );
+ items += item;
+
cmd.setMenuItems( items );
command( cmd, 0, 0 );
@@ -514,6 +528,12 @@ void DemoSimApplication::mainMenuSelection( int id )
}
break;
+ case MainMenu_SendSMS:
+ {
+ sendSMSMenu();
+ }
+ break;
+
default:
{
// Don't know what this item is, so just re-display the main menu.
@@ -1832,3 +1852,129 @@ void DemoSimApplication::USSDMenu( const QSimTerminalResponse& resp )
endSession();
}
}
+
+void DemoSimApplication::sendSMSMenu()
+{
+ QSimCommand cmd;
+ QSimMenuItem item;
+ QList<QSimMenuItem> items;
+
+ cmd.setType( QSimCommand::SelectItem );
+ cmd.setTitle( "Send SMS" );
+
+ item.setIdentifier( SendSMS_Unpacked );
+ item.setLabel( "Unpacked" );
+ items += item;
+
+ item.setIdentifier( SendSMS_Packed );
+ item.setLabel( "Packed text" );
+ items += item;
+
+ item.setIdentifier( SendSMS_SetDestination );
+ item.setLabel( "Set destination (" + smsDestNumber + ")" );
+ items += item;
+
+ item.setIdentifier( SendSMS_SetContents );
+ item.setLabel( "Set content text" );
+ items += item;
+
+ cmd.setMenuItems( items );
+
+ command( cmd, this, SLOT(smsMenuResp(QSimTerminalResponse)) );
+}
+
+void DemoSimApplication::smsMenuResp( 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 SendSMS_Unpacked:
+ break;
+
+ case SendSMS_Packed:
+ cmd.setSmsPacking( true );
+ break;
+
+ case SendSMS_SetDestination:
+ cmd.setType( QSimCommand::GetInput );
+ cmd.setText( "Enter recipient number" );
+ cmd.setWantDigits( true );
+ cmd.setMinimumLength( 2 );
+ cmd.setMaximumLength( 20 );
+ cmd.setDefaultText( smsDestNumber );
+ command( cmd, this, SLOT(smsSetDestResp(QSimTerminalResponse)) );
+ return;
+
+ case SendSMS_SetContents:
+ cmd.setType( QSimCommand::GetInput );
+ cmd.setText( "Enter message text" );
+ cmd.setMaximumLength( 100 );
+ cmd.setDefaultText( smsText );
+ command( cmd, this, SLOT(smsSetTextResp(QSimTerminalResponse)) );
+ return;
+ }
+
+ QSMSMessage sms;
+ sms.setValidityPeriod( -1 );
+ sms.setMessageClass( 2 );
+ sms.setProtocol( 0 );
+ sms.setRecipient( smsDestNumber );
+ sms.setText( smsText );
+ sms.setForceGsm( false );
+ sms.setBestScheme( QSMS_8BitAlphabet );
+ sms.setDataCodingScheme( 0xf6 );
+
+ cmd.setType( QSimCommand::SendSMS );
+ cmd.setText( "Sending an SMS to our friends at " + smsDestNumber );
+ cmd.setNumber( "123" );
+ cmd.addExtensionField( 0x8b, sms.toPdu().mid( 1 ) );
+ cmd.setDestinationDevice( QSimCommand::Network );
+
+ command( cmd, this, SLOT(endSession()) );
+}
+
+void DemoSimApplication::smsSetDestResp( const QSimTerminalResponse& resp )
+{
+ if ( resp.result() == QSimTerminalResponse::BackwardMove ) {
+ sendSMSMenu();
+
+ return;
+ }
+
+ if ( resp.result() != QSimTerminalResponse::Success ) {
+ /* Unknown response - just go back to the main menu. */
+ endSession();
+
+ return;
+ }
+
+ smsDestNumber = resp.text();
+ sendSMSMenu();
+}
+
+void DemoSimApplication::smsSetTextResp( const QSimTerminalResponse& resp )
+{
+ if ( resp.result() == QSimTerminalResponse::BackwardMove ) {
+ sendSMSMenu();
+
+ return;
+ }
+
+ if ( resp.result() != QSimTerminalResponse::Success ) {
+ /* Unknown response - just go back to the main menu. */
+ endSession();
+
+ return;
+ }
+
+ smsText = resp.text();
+ sendSMSMenu();
+}
diff --git a/src/simapplication.h b/src/simapplication.h
index 9d147ee..326c4dc 100644
--- a/src/simapplication.h
+++ b/src/simapplication.h
@@ -113,10 +113,15 @@ protected slots:
void languageMenu( const QSimTerminalResponse& resp );
void sendUSSDMenu();
void USSDMenu( const QSimTerminalResponse& resp );
+ void sendSMSMenu();
+ void smsMenuResp( const QSimTerminalResponse& resp );
+ void smsSetDestResp( const QSimTerminalResponse& resp );
+ void smsSetTextResp( const QSimTerminalResponse& resp );
private:
int sticksLeft;
bool immediateResponse;
+ QString smsDestNumber, smsText;
};
#endif
--
1.7.1.86.g0e460.dirty
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/4] phonesim: Add SIM Polling commands to sim app menu.
2010-11-21 15:51 [PATCH 1/4] phonesim: Add Send Short Message commands to sim app menu Andrzej Zaborowski
@ 2010-11-21 15:51 ` Andrzej Zaborowski
2010-11-22 15:13 ` Denis Kenzior
2010-11-21 15:51 ` [PATCH 3/4] phonesim: Add Timer Management " Andrzej Zaborowski
` (2 subsequent siblings)
3 siblings, 1 reply; 7+ messages in thread
From: Andrzej Zaborowski @ 2010-11-21 15:51 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 3483 bytes --]
---
src/simapplication.cpp | 66 ++++++++++++++++++++++++++++++++++++++++++++++++
src/simapplication.h | 2 +
3 files changed, 72 insertions(+), 4 deletions(-)
diff --git a/src/simapplication.cpp b/src/simapplication.cpp
index 9742fd9..290ec2a 100644
--- a/src/simapplication.cpp
+++ b/src/simapplication.cpp
@@ -287,6 +287,7 @@ const QString DemoSimApplication::getName()
#define MainMenu_Language 12
#define MainMenu_SendUSSD 13
#define MainMenu_SendSMS 14
+#define MainMenu_Polling 15
#define SportsMenu_Chess 1
#define SportsMenu_Painting 2
@@ -352,6 +353,11 @@ enum SendSMSMenuItems {
SendSMS_SetContents,
};
+enum PollingMenuItems {
+ Polling_Off = 1,
+ Polling_30s,
+};
+
void DemoSimApplication::mainMenu()
{
QSimCommand cmd;
@@ -416,6 +422,10 @@ void DemoSimApplication::mainMenu()
item.setLabel( "Send SMS request" );
items += item;
+ item.setIdentifier( MainMenu_Polling );
+ item.setLabel( "SIM Polling" );
+ items += item;
+
cmd.setMenuItems( items );
command( cmd, 0, 0 );
@@ -534,6 +544,12 @@ void DemoSimApplication::mainMenuSelection( int id )
}
break;
+ case MainMenu_Polling:
+ {
+ sendPollingMenu();
+ }
+ break;
+
default:
{
// Don't know what this item is, so just re-display the main menu.
@@ -1978,3 +1994,53 @@ void DemoSimApplication::sendSMSSetTextResp( const QSimTerminalResponse& resp )
smsText = resp.text();
sendSMSMenu();
}
+
+void DemoSimApplication::sendPollingMenu()
+{
+ QSimCommand cmd;
+ QSimMenuItem item;
+ QList<QSimMenuItem> items;
+
+ cmd.setType( QSimCommand::SelectItem );
+ cmd.setTitle( "Polling Menu" );
+
+ item.setIdentifier( Polling_Off );
+ item.setLabel( "Polling Off" );
+ items += item;
+
+ item.setIdentifier( Polling_30s );
+ item.setLabel( "Poll Interval of 30s" );
+ items += item;
+
+ cmd.setMenuItems( items );
+
+ command( cmd, this, SLOT(pollingMenuResp(QSimTerminalResponse)) );
+}
+
+void DemoSimApplication::pollingMenuResp( 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 Polling_Off:
+ cmd.setType( QSimCommand::PollingOff );
+ cmd.setDestinationDevice( QSimCommand::ME );
+ command( cmd, this, SLOT(endSession()) );
+ break;
+
+ case Polling_30s:
+ cmd.setType( QSimCommand::PollInterval );
+ cmd.setDuration( 30000 );
+ cmd.setDestinationDevice( QSimCommand::ME );
+ command( cmd, this, SLOT(endSession()) );
+ break;
+ }
+}
diff --git a/src/simapplication.h b/src/simapplication.h
index 326c4dc..1d6293f 100644
--- a/src/simapplication.h
+++ b/src/simapplication.h
@@ -117,6 +117,8 @@ protected slots:
void smsMenuResp( const QSimTerminalResponse& resp );
void smsSetDestResp( const QSimTerminalResponse& resp );
void smsSetTextResp( const QSimTerminalResponse& resp );
+ void sendPollingMenu();
+ void pollingMenuResp( const QSimTerminalResponse& resp );
private:
int sticksLeft;
--
1.7.1.86.g0e460.dirty
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 3/4] phonesim: Add Timer Management commands to sim app menu.
2010-11-21 15:51 [PATCH 1/4] phonesim: Add Send Short Message commands to sim app menu Andrzej Zaborowski
2010-11-21 15:51 ` [PATCH 2/4] phonesim: Add SIM Polling " Andrzej Zaborowski
@ 2010-11-21 15:51 ` Andrzej Zaborowski
2010-11-22 15:09 ` Denis Kenzior
2010-11-21 15:51 ` [PATCH 4/4] phonesim: Add SIM Refresh " Andrzej Zaborowski
2010-11-22 15:12 ` [PATCH 1/4] phonesim: Add Send Short Message " Denis Kenzior
3 siblings, 1 reply; 7+ messages in thread
From: Andrzej Zaborowski @ 2010-11-21 15:51 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 15778 bytes --]
---
src/qsimcommand.cpp | 83 ++++++++++++++++++++
src/qsimcommand.h | 3 +
src/qsimterminalresponse.cpp | 59 ++++++++++++++
src/qsimterminalresponse.h | 3 +
src/simapplication.cpp | 171 ++++++++++++++++++++++++++++++++++++++++++
src/simapplication.h | 6 ++
6 files changed, 325 insertions(+), 0 deletions(-)
diff --git a/src/qsimcommand.cpp b/src/qsimcommand.cpp
index 44bdd9a..9d9e689 100644
--- a/src/qsimcommand.cpp
+++ b/src/qsimcommand.cpp
@@ -66,6 +66,7 @@ public:
defaultItem = 0;
iconId = 0;
otherIconId = 0;
+ timerId = 0;
device = -1;
qualifier = 0;
}
@@ -97,6 +98,7 @@ public:
language = other->language;
iconId = other->iconId;
otherIconId = other->otherIconId;
+ timerId = other->timerId;
device = other->device;
qualifier = other->qualifier;
extensionData = other->extensionData;
@@ -159,6 +161,7 @@ public:
QString language;
uint iconId;
uint otherIconId;
+ uint timerId;
int device;
int qualifier;
QByteArray extensionData;
@@ -2173,6 +2176,33 @@ void QSimCommand::setSmsPacking( bool value )
}
/*!
+ Returns the number of the timer to which a Timer Management command is
+ addressed.
+
+ Applies to: \c TimerManagement
+
+ \sa setTimerId()
+*/
+int QSimCommand::timerId() const
+{
+ return d->timerId;
+}
+
+/*!
+ Sets the identifier of the timer to which the Timer Management command
+ is being sent. \a id should be between 1 and 8 to address one of the
+ eight timers available.
+
+ Applies to: \c TimerManagement
+
+ \sa timerId()
+*/
+void QSimCommand::setTimerId( int id )
+{
+ dwrite()->timerId = id;
+}
+
+/*!
Copy the QSimCommand object \a value.
*/
QSimCommand& QSimCommand::operator=( const QSimCommand & value )
@@ -2669,6 +2699,27 @@ QSimCommand QSimCommand::fromPdu( const QByteArray& pdu )
}
break;
+ case 0x24:
+ {
+ // Timer identifier.
+ sc.setTimerId( pdu[posn] );
+ }
+ break;
+
+ case 0x25:
+ {
+ // Timer value.
+ int secs = 0;
+ secs += ((uint8_t) pdu[posn + 0] >> 4) * 3600;
+ secs += ((uint8_t) pdu[posn + 0] & 15) * 36000;
+ secs += ((uint8_t) pdu[posn + 1] >> 4) * 60;
+ secs += ((uint8_t) pdu[posn + 1] & 15) * 600;
+ secs += ((uint8_t) pdu[posn + 2] >> 4) * 1;
+ secs += ((uint8_t) pdu[posn + 2] & 15) * 10;
+ sc.setDuration( secs * 1000 );
+ }
+ break;
+
case 0x2B:
{
// Immediate response block.
@@ -2963,6 +3014,31 @@ static void writeTextAttribute( QByteArray& data, const QByteArray& attr )
}
}
+// Write a Timer Id field.
+void _qtopiaphone_writeTimerId( QByteArray& data, uint timerId )
+{
+ data += 0xa4;
+ data += 0x01;
+ data += (char) timerId;
+}
+#define writeTimerId _qtopiaphone_writeTimerId
+
+// Write a Timer Value field.
+void _qtopiaphone_writeTimerValue( QByteArray& data, uint value )
+{
+ if (!value)
+ return;
+
+ data += 0xa5;
+ data += 0x03;
+#define TO_BCD(bin) (char) ((((bin) / 10) & 0xf) | (((bin) % 10) << 4))
+ data += TO_BCD(value / 3600);
+ data += TO_BCD((value / 60) % 60);
+ data += TO_BCD(value % 60);
+#undef TO_BCD
+}
+#define writeTimerValue _qtopiaphone_writeTimerValue
+
/*!
\enum QSimCommand::ToPduOptions
This enum defines additional options to use when encoding SIM commands with QSimCommand::toPdu().
@@ -3189,6 +3265,13 @@ QByteArray QSimCommand::toPdu( QSimCommand::ToPduOptions options ) const
}
break;
+ case TimerManagement:
+ {
+ writeTimerId( data, timerId() );
+ writeTimerValue( data, duration() / 1000 );
+ }
+ break;
+
case SetupIdleModeText:
{
writeTextString( data, text(), options );
diff --git a/src/qsimcommand.h b/src/qsimcommand.h
index d2183b1..eadd768 100644
--- a/src/qsimcommand.h
+++ b/src/qsimcommand.h
@@ -356,6 +356,9 @@ public:
bool smsPacking() const;
void setSmsPacking( bool value );
+ int timerId() const;
+ void setTimerId( int id );
+
int qualifier() const;
void setQualifier( int value );
diff --git a/src/qsimterminalresponse.cpp b/src/qsimterminalresponse.cpp
index db156aa..3e11915 100644
--- a/src/qsimterminalresponse.cpp
+++ b/src/qsimterminalresponse.cpp
@@ -142,6 +142,7 @@ public:
duration = other->duration;
menuItem = other->menuItem;
dataCodingScheme = other->dataCodingScheme;
+ timerId = other->timerId;
extensionData = other->extensionData;
}
@@ -155,6 +156,7 @@ public:
uint duration;
uint menuItem;
int dataCodingScheme;
+ uint timerId;
QByteArray extensionData;
};
@@ -449,6 +451,31 @@ void QSimTerminalResponse::setDataCodingScheme( int value )
}
/*!
+ Returns the number of the timer to which a Timer Management command was
+ addressed.
+
+ Applies to: \c TimerManagement
+
+ \sa setTimerId()
+*/
+int QSimTerminalResponse::timerId() const
+{
+ return d->timerId;
+}
+
+/*!
+ Sets the identifier of the timer to which the Timer Management response
+ applies. \a id should be between 1 and 8 to address one of the
+ eight timers available.
+
+ \sa timerId()
+*/
+void QSimTerminalResponse::setTimerId( int id )
+{
+ d->timerId = id;
+}
+
+/*!
Returns the extension data for this terminal response. The extension data is
appended after all other fields, and consists of zero or more BER tag-length-value
field specifications.
@@ -479,11 +506,15 @@ void _qtopiaphone_writeTextString( QByteArray& binary, const QString& str,
QString _qtopiaphone_decodeCodedString( const QByteArray& binary, uint posn, uint length );
void _qtopiaphone_writeDuration( QByteArray& data, uint time );
void _qtopiaphone_writeBerLength( QByteArray& binary, int length );
+void _qtopiaphone_writeTimerId( QByteArray& data, uint id );
+void _qtopiaphone_writeTimerValue( QByteArray& data, uint value );
#define readBer _qtopiaphone_readBer
#define writeTextString _qtopiaphone_writeTextString
#define decodeCodedString _qtopiaphone_decodeCodedString
#define writeDuration _qtopiaphone_writeDuration
#define writeBerLength _qtopiaphone_writeBerLength
+#define writeTimerId _qtopiaphone_writeTimerId
+#define writeTimerValue _qtopiaphone_writeTimerValue
/*!
Returns the contents of an extension field. The \a tag is an 8-bit value,
@@ -621,6 +652,27 @@ QSimTerminalResponse QSimTerminalResponse::fromPdu( const QByteArray& pdu )
}
break;
+ case 0x24:
+ {
+ // Timer identifier.
+ resp.setTimerId( pdu[posn] );
+ }
+ break;
+
+ case 0x25:
+ {
+ // Timer value.
+ int secs = 0;
+ secs += ((uint8_t) pdu[posn + 0] >> 4) * 3600;
+ secs += ((uint8_t) pdu[posn + 0] & 15) * 36000;
+ secs += ((uint8_t) pdu[posn + 1] >> 4) * 60;
+ secs += ((uint8_t) pdu[posn + 1] & 15) * 600;
+ secs += ((uint8_t) pdu[posn + 2] >> 4) * 1;
+ secs += ((uint8_t) pdu[posn + 2] & 15) * 10;
+ resp.setDuration( secs * 1000 );
+ }
+ break;
+
default:
{
// Don't know what this is, so add it as an extension field.
@@ -785,6 +837,13 @@ QByteArray QSimTerminalResponse::toPdu() const
}
break;
+ case QSimCommand::TimerManagement:
+ {
+ writeTimerId( data, timerId() );
+ writeTimerValue( data, duration() / 1000 );
+ }
+ break;
+
default: break;
}
diff --git a/src/qsimterminalresponse.h b/src/qsimterminalresponse.h
index 86a4bf0..24427f2 100644
--- a/src/qsimterminalresponse.h
+++ b/src/qsimterminalresponse.h
@@ -145,6 +145,9 @@ public:
int dataCodingScheme() const;
void setDataCodingScheme( int value );
+ int timerId() const;
+ void setTimerId( int id );
+
QByteArray extensionData() const;
void setExtensionData( QByteArray value );
diff --git a/src/simapplication.cpp b/src/simapplication.cpp
index 290ec2a..d9e3b77 100644
--- a/src/simapplication.cpp
+++ b/src/simapplication.cpp
@@ -288,6 +288,7 @@ const QString DemoSimApplication::getName()
#define MainMenu_SendUSSD 13
#define MainMenu_SendSMS 14
#define MainMenu_Polling 15
+#define MainMenu_Timers 16
#define SportsMenu_Chess 1
#define SportsMenu_Painting 2
@@ -358,6 +359,13 @@ enum PollingMenuItems {
Polling_30s,
};
+enum TimersMenuItems {
+ Timers_Start = 1,
+ Timers_Stop,
+ Timers_Sleep,
+ Timers_Query,
+};
+
void DemoSimApplication::mainMenu()
{
QSimCommand cmd;
@@ -426,6 +434,10 @@ void DemoSimApplication::mainMenu()
item.setLabel( "SIM Polling" );
items += item;
+ item.setIdentifier( MainMenu_Timers );
+ item.setLabel( "Timers" );
+ items += item;
+
cmd.setMenuItems( items );
command( cmd, 0, 0 );
@@ -550,6 +562,12 @@ void DemoSimApplication::mainMenuSelection( int id )
}
break;
+ case MainMenu_Timers:
+ {
+ sendTimersMenu();
+ }
+ break;
+
default:
{
// Don't know what this item is, so just re-display the main menu.
@@ -2044,3 +2062,156 @@ void DemoSimApplication::pollingMenuResp( const QSimTerminalResponse& resp )
break;
}
}
+
+void DemoSimApplication::sendTimersMenu()
+{
+ QSimCommand cmd;
+ QSimMenuItem item;
+ QList<QSimMenuItem> items;
+
+ cmd.setType( QSimCommand::SelectItem );
+ cmd.setTitle( "Timer ops" );
+
+ item.setIdentifier( Timers_Start );
+ item.setLabel( "Reset timer 1 to 1h" );
+ items += item;
+
+ item.setIdentifier( Timers_Stop );
+ item.setLabel( "Stop all timers" );
+ items += item;
+
+ item.setIdentifier( Timers_Sleep );
+ item.setLabel( "Sleep for 10s using timer 2" );
+ items += item;
+
+ item.setIdentifier( Timers_Query );
+ item.setLabel( "Show statuses" );
+ items += item;
+
+ cmd.setMenuItems( items );
+
+ command( cmd, this, SLOT(timersMenuResp(QSimTerminalResponse)) );
+}
+
+void DemoSimApplication::timersMenuResp( 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 Timers_Start:
+ cmd.setQualifier( 0 );
+ cmd.setType( QSimCommand::TimerManagement );
+ cmd.setTimerId( 1 );
+ cmd.setDuration( 3600000 );
+ cmd.setDestinationDevice( QSimCommand::ME );
+ command( cmd, this, SLOT(endSession()) );
+ break;
+
+ case Timers_Stop:
+ cmd.setQualifier( 1 );
+ cmd.setType( QSimCommand::TimerManagement );
+ cmd.setTimerId( 1 );
+ cmd.setDestinationDevice( QSimCommand::ME );
+ command( cmd, this, SLOT(timersCmdResp(QSimTerminalResponse)) );
+ break;
+
+ case Timers_Sleep:
+ cmd.setQualifier( 0 );
+ cmd.setType( QSimCommand::TimerManagement );
+ cmd.setTimerId( 2 );
+ cmd.setDuration( 10000 );
+ cmd.setDestinationDevice( QSimCommand::ME );
+ command( cmd, NULL, NULL );
+ break;
+
+ case Timers_Query:
+ cmd.setQualifier( 2 );
+ cmd.setType( QSimCommand::TimerManagement );
+ cmd.setTimerId( 1 );
+ cmd.setDestinationDevice( QSimCommand::ME );
+ command( cmd, this, SLOT(timersCmdResp(QSimTerminalResponse)) );
+ timerStatus = "";
+ break;
+ }
+}
+
+void DemoSimApplication::timersCmdResp( const QSimTerminalResponse& resp )
+{
+ QSimCommand cmd;
+
+ if ( resp.command().qualifier() == 1 ) {
+ if ( resp.command().timerId() < 1 ) {
+ endSession();
+ return;
+ }
+
+ /* Stop the next timer */
+ cmd.setQualifier( 1 );
+ cmd.setType( QSimCommand::TimerManagement );
+ cmd.setTimerId( resp.timerId() + 1 );
+ cmd.setDestinationDevice( QSimCommand::ME );
+
+ if ( cmd.timerId() >= 8 )
+ command( cmd, this, SLOT(endSession()) );
+ else
+ command( cmd, this, SLOT(timersCmdResp(QSimTerminalResponse)) );
+
+ return;
+ }
+
+ if ( resp.command().qualifier() == 2 ) {
+ if ( resp.result() == QSimTerminalResponse::Success ) {
+ QString status;
+ status.sprintf( "Timer %i expires in %i:%02i:%02i.\n",
+ resp.timerId(), resp.duration() / 3600000,
+ (resp.duration() / 60000) % 60,
+ (resp.duration() / 1000) % 60 );
+
+ timerStatus += status;
+ }
+
+ if ( resp.timerId() == 8 || resp.timerId() < 1 ) {
+ /* All timers done */
+ if ( timerStatus.length() == 0 )
+ timerStatus = "All timers are stopped.";
+
+ cmd.setType( QSimCommand::DisplayText );
+ cmd.setDestinationDevice( QSimCommand::Display );
+ cmd.setText( timerStatus.left(220) );
+ command( cmd, this, SLOT(endSession()) );
+ return;
+ }
+
+ /* Interrogate the next timer */
+ cmd.setQualifier( 2 );
+ cmd.setType( QSimCommand::TimerManagement );
+ cmd.setTimerId( resp.timerId() + 1 );
+ cmd.setDestinationDevice( QSimCommand::ME );
+ command( cmd, this, SLOT(timersCmdResp(QSimTerminalResponse)) );
+
+ return;
+ }
+}
+
+bool DemoSimApplication::envelope( const QSimEnvelope& env )
+{
+ if ( env.type() != QSimEnvelope::TimerExpiration )
+ return SimApplication::envelope( env );
+
+ QSimCommand cmd;
+
+ cmd.setType( QSimCommand::DisplayText );
+ cmd.setDestinationDevice( QSimCommand::Display );
+ cmd.setText( "Timer expired." );
+ command( cmd, this, SLOT(endSession()) );
+
+ return true;
+}
diff --git a/src/simapplication.h b/src/simapplication.h
index 1d6293f..dbf061d 100644
--- a/src/simapplication.h
+++ b/src/simapplication.h
@@ -70,6 +70,8 @@ public:
const QString getName();
+ bool envelope( const QSimEnvelope& env );
+
protected slots:
void mainMenu();
void mainMenuSelection( int id );
@@ -119,11 +121,15 @@ protected slots:
void smsSetTextResp( const QSimTerminalResponse& resp );
void sendPollingMenu();
void pollingMenuResp( const QSimTerminalResponse& resp );
+ void sendTimersMenu();
+ void timersMenuResp( const QSimTerminalResponse& resp );
+ void timersCmdResp( const QSimTerminalResponse& resp );
private:
int sticksLeft;
bool immediateResponse;
QString smsDestNumber, smsText;
+ QString timerStatus;
};
#endif
--
1.7.1.86.g0e460.dirty
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 4/4] phonesim: Add SIM Refresh commands to sim app menu.
2010-11-21 15:51 [PATCH 1/4] phonesim: Add Send Short Message commands to sim app menu Andrzej Zaborowski
2010-11-21 15:51 ` [PATCH 2/4] phonesim: Add SIM Polling " Andrzej Zaborowski
2010-11-21 15:51 ` [PATCH 3/4] phonesim: Add Timer Management " Andrzej Zaborowski
@ 2010-11-21 15:51 ` Andrzej Zaborowski
2010-11-22 15:12 ` [PATCH 1/4] phonesim: Add Send Short Message " Denis Kenzior
3 siblings, 0 replies; 7+ messages in thread
From: Andrzej Zaborowski @ 2010-11-21 15:51 UTC (permalink / raw)
To: ofono
[-- 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
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 3/4] phonesim: Add Timer Management commands to sim app menu.
2010-11-21 15:51 ` [PATCH 3/4] phonesim: Add Timer Management " Andrzej Zaborowski
@ 2010-11-22 15:09 ` Denis Kenzior
0 siblings, 0 replies; 7+ messages in thread
From: Denis Kenzior @ 2010-11-22 15:09 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 1109 bytes --]
Hi Andrew,
On 11/21/2010 09:51 AM, Andrzej Zaborowski wrote:
> ---
> src/qsimcommand.cpp | 83 ++++++++++++++++++++
> src/qsimcommand.h | 3 +
> src/qsimterminalresponse.cpp | 59 ++++++++++++++
> src/qsimterminalresponse.h | 3 +
> src/simapplication.cpp | 171 ++++++++++++++++++++++++++++++++++++++++++
> src/simapplication.h | 6 ++
> 6 files changed, 325 insertions(+), 0 deletions(-)
>
CXX src/qsimcommand.o
src/qsimcommand.cpp: In static member function ‘static QSimCommand
QSimCommand::fromPdu(const QByteArray&)’:
src/qsimcommand.cpp:2713: error: ‘uint8_t’ was not declared in this scope
src/qsimcommand.cpp:2713: error: expected ‘)’ before ‘pdu’
src/qsimcommand.cpp:2714: error: expected ‘)’ before ‘pdu’
src/qsimcommand.cpp:2715: error: expected ‘)’ before ‘pdu’
src/qsimcommand.cpp:2716: error: expected ‘)’ before ‘pdu’
src/qsimcommand.cpp:2717: error: expected ‘)’ before ‘pdu’
src/qsimcommand.cpp:2718: error: expected ‘)’ before ‘pdu’
Regards,
-Denis
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/4] phonesim: Add Send Short Message commands to sim app menu.
2010-11-21 15:51 [PATCH 1/4] phonesim: Add Send Short Message commands to sim app menu Andrzej Zaborowski
` (2 preceding siblings ...)
2010-11-21 15:51 ` [PATCH 4/4] phonesim: Add SIM Refresh " Andrzej Zaborowski
@ 2010-11-22 15:12 ` Denis Kenzior
3 siblings, 0 replies; 7+ messages in thread
From: Denis Kenzior @ 2010-11-22 15:12 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 306 bytes --]
Hi Andrew,
On 11/21/2010 09:51 AM, Andrzej Zaborowski wrote:
> ---
> src/simapplication.cpp | 148 +++++++++++++++++++++++++++++++++++++++++++++++-
> src/simapplication.h | 5 ++
> 2 files changed, 152 insertions(+), 1 deletions(-)
>
Patch has been applied, thanks.
Regards,
-Denis
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/4] phonesim: Add SIM Polling commands to sim app menu.
2010-11-21 15:51 ` [PATCH 2/4] phonesim: Add SIM Polling " Andrzej Zaborowski
@ 2010-11-22 15:13 ` Denis Kenzior
0 siblings, 0 replies; 7+ messages in thread
From: Denis Kenzior @ 2010-11-22 15:13 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 304 bytes --]
Hi Andrew,
On 11/21/2010 09:51 AM, Andrzej Zaborowski wrote:
> ---
> src/simapplication.cpp | 66 ++++++++++++++++++++++++++++++++++++++++++++++++
> src/simapplication.h | 2 +
> 3 files changed, 72 insertions(+), 4 deletions(-)
>
Patch has been applied, thanks.
Regards,
-Denis
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2010-11-22 15:13 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-21 15:51 [PATCH 1/4] phonesim: Add Send Short Message commands to sim app menu Andrzej Zaborowski
2010-11-21 15:51 ` [PATCH 2/4] phonesim: Add SIM Polling " Andrzej Zaborowski
2010-11-22 15:13 ` Denis Kenzior
2010-11-21 15:51 ` [PATCH 3/4] phonesim: Add Timer Management " Andrzej Zaborowski
2010-11-22 15:09 ` Denis Kenzior
2010-11-21 15:51 ` [PATCH 4/4] phonesim: Add SIM Refresh " Andrzej Zaborowski
2010-11-22 15:12 ` [PATCH 1/4] phonesim: Add Send Short Message " 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.