All of lore.kernel.org
 help / color / mirror / Atom feed
* simulate Send USSD in sim app
@ 2010-09-28 11:09 Jeevaka Badrappan
  2010-09-28 11:09 ` [PATCH] phonesim: " Jeevaka Badrappan
  0 siblings, 1 reply; 6+ messages in thread
From: Jeevaka Badrappan @ 2010-09-28 11:09 UTC (permalink / raw)
  To: ofono

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

Hi,

 Following patch simulates the Send USSD proactive command in sim application.
 7-bit, 8-bit and UCS2 USSD data are covered in this simulation.

Regards,
jeevaka

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH] phonesim: simulate Send USSD in sim app
  2010-09-28 11:09 simulate Send USSD in sim app Jeevaka Badrappan
@ 2010-09-28 11:09 ` Jeevaka Badrappan
  2010-09-29  2:10   ` Denis Kenzior
  0 siblings, 1 reply; 6+ messages in thread
From: Jeevaka Badrappan @ 2010-09-28 11:09 UTC (permalink / raw)
  To: ofono

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

---
 src/default.xml        |   23 +++++++++-
 src/qsimcommand.cpp    |    6 ++-
 src/simapplication.cpp |  114 ++++++++++++++++++++++++++++++++++++++++++++++++
 src/simapplication.h   |    2 +
 4 files changed, 142 insertions(+), 3 deletions(-)
 mode change 100644 => 100755 src/simapplication.cpp

diff --git a/src/default.xml b/src/default.xml
index 135bad3..4287639 100644
--- a/src/default.xml
+++ b/src/default.xml
@@ -1955,7 +1955,28 @@
 </chat>
 
 <chat>
-    <!-- Initiate USSD query that is not supported b the network -->
+    <!-- SAT initiated 7-Bit USSD query that is supported by the network -->
+    <command>AT+CUSD=1,"ABCD",240</command>
+    <response>+CUSD: 0,"USSD string received from SS",240\n\nOK</response>
+    <set name="USD" value="1"/>
+</chat>
+
+<chat>
+    <!-- SAT initiated 8-Bit USSD query that is supported by the network -->
+    <command>AT+CUSD=1,"41424344",68</command>
+    <response>+CUSD: 0,"5553534420737472696E672072656365697665642066726F6D205353",68\n\nOK</response>
+    <set name="USD" value="1"/>
+</chat>
+
+<chat>
+    <!-- SAT initiated UCS2 USSD query that is supported by the network -->
+    <command>AT+CUSD=1,"041704140420041004120421042204120423041904220415",72</command>
+    <response>+CUSD: 0,"005500530053004400200073007400720069006E0067002000720065006300650069007600650064002000660072006F006D002000530053",72\n\nOK</response>
+    <set name="USD" value="1"/>
+</chat>
+
+<chat>
+    <!-- Initiate USSD query that is not supported by the network -->
     <command>AT+CUSD=1,*</command>
     <response>+CUSD: 4\n\nOK</response>
     <set name="USD" value="1"/>
diff --git a/src/qsimcommand.cpp b/src/qsimcommand.cpp
index df2422c..44bdd9a 100644
--- a/src/qsimcommand.cpp
+++ b/src/qsimcommand.cpp
@@ -3162,8 +3162,10 @@ QByteArray QSimCommand::toPdu( QSimCommand::ToPduOptions options ) const
                 writeEFADN( data, text(), QSimCommand::NoPduOptions );
             if ( ( options & QSimCommand::PackedStrings ) != 0 )
                 writeTextString( data, number(), options, 0xF08A );
-            else
-                writeTextString( data, number(), options, 0x408A );
+            else if ( ( options & QSimCommand::UCS2Strings ) != 0 )
+                writeTextString( data, number(), options, 0x488A );
+            else // 8-Bit USSD
+                writeTextString( data, number(), options, 0x448A );
             writeIcon( data, iconId(), iconSelfExplanatory(), true );
             writeTextAttribute( data, textAttribute() );
         }
diff --git a/src/simapplication.cpp b/src/simapplication.cpp
old mode 100644
new mode 100755
index cc2094d..7dc580f
--- a/src/simapplication.cpp
+++ b/src/simapplication.cpp
@@ -20,6 +20,7 @@
 #include "simapplication.h"
 #include <qatutils.h>
 #include <qdebug.h>
+#include <QTextCodec>
 
 class SimApplicationPrivate
 {
@@ -282,6 +283,7 @@ const QString DemoSimApplication::getName()
 #define MainMenu_DTMF       10
 #define MainMenu_SendSS     11
 #define MainMenu_Language   12
+#define MainMenu_SendUSSD   13
 
 #define SportsMenu_Chess        1
 #define SportsMenu_Painting     2
@@ -334,6 +336,12 @@ const QString DemoSimApplication::getName()
 #define Language_Non_Specific   2
 #define Language_Main           3
 
+#define SendUSSD_7Bit       1
+#define SendUSSD_8Bit       2
+#define SendUSSD_UCS2       3
+#define SendUSSD_Error      4
+#define SendUSSD_Main       5
+
 void DemoSimApplication::mainMenu()
 {
     QSimCommand cmd;
@@ -390,6 +398,10 @@ void DemoSimApplication::mainMenu()
     item.setLabel( "Language Notification" );
     items += item;
 
+    item.setIdentifier( MainMenu_SendUSSD );
+    item.setLabel( "Send USSD" );
+    items += item;
+
     cmd.setMenuItems( items );
 
     command( cmd, 0, 0 );
@@ -496,6 +508,12 @@ void DemoSimApplication::mainMenuSelection( int id )
         }
         break;
 
+        case MainMenu_SendUSSD:
+        {
+            sendUSSDMenu();
+        }
+        break;
+
         default:
         {
             // Don't know what this item is, so just re-display the main menu.
@@ -1718,3 +1736,99 @@ void DemoSimApplication::languageMenu( const QSimTerminalResponse& resp )
         endSession();
     }
 }
+
+void DemoSimApplication::sendUSSDMenu()
+{
+    QSimCommand cmd;
+    QSimMenuItem item;
+    QList<QSimMenuItem> items;
+
+    cmd.setType( QSimCommand::SelectItem );
+    cmd.setTitle( "Send USSD" );
+
+    item.setIdentifier( SendUSSD_7Bit );
+    item.setLabel( "Send USSD - 7-Bit" );
+    items += item;
+
+    item.setIdentifier( SendUSSD_8Bit );
+    item.setLabel( "Send USSD - 8-Bit" );
+    items += item;
+
+    item.setIdentifier( SendUSSD_UCS2 );
+    item.setLabel( "Send USSD - UCS2" );
+    items += item;
+
+    item.setIdentifier( SendUSSD_Error );
+    item.setLabel( "Send USSD - Return Error" );
+    items += item;
+
+    item.setIdentifier( SendUSSD_Main );
+    item.setLabel( "Return to main menu" );
+    items += item;
+
+    cmd.setMenuItems( items );
+
+    command( cmd, this, SLOT(USSDMenu(QSimTerminalResponse)) );
+}
+
+void DemoSimApplication::USSDMenu( const QSimTerminalResponse& resp )
+{
+    QSimCommand cmd;
+
+    if ( resp.result() == QSimTerminalResponse::Success ) {
+
+        // Item selected.
+        switch ( resp.menuItem() ) {
+            case SendUSSD_7Bit:
+            {
+                cmd.setType( QSimCommand::SendUSSD );
+                cmd.setDestinationDevice( QSimCommand::Network );
+                cmd.setText( "7-bit USSD" );
+                cmd.setNumber( "ABCD" );
+                command( cmd, this, SLOT(sendUSSDMenu()),
+                         QSimCommand::PackedStrings );
+            }
+            break;
+
+            case SendUSSD_8Bit:
+            {
+                cmd.setType( QSimCommand::SendUSSD );
+                cmd.setDestinationDevice( QSimCommand::Network );
+                cmd.setText( "8-bit USSD" );
+                cmd.setNumber( "ABCD" );
+                command( cmd, this, SLOT(sendUSSDMenu()) );
+            }
+            break;
+
+            case SendUSSD_UCS2:
+            {
+                cmd.setType( QSimCommand::SendUSSD );
+                cmd.setDestinationDevice( QSimCommand::Network );
+                cmd.setText( "UCS2 USSD" );
+                QTextCodec *codec = QTextCodec::codecForName( "utf8" );
+                cmd.setNumber( codec->toUnicode( "ЗДРАВСТВУЙТЕ" ) );
+                command( cmd, this, SLOT(sendUSSDMenu()),
+                         QSimCommand::UCS2Strings );
+            }
+            break;
+
+            case SendUSSD_Error:
+            {
+                cmd.setType( QSimCommand::SendUSSD );
+                cmd.setDestinationDevice( QSimCommand::Network );
+                cmd.setText( "7-bit USSD" );
+                cmd.setNumber( "*100#" );
+                command( cmd, this, SLOT(sendUSSDMenu()),
+                         QSimCommand::PackedStrings );
+            }
+            break;
+
+            default:
+                endSession();
+                break;
+        }
+    } else {
+        // Unknown response - just go back to the main menu.
+        endSession();
+    }
+}
diff --git a/src/simapplication.h b/src/simapplication.h
index fc57423..9d147ee 100644
--- a/src/simapplication.h
+++ b/src/simapplication.h
@@ -111,6 +111,8 @@ protected slots:
     void CoLRMenu( const QSimTerminalResponse& resp );
     void sendLanguageMenu();
     void languageMenu( const QSimTerminalResponse& resp );
+    void sendUSSDMenu();
+    void USSDMenu( const QSimTerminalResponse& resp );
 
 private:
     int sticksLeft;
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] phonesim: simulate Send USSD in sim app
  2010-09-28 11:09 ` [PATCH] phonesim: " Jeevaka Badrappan
@ 2010-09-29  2:10   ` Denis Kenzior
  2010-09-29  9:57     ` Marcel Holtmann
  0 siblings, 1 reply; 6+ messages in thread
From: Denis Kenzior @ 2010-09-29  2:10 UTC (permalink / raw)
  To: ofono

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

Hi Jeevaka,

On 09/28/2010 06:09 AM, Jeevaka Badrappan wrote:
> ---
>  src/default.xml        |   23 +++++++++-
>  src/qsimcommand.cpp    |    6 ++-
>  src/simapplication.cpp |  114 ++++++++++++++++++++++++++++++++++++++++++++++++
>  src/simapplication.h   |    2 +
>  4 files changed, 142 insertions(+), 3 deletions(-)
>  mode change 100644 => 100755 src/simapplication.cpp

Patch has been applied, thanks.

Regards,
-Denis

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] phonesim: simulate Send USSD in sim app
  2010-09-29  2:10   ` Denis Kenzior
@ 2010-09-29  9:57     ` Marcel Holtmann
  2010-09-29 10:03       ` Denis Kenzior
  0 siblings, 1 reply; 6+ messages in thread
From: Marcel Holtmann @ 2010-09-29  9:57 UTC (permalink / raw)
  To: ofono

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

Hi Denis,

> > ---
> >  src/default.xml        |   23 +++++++++-
> >  src/qsimcommand.cpp    |    6 ++-
> >  src/simapplication.cpp |  114 ++++++++++++++++++++++++++++++++++++++++++++++++
> >  src/simapplication.h   |    2 +
> >  4 files changed, 142 insertions(+), 3 deletions(-)
> >  mode change 100644 => 100755 src/simapplication.cpp

what was wrong with the clear indication that this patch is messed up.

This patch comes from a stupid Windows system that tries to change every
single mode to 0755. Please fix this.

Regards

Marcel



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] phonesim: simulate Send USSD in sim app
  2010-09-29  9:57     ` Marcel Holtmann
@ 2010-09-29 10:03       ` Denis Kenzior
  2010-09-29 10:10         ` Jeevaka.Badrappan
  0 siblings, 1 reply; 6+ messages in thread
From: Denis Kenzior @ 2010-09-29 10:03 UTC (permalink / raw)
  To: ofono

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

Hi Marcel,

On 09/29/2010 04:57 AM, Marcel Holtmann wrote:
> Hi Denis,
> 
>>> ---
>>>  src/default.xml        |   23 +++++++++-
>>>  src/qsimcommand.cpp    |    6 ++-
>>>  src/simapplication.cpp |  114 ++++++++++++++++++++++++++++++++++++++++++++++++
>>>  src/simapplication.h   |    2 +
>>>  4 files changed, 142 insertions(+), 3 deletions(-)
>>>  mode change 100644 => 100755 src/simapplication.cpp
> 
> what was wrong with the clear indication that this patch is messed up.
> 
> This patch comes from a stupid Windows system that tries to change every
> single mode to 0755. Please fix this.

Whoops, my fault totally missed this.  I wonder if there are git
settings that can warn about this...

Regards,
-Denis

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: [PATCH] phonesim: simulate Send USSD in sim app
  2010-09-29 10:03       ` Denis Kenzior
@ 2010-09-29 10:10         ` Jeevaka.Badrappan
  0 siblings, 0 replies; 6+ messages in thread
From: Jeevaka.Badrappan @ 2010-09-29 10:10 UTC (permalink / raw)
  To: ofono

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

 
Hi Denis, Marcel,

> what was wrong with the clear indication that this patch is messed up.
> 
> This patch comes from a stupid Windows system that tries to change 
> every single mode to 0755. Please fix this.

> Whoops, my fault totally missed this.  I wonder if there are git
settings that can warn about this...

Sorry for this mess. I'll make sure this doesn't happen again.

Thanks and Regards,
jeevaka

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2010-09-29 10:10 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-28 11:09 simulate Send USSD in sim app Jeevaka Badrappan
2010-09-28 11:09 ` [PATCH] phonesim: " Jeevaka Badrappan
2010-09-29  2:10   ` Denis Kenzior
2010-09-29  9:57     ` Marcel Holtmann
2010-09-29 10:03       ` Denis Kenzior
2010-09-29 10:10         ` Jeevaka.Badrappan

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.