Skip to contentSkip to conversation

Add CNAP support

PATCH In review Gustavo F. Padovan 2 participants 4 messages Dec 7, 2010 – Dec 17, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 Add CNAP support

With CNAP phonesim can tell the Caller Name within the RING comand

---
 src/callmanager.cpp       |   16 +++++++++-------
 src/callmanager.h         |    5 +++--
 src/control.cpp           |    4 ++--
 src/control.h             |    2 +-
 src/controlbase.ui        |   16 ++++++++++++++++
 src/default.xml           |   19 +++++++++++++++++++
 src/hardwaremanipulator.h |    2 +-
 src/phonesim.cpp          |    4 ++--
 8 files changed, 53 insertions(+), 15 deletions(-)
src/callmanager.cpp +9 -7
index dddc5ae..03fd341 100644
@@ -302,7 +302,8 @@ bool CallManager::command( const QString& cmd )
     return true;
 }
 
-void CallManager::startIncomingCall( const QString& number, bool dialBack )
+void CallManager::startIncomingCall( const QString& number,
+				const QString& name, bool dialBack )
 {
     // Bail out if there is already an incoming call.
     if ( idForIncoming() >= 0 ) {
@@ -328,7 +329,8 @@ void CallManager::startIncomingCall( const QString& number, bool dialBack )
     if ( info.state == CallState_Waiting ) {
         emit unsolicited( "+CCWA: " + QAtUtils::encodeNumber( number ) + ",1" );
     } else {
-        emit unsolicited( "RING\\n\\n+CLIP: " + QAtUtils::encodeNumber( number ) );
+        emit unsolicited( "RING\\n\\n+CLIP: " + QAtUtils::encodeNumber( number )
+				+ "\\n\\n+CNAP: \"" + name + "\"" );
     }
 
     // Announce the incoming call using Ericsson-style state notifications.
@@ -339,9 +341,9 @@ void CallManager::startIncomingCall( const QString& number, bool dialBack )
     ringTimer->start(2000);
 }
 
-void CallManager::startIncomingCall( const QString& number )
+void CallManager::startIncomingCall( const QString& number , const QString& name )
 {
-    startIncomingCall( number, false );
+    startIncomingCall( number, name, false );
 }
 
 void CallManager::hangupAll()
@@ -670,18 +672,18 @@ void CallManager::dialingToAlerting()
 
 void CallManager::dialBack()
 {
-    startIncomingCall( "1234567", true );
+    startIncomingCall( "1234567", "Alice", true );
 }
 
 void CallManager::dialBackWithHangup5()
 {
-    startIncomingCall( "1234567", true );
+    startIncomingCall( "1234567", "Bob", true );
     hangupTimer->start( 5000 );
 }
 
 void CallManager::dialBackWithHangup4()
 {
-    startIncomingCall( "1234567", true );
+    startIncomingCall( "1234567", "Mallory", true );
     hangupTimer->start( 4000 );
 }
 
src/callmanager.h +3 -2
index 3dd01cd..a2de574 100644
@@ -93,8 +93,9 @@ public:
 
 public slots:
     // Start an incoming call simulation.
-    void startIncomingCall( const QString& number, bool dialBack );
-    void startIncomingCall( const QString& number );
+    void startIncomingCall( const QString& number, const QString& name,
+						bool dialBack );
+    void startIncomingCall( const QString& number, const QString& name );
 
 signals:
     // Send a response to a command.
src/control.cpp +2 -2
index 75dae98..49f9f04 100644
@@ -119,7 +119,7 @@ Control::Control(const QString& ruleFile, SimRules *sr, QObject *parent)
         << SIGNAL(command(QString))
         << SIGNAL(variableChanged(QString,QString))
         << SIGNAL(switchTo(QString))
-        << SIGNAL(startIncomingCall(QString));
+        << SIGNAL(startIncomingCall(QString, QString));
 
     foreach (QByteArray sig, proxySignals)
         connect(widget, sig, this, sig);
@@ -281,7 +281,7 @@ void ControlWidget::sendSMSDatagram()
 
 void ControlWidget::sendCall()
 {
-    emit startIncomingCall( ui->leCaller->text() );
+    emit startIncomingCall( ui->leCaller->text() , ui->leCallerName->text() );
 }
 
 void ControlWidget::handleFromData( const QString& cmd )
src/control.h +1 -1
index 64a7af7..767baa3 100644
@@ -101,7 +101,7 @@ signals:
     void command(const QString &);
     void variableChanged(const QString &, const QString &);
     void switchTo(const QString &);
-    void startIncomingCall(const QString &);
+    void startIncomingCall(const QString &, const QString &);
 
 protected:
     void closeEvent(QCloseEvent *event);
src/controlbase.ui +16 -0
index 2c91f95..76abd4b 100644
@@ -141,6 +141,22 @@
              <widget class="QLineEdit" name="leCaller"/>
             </item>
             <item>
+             <widget class="QLabel" name="lblCallerName">
+              <property name="text">
+               <string>Caller Na&amp;me</string>
+              </property>
+              <property name="alignment">
+               <set>Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft</set>
+              </property>
+              <property name="buddy">
+               <cstring>leCallerName</cstring>
+              </property>
+             </widget>
+            </item>
+            <item>
+             <widget class="QLineEdit" name="leCallerName"/>
+            </item>
+            <item>
              <layout class="QHBoxLayout">
               <property name="spacing">
                <number>6</number>
src/default.xml +19 -0
index 0fd0182..3f800c1 100644
@@ -1373,6 +1373,25 @@
 </chat>
 
 <chat>
+    <!-- Query calling line identifier presentation mode -->
+    <command>AT+CNAP?</command>
+    <response>+CNAP: ${NAP},1\n\nOK</response>
+</chat>
+
+<chat>
+    <!-- Query supported calling line identifier presentation modes -->
+    <command>AT+CNAP=?</command>
+    <response>+CNAP: (0,1)\n\nOK</response>
+</chat>
+
+<chat>
+    <!-- Set calling line identifier presentation mode -->
+    <command>AT+CNAP=*</command>
+    <response>OK</response>
+    <set name="NAP" value="*"/>
+</chat>
+
+<chat>
     <!-- Query calling line identication restriction mode -->
     <command>AT+CLIR?</command>
     <response>+CLIR: ${LIR},${LIR_STATUS}\n\nOK</response>
src/hardwaremanipulator.h +1 -1
index fe5968f..d8ab11e 100644
@@ -55,7 +55,7 @@ signals:
     void command(const QString &cmd);
     void variableChanged(const QString &n, const QString &v);
     void switchTo(const QString &cmd);
-    void startIncomingCall(const QString &number);
+    void startIncomingCall(const QString &number, const QString &name);
 
 protected:
     virtual QString constructCBMessage(const QString &messageCode, int geographicalScope, const QString &updateNumber, const QString &channel,
src/phonesim.cpp +2 -2
index 89089b2..8ca5b23 100644
@@ -526,8 +526,8 @@ SimRules::SimRules( int fd, QObject *p,  const QString& filename, HardwareManipu
              this, SLOT(dialCheck(QString,bool&)) );
 
     if ( machine ) {
-        connect( machine, SIGNAL(startIncomingCall(QString)),
-                 _callManager, SLOT(startIncomingCall(QString)) );
+        connect( machine, SIGNAL(startIncomingCall(QString,QString)),
+                 _callManager, SLOT(startIncomingCall(QString,QString)) );
     }
 
     connect(this,SIGNAL(readyRead()),
Signature · 1 line
1.7.3.2
#1 lore raw

PATCH 2/2 Add support to CNAP ss command

---
 src/simapplication.cpp |   80 ++++++++++++++++++++++++++++++++++++++++++++++++
 src/simapplication.h   |    2 +
 2 files changed, 82 insertions(+), 0 deletions(-)
src/simapplication.cpp +80 -0
index 62bbe9d..bd650a4 100644
@@ -307,6 +307,7 @@ const QString DemoSimApplication::getName()
 #define SendSSMenu_CLIR     5
 #define SendSSMenu_CoLP     6
 #define SendSSMenu_CoLR     7
+#define SendSSMenu_CNAP     8
 
 #define CBMenu_Activation       1
 #define CBMenu_Interrogation    2
@@ -338,6 +339,10 @@ const QString DemoSimApplication::getName()
 #define CoLRMenu_Interrogation    2
 #define CoLRMenu_Deactivation     3
 
+#define CNAPMenu_Activation       1
+#define CNAPMenu_Interrogation    2
+#define CNAPMenu_Deactivation     3
+
 #define Language_Specific       1
 #define Language_Non_Specific   2
 #define Language_Main           3
@@ -1143,6 +1148,10 @@ void DemoSimApplication::sendSendSSMenu()
     item.setLabel( "CLIP (Calling Line Identification Presentation)" );
     items += item;
 
+    item.setIdentifier( SendSSMenu_CNAP );
+    item.setLabel( "CNAP (Calling Name Identification Presentation)" );
+    items += item;
+
     item.setIdentifier( SendSSMenu_CLIR );
     item.setLabel( "CLIR (Calling Line Identification Restriction)" );
     items += item;
@@ -1741,6 +1750,77 @@ void DemoSimApplication::CoLRMenu( const QSimTerminalResponse& resp )
     }
 }
 
+void DemoSimApplication::sendCNAPMenu()
+{
+    QSimCommand cmd;
+    QSimMenuItem item;
+    QList<QSimMenuItem> items;
+
+    cmd.setType( QSimCommand::SelectItem );
+    cmd.setTitle( "CNAP" );
+
+    item.setIdentifier( CNAPMenu_Activation );
+    item.setLabel( "Activation" );
+    items += item;
+
+    item.setIdentifier( CNAPMenu_Interrogation );
+    item.setLabel( "Interrogation" );
+    items += item;
+
+    item.setIdentifier( CNAPMenu_Deactivation );
+    item.setLabel( "Deactivation" );
+    items += item;
+
+    cmd.setMenuItems( items );
+
+    command( cmd, this, SLOT(CNAPMenu(QSimTerminalResponse)) );
+}
+
+void DemoSimApplication::CNAPMenu( const QSimTerminalResponse& resp )
+{
+    QSimCommand cmd;
+
+    if ( resp.result() == QSimTerminalResponse::Success ) {
+        switch ( resp.menuItem() ) {
+
+            case CNAPMenu_Activation:
+            {
+                cmd.setType( QSimCommand::SendSS );
+                cmd.setDestinationDevice( QSimCommand::Network );
+                cmd.setNumber( "*300#" );
+                command( cmd, this, SLOT(sendCNAPMenu()) );
+            }
+            break;
+
+            case CNAPMenu_Interrogation:
+            {
+                cmd.setType( QSimCommand::SendSS );
+                cmd.setDestinationDevice( QSimCommand::Network );
+                cmd.setNumber( "*#300#" );
+                command( cmd, this, SLOT(sendCNAPMenu()) );
+            }
+            break;
+
+            case CNAPMenu_Deactivation:
+            {
+                cmd.setType( QSimCommand::SendSS );
+                cmd.setDestinationDevice( QSimCommand::Network );
+                cmd.setNumber( "#300#" );
+                command( cmd, this, SLOT(sendCNAPMenu()) );
+            }
+            break;
+
+            default:
+                endSession();
+                break;
+        }
+    } else if ( resp.result() == QSimTerminalResponse::BackwardMove ) {
+        sendSendSSMenu();
+    } else {
+        endSession();
+    }
+}
+
 void DemoSimApplication::sendLanguageMenu()
 {
     QSimCommand cmd;
src/simapplication.h +2 -0
index df36bbb..75e23cc 100644
@@ -111,6 +111,8 @@ protected slots:
     void CoLPMenu( const QSimTerminalResponse& resp );
     void sendCoLRMenu();
     void CoLRMenu( const QSimTerminalResponse& resp );
+    void sendCNAPMenu();
+    void CNAPMenu( const QSimTerminalResponse& resp );
     void sendLanguageMenu();
     void languageMenu( const QSimTerminalResponse& resp );
     void sendUSSDMenu();
Signature · 1 line
1.7.3.2
#2 lore raw

Re: [PATCH 2/2] Add support to CNAP ss command

Hi Gustavo,

Quoted 5 lines · Gustavo F. Padovan
---
 src/simapplication.cpp |   80 ++++++++++++++++++++++++++++++++++++++++++++++++
 src/simapplication.h   |    2 +
 2 files changed, 82 insertions(+), 0 deletions(-)

Patch has been applied, thanks. However, I removed Activation / Deactivation menus from a later patch. These are actually not supported for CNAP/CLIP/COLR/COLP anyway.

Regards,
-Denis

#3 lore raw
In reply to Gustavo F. Padovan

Hi Gustavo,

Quoted 12 lines · Gustavo F. Padovan

With CNAP phonesim can tell the Caller Name within the RING comand

---
 src/callmanager.cpp       |   16 +++++++++-------
 src/callmanager.h         |    5 +++--
 src/control.cpp           |    4 ++--
 src/control.h             |    2 +-
 src/controlbase.ui        |   16 ++++++++++++++++
 src/default.xml           |   19 +++++++++++++++++++
 src/hardwaremanipulator.h |    2 +-
 src/phonesim.cpp          |    4 ++--
 8 files changed, 53 insertions(+), 15 deletions(-)

Patch has been applied, thanks. I added a bit more refinement to CLIP/CNAP handling afterwards. Let me know if I broke anything.

Regards,
-Denis