From: Philippe Nunes <philippe.nunes@linux.intel.com>
To: ofono@ofono.org
Subject: [PATCH v2 2/2] simapplication: Add a new SIM applet dedicated to BIP commands
Date: Thu, 31 Mar 2011 17:58:10 +0200 [thread overview]
Message-ID: <1301587090-5358-2-git-send-email-philippe.nunes@linux.intel.com> (raw)
In-Reply-To: <y>
[-- Attachment #1: Type: text/plain, Size: 6650 bytes --]
---
src/simapplication.cpp | 161 ++++++++++++++++++++++++++++++++++++++++++++++++
src/simapplication.h | 2 +
2 files changed, 163 insertions(+), 0 deletions(-)
diff --git a/src/simapplication.cpp b/src/simapplication.cpp
index 14fa8c0..f64da16 100644
--- a/src/simapplication.cpp
+++ b/src/simapplication.cpp
@@ -291,6 +291,7 @@ const QString DemoSimApplication::getName()
#define MainMenu_Timers 16
#define MainMenu_Refresh 17
#define MainMenu_LocalInfo 18
+#define MainMenu_BIP 19
#define SportsMenu_Chess 1
#define SportsMenu_Painting 2
@@ -349,6 +350,12 @@ const QString DemoSimApplication::getName()
#define LocalInfoMenu_Time 1
#define LocalInfoMenu_Lang 2
+#define BIPMenu_OpenChannel 1
+#define BIPMenu_CloseChannel 2
+#define BIPMenu_ReceiveData 3
+#define BIPMenu_SendData 4
+#define BIPMenu_GetChannelStatus 5
+
enum SendSMSMenuItems {
SendSMS_Unpacked = 1,
SendSMS_Packed,
@@ -448,6 +455,10 @@ void DemoSimApplication::mainMenu()
item.setLabel( "Provide Local Information" );
items += item;
+ item.setIdentifier( MainMenu_BIP );
+ item.setLabel( "BIP commands" );
+ items += item;
+
cmd.setMenuItems( items );
command( cmd, 0, 0 );
@@ -590,6 +601,12 @@ void DemoSimApplication::mainMenuSelection( int id )
}
break;
+ case MainMenu_BIP:
+ {
+ sendBIPMenu();
+ }
+ break;
+
default:
{
// Don't know what this item is, so just re-display the main menu.
@@ -2351,3 +2368,147 @@ void DemoSimApplication::localInfoMenu( const QSimTerminalResponse& resp )
endSession();
}
}
+
+void DemoSimApplication::BIPMenu( const QSimTerminalResponse& resp )
+{
+ QSimCommand cmd;
+
+ if ( resp.result() == QSimTerminalResponse::Success ) {
+ switch ( resp.menuItem() ) {
+
+ case BIPMenu_OpenChannel:
+ {
+ QByteArray bearerDesc;
+ QByteArray uti;
+ QByteArray destAddress;
+ QByteArray apn;
+
+ bearerDesc += 0x02;
+ bearerDesc += 0x03;
+ bearerDesc += 0x04;
+ bearerDesc += 0x03;
+ bearerDesc += 0x04;
+ bearerDesc += 0x1F;
+ bearerDesc += 0x02;
+
+ uti += 0x01;
+ uti += 0xAD;
+ uti += 0x9C;
+
+ destAddress += 0x21;
+ destAddress += 0x01;
+ destAddress += 0x01;
+ destAddress += 0x01;
+ destAddress += 0x01;
+
+ apn += 0x06;
+ apn += 0x54;
+ apn += 0x65;
+ apn += 0x73;
+ apn += 0x74;
+ apn += 0x47;
+ apn += 0x70;
+ apn += 0x02;
+ apn += 0x72;
+ apn += 0x73;
+
+ cmd.setType( QSimCommand::OpenChannel );
+ cmd.setQualifier( QSimCommand::OpenchannelImmediate );
+ cmd.setText("Open ID");
+ cmd.setBearerDesc(bearerDesc);
+ cmd.setBufferSize(1400);
+ cmd.setApn(apn);
+ cmd.setUserLogin("UserLog");
+ cmd.setUserPassword("UserPwd");
+ cmd.setUti(uti);
+ cmd.setDestAddress(destAddress);
+ command( cmd, this, SLOT(sendBIPMenu()) );
+ }
+ break;
+
+ case BIPMenu_ReceiveData:
+ {
+ cmd.setType( QSimCommand::ReceiveData );
+ cmd.setDestinationDevice( QSimCommand::Channel1 );
+ cmd.setText("Receive Data 1");
+ cmd.setDataLength(200);
+ command( cmd, this, SLOT(sendBIPMenu()) );
+ }
+ break;
+
+ case BIPMenu_SendData:
+ {
+ QByteArray data;
+
+ data += 0x01;
+ data += 0x02;
+ data += 0x03;
+ data += 0x04;
+ data += 0x05;
+
+ cmd.setType( QSimCommand::SendData );
+ cmd.setDestinationDevice( QSimCommand::Channel1 );
+ cmd.setText("Send Data 1");
+ cmd.addExtensionField( 0x36, data );
+ command( cmd, this, SLOT(sendBIPMenu()) );
+ }
+ break;
+
+ case BIPMenu_CloseChannel:
+ {
+ cmd.setType( QSimCommand::CloseChannel );
+ cmd.setDestinationDevice( QSimCommand::Channel1 );
+ cmd.setText("Close ID 1");
+ command( cmd, this, SLOT(sendBIPMenu()) );
+ }
+ break;
+
+ case BIPMenu_GetChannelStatus:
+ {
+ cmd.setType( QSimCommand::GetChannelStatus );
+ command( cmd, this, SLOT(sendBIPMenu()) );
+ }
+ break;
+
+ default:
+ endSession();
+ break;
+ }
+ } else {
+ endSession();
+ }
+}
+
+void DemoSimApplication::sendBIPMenu()
+{
+ QSimCommand cmd;
+ QSimMenuItem item;
+ QList<QSimMenuItem> items;
+
+ cmd.setType( QSimCommand::SelectItem );
+ cmd.setTitle( "BIP commands Menu" );
+
+ item.setIdentifier( BIPMenu_OpenChannel );
+ item.setLabel( "Open channel" );
+ items += item;
+
+ item.setIdentifier( BIPMenu_CloseChannel );
+ item.setLabel( "Close channel" );
+ items += item;
+
+ item.setIdentifier( BIPMenu_ReceiveData );
+ item.setLabel( "Receive data" );
+ items += item;
+
+ item.setIdentifier( BIPMenu_SendData );
+ item.setLabel( "Send data" );
+ items += item;
+
+ item.setIdentifier( BIPMenu_GetChannelStatus );
+ item.setLabel( "Get channel status" );
+ items += item;
+
+ cmd.setMenuItems( items );
+
+ command( cmd, this, SLOT(BIPMenu(QSimTerminalResponse)) );
+}
diff --git a/src/simapplication.h b/src/simapplication.h
index 61250e5..b41c781 100644
--- a/src/simapplication.h
+++ b/src/simapplication.h
@@ -130,6 +130,8 @@ protected slots:
void refreshMenuResp( const QSimTerminalResponse& resp );
void sendLocalInfoMenu();
void localInfoMenu( const QSimTerminalResponse& resp );
+ void sendBIPMenu();
+ void BIPMenu( const QSimTerminalResponse& resp );
private:
int sticksLeft;
--
1.7.1
next reply other threads:[~2011-03-31 15:58 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-31 15:58 Philippe Nunes [this message]
2011-03-31 19:28 ` [PATCH v2 2/2] simapplication: Add a new SIM applet dedicated to BIP commands 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=1301587090-5358-2-git-send-email-philippe.nunes@linux.intel.com \
--to=philippe.nunes@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 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.