All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] phonesim: simulate language notification in sim app
@ 2010-09-14 22:27 Jeevaka Badrappan
  2010-09-15 18:54 ` Denis Kenzior
  0 siblings, 1 reply; 4+ messages in thread
From: Jeevaka Badrappan @ 2010-09-14 22:27 UTC (permalink / raw)
  To: ofono

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

---
 src/qsimcommand.cpp    |   11 ++++++++
 src/simapplication.cpp |   68 ++++++++++++++++++++++++++++++++++++++++++++++++
 src/simapplication.h   |    2 +
 3 files changed, 81 insertions(+), 0 deletions(-)

diff --git a/src/qsimcommand.cpp b/src/qsimcommand.cpp
index 9a9a169..9746592 100644
--- a/src/qsimcommand.cpp
+++ b/src/qsimcommand.cpp
@@ -3280,6 +3280,17 @@ QByteArray QSimCommand::toPdu( QSimCommand::ToPduOptions options ) const
         }
         break;
 
+        case LanguageNotification:
+        {
+            if ( qualifier & 0x01 ) {
+                data += (char)0xAD;
+                data += (char)0x02;
+                data += (char)0x73;
+                data += (char)0x65;
+            }
+        }
+        break;
+
         default: break;
     }
 
diff --git a/src/simapplication.cpp b/src/simapplication.cpp
index 4af510b..a54ec10 100644
--- a/src/simapplication.cpp
+++ b/src/simapplication.cpp
@@ -281,6 +281,7 @@ const QString DemoSimApplication::getName()
 #define MainMenu_Browser    9
 #define MainMenu_DTMF       10
 #define MainMenu_SendSS     11
+#define MainMenu_Language   12
 
 #define SportsMenu_Chess        1
 #define SportsMenu_Painting     2
@@ -329,6 +330,10 @@ const QString DemoSimApplication::getName()
 #define CoLRMenu_Interrogation    2
 #define CoLRMenu_Deactivation     3
 
+#define Language_Specific       1
+#define Language_Non_Specific   2
+#define Language_Main           3
+
 void DemoSimApplication::mainMenu()
 {
     QSimCommand cmd;
@@ -381,6 +386,10 @@ void DemoSimApplication::mainMenu()
     item.setLabel( "Send SS" );
     items += item;
 
+    item.setIdentifier( MainMenu_Language );
+    item.setLabel( "Language Notification" );
+    items += item;
+
     cmd.setMenuItems( items );
 
     command( cmd, 0, 0 );
@@ -481,6 +490,12 @@ void DemoSimApplication::mainMenuSelection( int id )
         }
         break;
 
+        case MainMenu_Language:
+        {
+            sendLanguageMenu();
+        }
+        break;
+
         default:
         {
             // Don't know what this item is, so just re-display the main menu.
@@ -1642,3 +1657,56 @@ void DemoSimApplication::CoLRMenu( const QSimTerminalResponse& resp )
         endSession();
     }
 }
+
+void DemoSimApplication::sendLanguageMenu()
+{
+    QSimCommand cmd;
+    QSimMenuItem item;
+    QList<QSimMenuItem> items;
+
+    cmd.setType( QSimCommand::SelectItem );
+    cmd.setTitle( "Language Notification" );
+
+    item.setIdentifier( Language_Specific );
+    item.setLabel( "Specific Language" );
+    items += item;
+
+    item.setIdentifier( Language_Non_Specific );
+    item.setLabel( "Non-Specific Language" );
+    items += item;
+
+    item.setIdentifier( Language_Main );
+    item.setLabel( "Return to main menu" );
+    items += item;
+
+    cmd.setMenuItems( items );
+
+    command( cmd, this, SLOT(languageMenu(QSimTerminalResponse)) );
+}
+
+void DemoSimApplication::languageMenu( const QSimTerminalResponse& resp )
+{
+    QSimCommand cmd;
+
+    if ( resp.result() == QSimTerminalResponse::Success ) {
+        cmd.setDestinationDevice( QSimCommand::ME );
+        cmd.setSourceDevice( QSimCommand::SIM );
+        cmd.setType( QSimCommand::LanguageNotification );
+
+        // Item selected.
+        switch ( resp.menuItem() ) {
+        case Language_Specific:
+            cmd.setQualifier( 1 );
+            command( cmd, this, SLOT(sendLanguageMenu()) );
+            break;
+        case Language_Non_Specific:
+            cmd.setQualifier( 0 );
+            command( cmd, this, SLOT(sendLanguageMenu()) );
+            break;
+        default:
+            endSession();
+            break;
+        }
+    } else
+        endSession();
+}
diff --git a/src/simapplication.h b/src/simapplication.h
index 0f67317..fc57423 100644
--- a/src/simapplication.h
+++ b/src/simapplication.h
@@ -109,6 +109,8 @@ protected slots:
     void CoLPMenu( const QSimTerminalResponse& resp );
     void sendCoLRMenu();
     void CoLRMenu( const QSimTerminalResponse& resp );
+    void sendLanguageMenu();
+    void languageMenu( const QSimTerminalResponse& resp );
 
 private:
     int sticksLeft;
-- 
1.7.0.4


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

* Re: [PATCH] phonesim: simulate language notification in sim app
  2010-09-14 22:27 [PATCH] phonesim: simulate language notification in sim app Jeevaka Badrappan
@ 2010-09-15 18:54 ` Denis Kenzior
  2010-09-16 18:39   ` Jeevaka Badrappan
  0 siblings, 1 reply; 4+ messages in thread
From: Denis Kenzior @ 2010-09-15 18:54 UTC (permalink / raw)
  To: ofono

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

Hi Jeevaka,

On 09/14/2010 05:27 PM, Jeevaka Badrappan wrote:
> ---
>  src/qsimcommand.cpp    |   11 ++++++++
>  src/simapplication.cpp |   68 ++++++++++++++++++++++++++++++++++++++++++++++++
>  src/simapplication.h   |    2 +
>  3 files changed, 81 insertions(+), 0 deletions(-)
> 
> diff --git a/src/qsimcommand.cpp b/src/qsimcommand.cpp
> index 9a9a169..9746592 100644
> --- a/src/qsimcommand.cpp
> +++ b/src/qsimcommand.cpp
> @@ -3280,6 +3280,17 @@ QByteArray QSimCommand::toPdu( QSimCommand::ToPduOptions options ) const
>          }
>          break;
>  
> +        case LanguageNotification:
> +        {
> +            if ( qualifier & 0x01 ) {
> +                data += (char)0xAD;
> +                data += (char)0x02;
> +                data += (char)0x73;
> +                data += (char)0x65;
> +            }
> +        }
> +        break;
> +

I'd really prefer that this wasn't completely hard-coded.  Can we make
an enum of some sort, or even use a QString (null means no language
object included)

Regards,
-Denis

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

* [PATCH] phonesim: simulate language notification in sim app
  2010-09-15 18:54 ` Denis Kenzior
@ 2010-09-16 18:39   ` Jeevaka Badrappan
  2010-09-16 19:41     ` Denis Kenzior
  0 siblings, 1 reply; 4+ messages in thread
From: Jeevaka Badrappan @ 2010-09-16 18:39 UTC (permalink / raw)
  To: ofono

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

---
 src/qsimcommand.cpp    |   38 ++++++++++++++++++++++++
 src/qsimcommand.h      |    3 ++
 src/simapplication.cpp |   76 ++++++++++++++++++++++++++++++++++++++++++++++++
 src/simapplication.h   |    2 +
 4 files changed, 119 insertions(+), 0 deletions(-)

diff --git a/src/qsimcommand.cpp b/src/qsimcommand.cpp
index 9a9a169..df2422c 100644
--- a/src/qsimcommand.cpp
+++ b/src/qsimcommand.cpp
@@ -94,6 +94,7 @@ public:
         defaultItem = other->defaultItem;
         menuItems = other->menuItems;
         url = other->url;
+        language = other->language;
         iconId = other->iconId;
         otherIconId = other->otherIconId;
         device = other->device;
@@ -155,6 +156,7 @@ public:
     uint defaultItem;
     QList<QSimMenuItem> menuItems;
     QString url;
+    QString language;
     uint iconId;
     uint otherIconId;
     int device;
@@ -1980,6 +1982,32 @@ void QSimCommand::setUrl( const QString& value )
 }
 
 /*!
+    Returns the language that will be used for any text string within
+    proactive commands or envelope command responses.
+
+    Applies to: \c LanguageNotification.
+
+    \sa setLanguage()
+*/
+QString QSimCommand::language() const
+{
+    return d->language;
+}
+
+/*!
+    Sets the language that will be used for any text string within
+    proactive commands or envelope command responses to \a value.
+
+    Applies to: \c LanguageNotification.
+
+    \sa language()
+*/
+void QSimCommand::setLanguage( const QString& value )
+{
+    dwrite()->language = value;
+}
+
+/*!
     Returns the icon identifier associated with this command.
     Returns zero if there is no icon.
 
@@ -3280,6 +3308,16 @@ QByteArray QSimCommand::toPdu( QSimCommand::ToPduOptions options ) const
         }
         break;
 
+        case LanguageNotification:
+        {
+            if ( !language().isEmpty() && language().length() == 2 ) {
+                data += (char)0xAD;
+                data += (char)0x02;
+                data += language();
+            }
+        }
+        break;
+
         default: break;
     }
 
diff --git a/src/qsimcommand.h b/src/qsimcommand.h
index ff99cc7..d2183b1 100644
--- a/src/qsimcommand.h
+++ b/src/qsimcommand.h
@@ -338,6 +338,9 @@ public:
     QString url() const;
     void setUrl( const QString& value );
 
+    QString language() const;
+    void setLanguage( const QString& value );
+
     uint iconId() const;
     void setIconId( uint value );
 
diff --git a/src/simapplication.cpp b/src/simapplication.cpp
index 4af510b..cc2094d 100644
--- a/src/simapplication.cpp
+++ b/src/simapplication.cpp
@@ -281,6 +281,7 @@ const QString DemoSimApplication::getName()
 #define MainMenu_Browser    9
 #define MainMenu_DTMF       10
 #define MainMenu_SendSS     11
+#define MainMenu_Language   12
 
 #define SportsMenu_Chess        1
 #define SportsMenu_Painting     2
@@ -329,6 +330,10 @@ const QString DemoSimApplication::getName()
 #define CoLRMenu_Interrogation    2
 #define CoLRMenu_Deactivation     3
 
+#define Language_Specific       1
+#define Language_Non_Specific   2
+#define Language_Main           3
+
 void DemoSimApplication::mainMenu()
 {
     QSimCommand cmd;
@@ -381,6 +386,10 @@ void DemoSimApplication::mainMenu()
     item.setLabel( "Send SS" );
     items += item;
 
+    item.setIdentifier( MainMenu_Language );
+    item.setLabel( "Language Notification" );
+    items += item;
+
     cmd.setMenuItems( items );
 
     command( cmd, 0, 0 );
@@ -481,6 +490,12 @@ void DemoSimApplication::mainMenuSelection( int id )
         }
         break;
 
+        case MainMenu_Language:
+        {
+            sendLanguageMenu();
+        }
+        break;
+
         default:
         {
             // Don't know what this item is, so just re-display the main menu.
@@ -1642,3 +1657,64 @@ void DemoSimApplication::CoLRMenu( const QSimTerminalResponse& resp )
         endSession();
     }
 }
+
+void DemoSimApplication::sendLanguageMenu()
+{
+    QSimCommand cmd;
+    QSimMenuItem item;
+    QList<QSimMenuItem> items;
+
+    cmd.setType( QSimCommand::SelectItem );
+    cmd.setTitle( "Language Notification" );
+
+    item.setIdentifier( Language_Specific );
+    item.setLabel( "Specific Language" );
+    items += item;
+
+    item.setIdentifier( Language_Non_Specific );
+    item.setLabel( "Non-Specific Language" );
+    items += item;
+
+    item.setIdentifier( Language_Main );
+    item.setLabel( "Return to main menu" );
+    items += item;
+
+    cmd.setMenuItems( items );
+
+    command( cmd, this, SLOT(languageMenu(QSimTerminalResponse)) );
+}
+
+void DemoSimApplication::languageMenu( const QSimTerminalResponse& resp )
+{
+    QSimCommand cmd;
+
+    if ( resp.result() == QSimTerminalResponse::Success ) {
+
+        // Item selected.
+        switch ( resp.menuItem() ) {
+            case Language_Specific:
+            {
+                cmd.setType( QSimCommand::LanguageNotification );
+                cmd.setQualifier( 1 );
+                cmd.setLanguage( "se" );
+                command( cmd, this, SLOT(sendLanguageMenu()) );
+            }
+            break;
+
+            case Language_Non_Specific:
+            {
+                cmd.setType( QSimCommand::LanguageNotification );
+                cmd.setQualifier( 0 );
+                command( cmd, this, SLOT(sendLanguageMenu()) );
+            }
+            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 0f67317..fc57423 100644
--- a/src/simapplication.h
+++ b/src/simapplication.h
@@ -109,6 +109,8 @@ protected slots:
     void CoLPMenu( const QSimTerminalResponse& resp );
     void sendCoLRMenu();
     void CoLRMenu( const QSimTerminalResponse& resp );
+    void sendLanguageMenu();
+    void languageMenu( const QSimTerminalResponse& resp );
 
 private:
     int sticksLeft;
-- 
1.7.0.4


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

* Re: [PATCH] phonesim: simulate language notification in sim app
  2010-09-16 18:39   ` Jeevaka Badrappan
@ 2010-09-16 19:41     ` Denis Kenzior
  0 siblings, 0 replies; 4+ messages in thread
From: Denis Kenzior @ 2010-09-16 19:41 UTC (permalink / raw)
  To: ofono

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

Hi Jeevaka,

On 09/16/2010 01:39 PM, Jeevaka Badrappan wrote:
> ---
>  src/qsimcommand.cpp    |   38 ++++++++++++++++++++++++
>  src/qsimcommand.h      |    3 ++
>  src/simapplication.cpp |   76 ++++++++++++++++++++++++++++++++++++++++++++++++
>  src/simapplication.h   |    2 +
>  4 files changed, 119 insertions(+), 0 deletions(-)

Patch looks good to me, applied.  Thanks.

Regards,
-Denis

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

end of thread, other threads:[~2010-09-16 19:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-09-14 22:27 [PATCH] phonesim: simulate language notification in sim app Jeevaka Badrappan
2010-09-15 18:54 ` Denis Kenzior
2010-09-16 18:39   ` Jeevaka Badrappan
2010-09-16 19:41     ` 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.