All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] Add CNAP support
@ 2010-12-07 18:33 Gustavo F. Padovan
  2010-12-07 18:33 ` [PATCH 2/2] Add support to CNAP ss command Gustavo F. Padovan
  2010-12-17  0:49 ` [PATCH 1/2] Add CNAP support Denis Kenzior
  0 siblings, 2 replies; 4+ messages in thread
From: Gustavo F. Padovan @ 2010-12-07 18:33 UTC (permalink / raw)
  To: ofono

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

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(-)

diff --git a/src/callmanager.cpp b/src/callmanager.cpp
index dddc5ae..03fd341 100644
--- a/src/callmanager.cpp
+++ b/src/callmanager.cpp
@@ -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 );
 }
 
diff --git a/src/callmanager.h b/src/callmanager.h
index 3dd01cd..a2de574 100644
--- a/src/callmanager.h
+++ b/src/callmanager.h
@@ -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.
diff --git a/src/control.cpp b/src/control.cpp
index 75dae98..49f9f04 100644
--- a/src/control.cpp
+++ b/src/control.cpp
@@ -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 )
diff --git a/src/control.h b/src/control.h
index 64a7af7..767baa3 100644
--- a/src/control.h
+++ b/src/control.h
@@ -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);
diff --git a/src/controlbase.ui b/src/controlbase.ui
index 2c91f95..76abd4b 100644
--- a/src/controlbase.ui
+++ b/src/controlbase.ui
@@ -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>
diff --git a/src/default.xml b/src/default.xml
index 0fd0182..3f800c1 100644
--- a/src/default.xml
+++ b/src/default.xml
@@ -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>
diff --git a/src/hardwaremanipulator.h b/src/hardwaremanipulator.h
index fe5968f..d8ab11e 100644
--- a/src/hardwaremanipulator.h
+++ b/src/hardwaremanipulator.h
@@ -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,
diff --git a/src/phonesim.cpp b/src/phonesim.cpp
index 89089b2..8ca5b23 100644
--- a/src/phonesim.cpp
+++ b/src/phonesim.cpp
@@ -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()),
-- 
1.7.3.2


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

* [PATCH 2/2] Add support to CNAP ss command
  2010-12-07 18:33 [PATCH 1/2] Add CNAP support Gustavo F. Padovan
@ 2010-12-07 18:33 ` Gustavo F. Padovan
  2010-12-17  0:50   ` Denis Kenzior
  2010-12-17  0:49 ` [PATCH 1/2] Add CNAP support Denis Kenzior
  1 sibling, 1 reply; 4+ messages in thread
From: Gustavo F. Padovan @ 2010-12-07 18:33 UTC (permalink / raw)
  To: ofono

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

---
 src/simapplication.cpp |   80 ++++++++++++++++++++++++++++++++++++++++++++++++
 src/simapplication.h   |    2 +
 2 files changed, 82 insertions(+), 0 deletions(-)

diff --git a/src/simapplication.cpp b/src/simapplication.cpp
index 62bbe9d..bd650a4 100644
--- a/src/simapplication.cpp
+++ b/src/simapplication.cpp
@@ -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;
diff --git a/src/simapplication.h b/src/simapplication.h
index df36bbb..75e23cc 100644
--- a/src/simapplication.h
+++ b/src/simapplication.h
@@ -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();
-- 
1.7.3.2


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

* Re: [PATCH 1/2] Add CNAP support
  2010-12-07 18:33 [PATCH 1/2] Add CNAP support Gustavo F. Padovan
  2010-12-07 18:33 ` [PATCH 2/2] Add support to CNAP ss command Gustavo F. Padovan
@ 2010-12-17  0:49 ` Denis Kenzior
  1 sibling, 0 replies; 4+ messages in thread
From: Denis Kenzior @ 2010-12-17  0:49 UTC (permalink / raw)
  To: ofono

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

Hi Gustavo,

On 12/07/2010 12:33 PM, Gustavo F. Padovan wrote:
> 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

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

* Re: [PATCH 2/2] Add support to CNAP ss command
  2010-12-07 18:33 ` [PATCH 2/2] Add support to CNAP ss command Gustavo F. Padovan
@ 2010-12-17  0:50   ` Denis Kenzior
  0 siblings, 0 replies; 4+ messages in thread
From: Denis Kenzior @ 2010-12-17  0:50 UTC (permalink / raw)
  To: ofono

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

Hi Gustavo,

On 12/07/2010 12:33 PM, Gustavo F. Padovan wrote:
> ---
>  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

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

end of thread, other threads:[~2010-12-17  0:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-07 18:33 [PATCH 1/2] Add CNAP support Gustavo F. Padovan
2010-12-07 18:33 ` [PATCH 2/2] Add support to CNAP ss command Gustavo F. Padovan
2010-12-17  0:50   ` Denis Kenzior
2010-12-17  0:49 ` [PATCH 1/2] Add CNAP support 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.