All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/6] phonesim: Add call status UI
@ 2011-04-28  9:49 Nicolas Bertrand
  2011-04-28  9:49 ` [PATCH 1/6] callmanager: Add signal on call status change Nicolas Bertrand
                   ` (5 more replies)
  0 siblings, 6 replies; 9+ messages in thread
From: Nicolas Bertrand @ 2011-04-28  9:49 UTC (permalink / raw)
  To: ofono

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

This patch introduce a new tab "call" in phonesim UI in order to display calls
informations (id, number, status, name and direction).
The interface to send CSSU and CSSI notification is now dynamic based on the
type of current calls.

Nicolas Bertrand (6):
  callmanager: Add signal on call status change
  control: Update UI using call status
  hardwaremanipulator: add callmanagement method
  phonesim: Connect call status signal
  controlbase.ui: Add call mangement tab
  control: Update call view

 src/callmanager.cpp         |   34 ++++++++---
 src/callmanager.h           |    3 +
 src/control.cpp             |  140 ++++++++++++++++++++++++++++++++++++++-----
 src/control.h               |    6 ++
 src/controlbase.ui          |   61 +++++++++++++++++++
 src/hardwaremanipulator.cpp |    4 +
 src/hardwaremanipulator.h   |    2 +
 src/phonesim.cpp            |    2 +
 8 files changed, 228 insertions(+), 24 deletions(-)


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

* [PATCH 1/6] callmanager: Add signal on call status change
  2011-04-28  9:49 [PATCH 0/6] phonesim: Add call status UI Nicolas Bertrand
@ 2011-04-28  9:49 ` Nicolas Bertrand
  2011-04-28 19:52   ` Denis Kenzior
  2011-04-28  9:49 ` [PATCH 2/6] control: Update UI using call status Nicolas Bertrand
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 9+ messages in thread
From: Nicolas Bertrand @ 2011-04-28  9:49 UTC (permalink / raw)
  To: ofono

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

---
 src/callmanager.cpp |   34 ++++++++++++++++++++++++++--------
 src/callmanager.h   |    3 +++
 2 files changed, 29 insertions(+), 8 deletions(-)

diff --git a/src/callmanager.cpp b/src/callmanager.cpp
index 585a3ac..9823f05 100644
--- a/src/callmanager.cpp
+++ b/src/callmanager.cpp
@@ -149,6 +149,8 @@ bool CallManager::command( const QString& cmd )
         info.dialBack = false;
         callList += info;
 
+        emit sendCallStatus( &callList );
+
         // Advertise the call state change and then return to command mode.
         sendState( info );
         send( "OK" );
@@ -176,6 +178,8 @@ bool CallManager::command( const QString& cmd )
                 info.dialBack = false;
                 callList += info;
 
+                emit sendCallStatus( &callList );
+
                 // Advertise the call state change and then return to command mode.
                 sendState( info );
                 send( "CONNECT 19200" );
@@ -369,6 +373,7 @@ void CallManager::startIncomingCall( const QString& number,
     callList += info;
 
     emitRing(info);
+    emit sendCallStatus( &callList );
 
     // Announce the incoming call using Ericsson-style state notifications.
     sendState( info );
@@ -395,6 +400,7 @@ void CallManager::hangupAll()
     connectTimer->stop();
     alertingTimer->stop();
     hangupTimer->stop();
+    emit sendCallStatus( &callList );
 }
 
 void CallManager::hangupConnected()
@@ -412,6 +418,8 @@ void CallManager::hangupConnected()
 
     if ( !hasCall( CallState_Held ) )
         waitingToIncoming();
+
+    emit sendCallStatus( &callList );
 }
 
 void CallManager::hangupHeld()
@@ -429,6 +437,8 @@ void CallManager::hangupHeld()
 
     if ( !hasCall( CallState_Active ) )
         waitingToIncoming();
+
+    emit sendCallStatus( &callList );
 }
 
 void CallManager::hangupConnectedAndHeld()
@@ -445,6 +455,7 @@ void CallManager::hangupConnectedAndHeld()
     }
     callList = newCallList;
     waitingToIncoming();
+    emit sendCallStatus( &callList );
 }
 
 void CallManager::hangupCall( int id )
@@ -464,15 +475,13 @@ bool CallManager::acceptCall()
     } else if ( hasCall( CallState_Active ) ) {
         // Put the active calls on hold and accept the incoming call.
         changeGroup( CallState_Active, CallState_Held );
-        callList[index].state = CallState_Active;
-        sendState( callList[index] );
-        return true;
-    } else {
-        // Only held calls, or no other calls, so just make the incoming call active.
-        callList[index].state = CallState_Active;
-        sendState( callList[index] );
-        return true;
     }
+
+	// No more active calls, so accept incoming
+    callList[index].state = CallState_Active;
+    sendState( callList[index] );
+    emit sendCallStatus( &callList );
+	return true;
 }
 
 bool CallManager::chld0()
@@ -500,6 +509,7 @@ bool CallManager::chld1()
         int index = indexForId(id);
         callList[index].state = CallState_Active;
         sendState( callList[index] );
+        emit sendCallStatus( &callList );
         return true;
     } else if ( hasCall( CallState_Held ) ) {
         // Hangup the active calls and activate the held ones.
@@ -508,6 +518,7 @@ bool CallManager::chld1()
             if ( callList[index].state == CallState_Held ) {
                 callList[index].state = CallState_Active;
                 sendState( callList[index] );
+                emit sendCallStatus( &callList );
             }
         }
         return true;
@@ -551,6 +562,7 @@ bool CallManager::chld1x( int x )
     if ( !hasCall( CallState_Active ) && !hasCall( CallState_Held ) )
         waitingToIncoming();
 
+    emit sendCallStatus( &callList );
     return found;
 }
 
@@ -570,6 +582,7 @@ bool CallManager::chld2()
         int index = indexForId( id );
         callList[index].state = CallState_Active;
         sendState( callList[index] );
+        emit sendCallStatus( &callList );
         return true;
     } else if ( hasCall( CallState_Active ) && hasCall( CallState_Held ) ) {
         // Swap the active and held calls.
@@ -620,6 +633,7 @@ bool CallManager::chld2x( int x )
             // No active calls, so make just this call active.
             callList[index].state = CallState_Active;
             sendState( callList[index] );
+            emit sendCallStatus( &callList );
         }
         return true;
     } else if ( callList[index].state == CallState_Active ) {
@@ -634,6 +648,7 @@ bool CallManager::chld2x( int x )
                     return false;
                 callList[index2].state = CallState_Held;
                 sendState( callList[index2] );
+                emit sendCallStatus( &callList );
             }
         }
         return true;
@@ -691,6 +706,7 @@ void CallManager::dialingToConnected()
     // Transition the call to its new state.
     callList[index].state = CallState_Active;
     sendState( callList[index] );
+    emit sendCallStatus( &callList );
     // If the dialed number starts with 05123, disconnect the
     // call after xx seconds, where xx is part of the dial string
     // as 05123xx
@@ -714,6 +730,7 @@ void CallManager::dialingToAlerting()
     // Transition the call to its new state.
     callList[index].state = CallState_Alerting;
     sendState( callList[index] );
+    emit sendCallStatus( &callList );
 }
 
 void CallManager::waitingToIncoming()
@@ -856,6 +873,7 @@ void CallManager::changeGroup( CallState oldState, CallState newState )
             sendState( callList[index] );
         }
     }
+    emit sendCallStatus( &callList );
 }
 
 void CallManager::sendState( const CallInfo& info )
diff --git a/src/callmanager.h b/src/callmanager.h
index 5876c87..69e8d3b 100644
--- a/src/callmanager.h
+++ b/src/callmanager.h
@@ -114,6 +114,9 @@ signals:
     // Send a call control event.
     void controlEvent( const QSimControlEvent& event );
 
+    // Send calls list on status change
+    void sendCallStatus( QList<CallInfo> *list );
+
 private slots:
     // Transition the active dialing or alerting call to connected.
     void dialingToConnected();
-- 
1.7.1


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

* [PATCH 2/6] control: Update UI using call status
  2011-04-28  9:49 [PATCH 0/6] phonesim: Add call status UI Nicolas Bertrand
  2011-04-28  9:49 ` [PATCH 1/6] callmanager: Add signal on call status change Nicolas Bertrand
@ 2011-04-28  9:49 ` Nicolas Bertrand
  2011-04-28 19:58   ` Denis Kenzior
  2011-04-28  9:49 ` [PATCH 3/6] hardwaremanipulator: add callmanagement method Nicolas Bertrand
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 9+ messages in thread
From: Nicolas Bertrand @ 2011-04-28  9:49 UTC (permalink / raw)
  To: ofono

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

---
 src/control.cpp |   40 +++++++++++++++++++++++++++++++++++-----
 src/control.h   |    5 +++++
 2 files changed, 40 insertions(+), 5 deletions(-)

diff --git a/src/control.cpp b/src/control.cpp
index 645219c..2f12d91 100644
--- a/src/control.cpp
+++ b/src/control.cpp
@@ -134,6 +134,32 @@ Control::~Control()
     delete widget;
 }
 
+void Control::callManagement( QList<CallInfo> *list )
+{
+	bool enableCSSU = false;
+	bool enableCSSI = false;
+
+	foreach( CallInfo i, *list ) {
+		if ( i.incoming && !enableCSSU )
+			enableCSSU = true;
+		if ( !i.incoming && !enableCSSI )
+			enableCSSI = true;
+	}
+
+	widget->CSSIactivation( enableCSSI );
+	widget->CSSUactivation( enableCSSU );
+}
+
+void ControlWidget::CSSIactivation( bool enableCSSI )
+{
+    ui->cbCSSI->setEnabled( enableCSSI );
+}
+
+void ControlWidget::CSSUactivation( bool enableCSSU )
+{
+    ui->cbCSSU->setEnabled( enableCSSU );
+}
+
 void Control::setPhoneNumber( const QString &number )
 {
     widget->setWindowTitle("Phonesim - Number: " + number);
@@ -146,6 +172,10 @@ void Control::warning( const QString &title, const QString &message )
 
 void ControlWidget::handleCSSNNotif()
 {
+
+    ui->cbCSSU->setEnabled( false );
+    ui->cbCSSI->setEnabled( false );
+
     ui->cbCSSU->insertItem(0, "");
     ui->cbCSSU->insertItem(1, "0 - forwarded", 0);
     ui->cbCSSU->insertItem(3, "2 - on hold", 2);
@@ -160,15 +190,15 @@ void ControlWidget::handleCSSNNotif()
 
 void ControlWidget::sendCSSN()
 {
-    QVariant v = ui->cbCSSU->itemData(ui->cbCSSU->currentIndex());
+    QVariant v = ui->cbCSSU->itemData( ui->cbCSSU->currentIndex() );
 
-    if (v.canConvert<int>())
-        emit unsolicitedCommand("+CSSU: "+QString::number(v.toInt()));
+    if ( v.canConvert<int>() && ui->cbCSSU->isEnabled() )
+        emit unsolicitedCommand( "+CSSU: "+QString::number( v.toInt() ) );
 
     v = ui->cbCSSI->itemData(ui->cbCSSI->currentIndex());
 
-    if (v.canConvert<int>())
-        emit unsolicitedCommand("+CSSI: "+QString::number(v.toInt()));
+    if ( v.canConvert<int>() && ui->cbCSSI->isEnabled() )
+        emit unsolicitedCommand( "+CSSI: "+QString::number( v.toInt() ) );
 }
 
 void ControlWidget::sendSQ()
diff --git a/src/control.h b/src/control.h
index c17146a..2ccde29 100644
--- a/src/control.h
+++ b/src/control.h
@@ -25,6 +25,7 @@
 #include <QtScript>
 #include "ui_controlbase.h"
 #include "attranslator.h"
+#include "callmanager.h"
 
 class Control;
 
@@ -71,6 +72,9 @@ public:
     void handleToData( const QString& );
     void handleNewApp();
     void handleCSSNNotif();
+    void CSSUactivation( bool enableCSSU );
+    void CSSIactivation( bool enableCSSI );
+
 
 private slots:
     void sendSQ();
@@ -146,6 +150,7 @@ public slots:
     void handleToData( const QString& );
     void setPhoneNumber( const QString& );
     void handleNewApp();
+    void callManagement( QList<CallInfo> *info );
 
 protected:
     virtual void warning( const QString&, const QString& );
-- 
1.7.1


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

* [PATCH 3/6] hardwaremanipulator: add callmanagement method
  2011-04-28  9:49 [PATCH 0/6] phonesim: Add call status UI Nicolas Bertrand
  2011-04-28  9:49 ` [PATCH 1/6] callmanager: Add signal on call status change Nicolas Bertrand
  2011-04-28  9:49 ` [PATCH 2/6] control: Update UI using call status Nicolas Bertrand
@ 2011-04-28  9:49 ` Nicolas Bertrand
  2011-04-28  9:49 ` [PATCH 4/6] phonesim: Connect call status signal Nicolas Bertrand
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: Nicolas Bertrand @ 2011-04-28  9:49 UTC (permalink / raw)
  To: ofono

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

---
 src/hardwaremanipulator.cpp |    4 ++++
 src/hardwaremanipulator.h   |    2 ++
 2 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/src/hardwaremanipulator.cpp b/src/hardwaremanipulator.cpp
index c7bbe6a..909ce2a 100644
--- a/src/hardwaremanipulator.cpp
+++ b/src/hardwaremanipulator.cpp
@@ -337,3 +337,7 @@ void HardwareManipulator::simAppAbort()
     if (app)
         return app->abort();
 }
+
+void HardwareManipulator::callManagement( QList<CallInfo> *info )
+{
+}
diff --git a/src/hardwaremanipulator.h b/src/hardwaremanipulator.h
index df8f65e..ae8e716 100644
--- a/src/hardwaremanipulator.h
+++ b/src/hardwaremanipulator.h
@@ -27,6 +27,7 @@
 class QSMSMessage;
 class QVMMessage;
 class SimRules;
+struct CallInfo;
 class HardwareManipulator : public QObject
 {
 Q_OBJECT
@@ -49,6 +50,7 @@ public slots:
     virtual void simAppStart( int appIndex );
     virtual void simAppAbort();
     virtual void handleNewApp();
+    virtual void callManagement( QList<CallInfo> *info );
 
 signals:
     void unsolicitedCommand(const QString &cmd);
-- 
1.7.1


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

* [PATCH 4/6] phonesim: Connect call status signal
  2011-04-28  9:49 [PATCH 0/6] phonesim: Add call status UI Nicolas Bertrand
                   ` (2 preceding siblings ...)
  2011-04-28  9:49 ` [PATCH 3/6] hardwaremanipulator: add callmanagement method Nicolas Bertrand
@ 2011-04-28  9:49 ` Nicolas Bertrand
  2011-04-28  9:49 ` [PATCH 5/6] controlbase.ui: Add call mangement tab Nicolas Bertrand
  2011-04-28  9:49 ` [PATCH 6/6] control: Update call view Nicolas Bertrand
  5 siblings, 0 replies; 9+ messages in thread
From: Nicolas Bertrand @ 2011-04-28  9:49 UTC (permalink / raw)
  To: ofono

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

---
 src/phonesim.cpp |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/src/phonesim.cpp b/src/phonesim.cpp
index a822cd9..cda32dd 100644
--- a/src/phonesim.cpp
+++ b/src/phonesim.cpp
@@ -528,6 +528,8 @@ SimRules::SimRules( int fd, QObject *p,  const QString& filename, HardwareManipu
     if ( machine ) {
         connect( machine, SIGNAL(startIncomingCall(QString,QString,QString)),
                  _callManager, SLOT(startIncomingCall(QString,QString,QString)) );
+        connect ( _callManager, SIGNAL( sendCallStatus( QList<CallInfo> * ) ),
+                  machine, SLOT( callManagement( QList<CallInfo> * ) ) );
     }
 
     connect(this,SIGNAL(readyRead()),
-- 
1.7.1


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

* [PATCH 5/6] controlbase.ui: Add call mangement tab
  2011-04-28  9:49 [PATCH 0/6] phonesim: Add call status UI Nicolas Bertrand
                   ` (3 preceding siblings ...)
  2011-04-28  9:49 ` [PATCH 4/6] phonesim: Connect call status signal Nicolas Bertrand
@ 2011-04-28  9:49 ` Nicolas Bertrand
  2011-04-28  9:49 ` [PATCH 6/6] control: Update call view Nicolas Bertrand
  5 siblings, 0 replies; 9+ messages in thread
From: Nicolas Bertrand @ 2011-04-28  9:49 UTC (permalink / raw)
  To: ofono

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

---
 src/controlbase.ui |   61 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 61 insertions(+), 0 deletions(-)

diff --git a/src/controlbase.ui b/src/controlbase.ui
index cfadfe8..41c6d12 100644
--- a/src/controlbase.ui
+++ b/src/controlbase.ui
@@ -1458,6 +1458,67 @@ p, li { white-space: pre-wrap; }
        </property>
       </widget>
      </widget>
+     <widget class="QWidget" name="tab_9">
+      <attribute name="title">
+       <string>Call</string>
+      </attribute>
+      <layout class="QVBoxLayout" name="verticalLayout_3">
+       <item>
+        <widget class="QTableWidget" name="twCallMgt">
+         <property name="columnCount">
+          <number>5</number>
+         </property>
+         <attribute name="horizontalHeaderMinimumSectionSize">
+          <number>50</number>
+         </attribute>
+         <attribute name="horizontalHeaderShowSortIndicator" stdset="0">
+          <bool>true</bool>
+         </attribute>
+         <attribute name="verticalHeaderDefaultSectionSize">
+          <number>50</number>
+         </attribute>
+         <column>
+          <property name="text">
+           <string>id</string>
+          </property>
+         </column>
+         <column>
+          <property name="text">
+           <string>number</string>
+          </property>
+         </column>
+         <column>
+          <property name="text">
+           <string>state</string>
+          </property>
+         </column>
+         <column>
+          <property name="text">
+           <string>name</string>
+          </property>
+         </column>
+         <column>
+          <property name="text">
+           <string>type</string>
+          </property>
+         </column>
+        </widget>
+       </item>
+       <item>
+        <spacer name="verticalSpacer">
+         <property name="orientation">
+          <enum>Qt::Vertical</enum>
+         </property>
+         <property name="sizeHint" stdset="0">
+          <size>
+           <width>20</width>
+           <height>40</height>
+          </size>
+         </property>
+        </spacer>
+       </item>
+      </layout>
+     </widget>
     </widget>
    </item>
    <item>
-- 
1.7.1


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

* [PATCH 6/6] control: Update call view
  2011-04-28  9:49 [PATCH 0/6] phonesim: Add call status UI Nicolas Bertrand
                   ` (4 preceding siblings ...)
  2011-04-28  9:49 ` [PATCH 5/6] controlbase.ui: Add call mangement tab Nicolas Bertrand
@ 2011-04-28  9:49 ` Nicolas Bertrand
  5 siblings, 0 replies; 9+ messages in thread
From: Nicolas Bertrand @ 2011-04-28  9:49 UTC (permalink / raw)
  To: ofono

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

---
 src/control.cpp |  100 +++++++++++++++++++++++++++++++++++++++++++++++++------
 src/control.h   |    3 +-
 2 files changed, 91 insertions(+), 12 deletions(-)

diff --git a/src/control.cpp b/src/control.cpp
index 2f12d91..dec3aea 100644
--- a/src/control.cpp
+++ b/src/control.cpp
@@ -136,14 +136,79 @@ Control::~Control()
 
 void Control::callManagement( QList<CallInfo> *list )
 {
+	int row = 0;
 	bool enableCSSU = false;
 	bool enableCSSI = false;
 
+	widget->clearCallView();
+
 	foreach( CallInfo i, *list ) {
+		QString param[5];
+
 		if ( i.incoming && !enableCSSU )
 			enableCSSU = true;
 		if ( !i.incoming && !enableCSSI )
 			enableCSSI = true;
+
+		param[0].setNum( i.id );
+		param[1] = i.number;
+
+		switch( i.state ) {
+
+            case CallState_Active:
+            {
+                param[2] = "Active";
+            }
+            break;
+
+            case CallState_Held:
+            {
+                param[2] = "Held";
+            }
+            break;
+
+            case CallState_Dialing:
+            {
+                param[2] = "Dialing";
+            }
+            break;
+
+            case CallState_Alerting:
+            {
+                param[2] = "Alerting";
+            }
+            break;
+
+            case CallState_Incoming:
+            {
+                param[2] = "Incoming";
+            }
+            break;
+
+            case CallState_Waiting:
+            {
+                param[2] = "Waiting";
+            }
+            break;
+
+            case CallState_Hangup:
+            {
+                param[2] = "Hangup";
+            }
+            break;
+
+            case CallState_SwapDummy:
+            {
+                param[2] = "SwapDummy";
+            }
+            break;
+		}
+
+		param[3] = i.name;
+		param[4] = i.incoming ? "incoming" : "outgoing";
+
+		widget->updateCallView( param, row );
+		row++;
 	}
 
 	widget->CSSIactivation( enableCSSI );
@@ -160,6 +225,20 @@ void ControlWidget::CSSUactivation( bool enableCSSU )
     ui->cbCSSU->setEnabled( enableCSSU );
 }
 
+void ControlWidget::clearCallView()
+{
+    ui->twCallMgt->clearContents();
+}
+
+void ControlWidget::updateCallView( QString callParameters [5], int row )
+{
+	if ( row > ui->twCallMgt->rowCount() - 1 )
+		ui->twCallMgt->insertRow( row );
+
+	for ( int i = 0; i < 5; i++ )
+		ui->twCallMgt->setItem( row, i, new QTableWidgetItem( callParameters[i] ) );
+}
+
 void Control::setPhoneNumber( const QString &number )
 {
     widget->setWindowTitle("Phonesim - Number: " + number);
@@ -172,20 +251,19 @@ void Control::warning( const QString &title, const QString &message )
 
 void ControlWidget::handleCSSNNotif()
 {
-
     ui->cbCSSU->setEnabled( false );
     ui->cbCSSI->setEnabled( false );
 
-    ui->cbCSSU->insertItem(0, "");
-    ui->cbCSSU->insertItem(1, "0 - forwarded", 0);
-    ui->cbCSSU->insertItem(3, "2 - on hold", 2);
-    ui->cbCSSU->insertItem(4, "3 - retrieved", 3);
-    ui->cbCSSU->insertItem(5, "4 - multiparty", 4);
+    ui->cbCSSU->insertItem( 0, "" );
+    ui->cbCSSU->insertItem( 1, "0 - forwarded", 0 );
+    ui->cbCSSU->insertItem( 3, "2 - on hold", 2 );
+    ui->cbCSSU->insertItem( 4, "3 - retrieved", 3 );
+    ui->cbCSSU->insertItem( 5, "4 - multiparty", 4 );
 
-    ui->cbCSSI->insertItem(0, "");
-    ui->cbCSSI->insertItem(3, "2 - forwarded", 2);
-    ui->cbCSSI->insertItem(6, "5 - outgoing barred", 5);
-    ui->cbCSSI->insertItem(7, "6 - incomming barred", 6);
+    ui->cbCSSI->insertItem( 0, "" );
+    ui->cbCSSI->insertItem( 3, "2 - forwarded", 2 );
+    ui->cbCSSI->insertItem( 6, "5 - outgoing barred", 5 );
+    ui->cbCSSI->insertItem( 7, "6 - incomming barred", 6 );
 }
 
 void ControlWidget::sendCSSN()
@@ -195,7 +273,7 @@ void ControlWidget::sendCSSN()
     if ( v.canConvert<int>() && ui->cbCSSU->isEnabled() )
         emit unsolicitedCommand( "+CSSU: "+QString::number( v.toInt() ) );
 
-    v = ui->cbCSSI->itemData(ui->cbCSSI->currentIndex());
+    v = ui->cbCSSI->itemData( ui->cbCSSI->currentIndex() );
 
     if ( v.canConvert<int>() && ui->cbCSSI->isEnabled() )
         emit unsolicitedCommand( "+CSSI: "+QString::number( v.toInt() ) );
diff --git a/src/control.h b/src/control.h
index 2ccde29..20bdc86 100644
--- a/src/control.h
+++ b/src/control.h
@@ -74,7 +74,8 @@ public:
     void handleCSSNNotif();
     void CSSUactivation( bool enableCSSU );
     void CSSIactivation( bool enableCSSI );
-
+    void updateCallView( QString callParameters [5], int row );
+    void clearCallView();
 
 private slots:
     void sendSQ();
-- 
1.7.1


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

* Re: [PATCH 1/6] callmanager: Add signal on call status change
  2011-04-28  9:49 ` [PATCH 1/6] callmanager: Add signal on call status change Nicolas Bertrand
@ 2011-04-28 19:52   ` Denis Kenzior
  0 siblings, 0 replies; 9+ messages in thread
From: Denis Kenzior @ 2011-04-28 19:52 UTC (permalink / raw)
  To: ofono

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

Hi Nicolas,

On 04/28/2011 04:49 AM, Nicolas Bertrand wrote:
> ---
>  src/callmanager.cpp |   34 ++++++++++++++++++++++++++--------
>  src/callmanager.h   |    3 +++
>  2 files changed, 29 insertions(+), 8 deletions(-)
> 
> diff --git a/src/callmanager.cpp b/src/callmanager.cpp
> index 585a3ac..9823f05 100644
> --- a/src/callmanager.cpp
> +++ b/src/callmanager.cpp
> @@ -149,6 +149,8 @@ bool CallManager::command( const QString& cmd )
>          info.dialBack = false;
>          callList += info;
>  
> +        emit sendCallStatus( &callList );
> +
>          // Advertise the call state change and then return to command mode.
>          sendState( info );
>          send( "OK" );
> @@ -176,6 +178,8 @@ bool CallManager::command( const QString& cmd )
>                  info.dialBack = false;
>                  callList += info;
>  
> +                emit sendCallStatus( &callList );
> +
>                  // Advertise the call state change and then return to command mode.
>                  sendState( info );
>                  send( "CONNECT 19200" );
> @@ -369,6 +373,7 @@ void CallManager::startIncomingCall( const QString& number,
>      callList += info;
>  
>      emitRing(info);
> +    emit sendCallStatus( &callList );
>  
>      // Announce the incoming call using Ericsson-style state notifications.
>      sendState( info );
> @@ -395,6 +400,7 @@ void CallManager::hangupAll()
>      connectTimer->stop();
>      alertingTimer->stop();
>      hangupTimer->stop();
> +    emit sendCallStatus( &callList );
>  }
>  
>  void CallManager::hangupConnected()
> @@ -412,6 +418,8 @@ void CallManager::hangupConnected()
>  
>      if ( !hasCall( CallState_Held ) )
>          waitingToIncoming();
> +
> +    emit sendCallStatus( &callList );
>  }
>  
>  void CallManager::hangupHeld()
> @@ -429,6 +437,8 @@ void CallManager::hangupHeld()
>  
>      if ( !hasCall( CallState_Active ) )
>          waitingToIncoming();
> +
> +    emit sendCallStatus( &callList );
>  }
>  
>  void CallManager::hangupConnectedAndHeld()
> @@ -445,6 +455,7 @@ void CallManager::hangupConnectedAndHeld()
>      }
>      callList = newCallList;
>      waitingToIncoming();
> +    emit sendCallStatus( &callList );
>  }
>  
>  void CallManager::hangupCall( int id )
> @@ -464,15 +475,13 @@ bool CallManager::acceptCall()
>      } else if ( hasCall( CallState_Active ) ) {
>          // Put the active calls on hold and accept the incoming call.
>          changeGroup( CallState_Active, CallState_Held );
> -        callList[index].state = CallState_Active;
> -        sendState( callList[index] );
> -        return true;
> -    } else {
> -        // Only held calls, or no other calls, so just make the incoming call active.
> -        callList[index].state = CallState_Active;
> -        sendState( callList[index] );
> -        return true;
>      }
> +
> +	// No more active calls, so accept incoming

Please make sure to follow phonesim's 4-space indentation rules.

> +    callList[index].state = CallState_Active;
> +    sendState( callList[index] );
> +    emit sendCallStatus( &callList );
> +	return true;

This chunk is changing the behavior and does not belong in this patch.
Please send the behavior modification separately.  Also please note that
once any calls (active or held) exist, then you cannot have incoming
calls, only waiting calls.  The logic of this function can probably be
simplified somewhat.

>  }
>  
>  bool CallManager::chld0()
> @@ -500,6 +509,7 @@ bool CallManager::chld1()
>          int index = indexForId(id);
>          callList[index].state = CallState_Active;
>          sendState( callList[index] );
> +        emit sendCallStatus( &callList );
>          return true;
>      } else if ( hasCall( CallState_Held ) ) {
>          // Hangup the active calls and activate the held ones.
> @@ -508,6 +518,7 @@ bool CallManager::chld1()
>              if ( callList[index].state == CallState_Held ) {
>                  callList[index].state = CallState_Active;
>                  sendState( callList[index] );
> +                emit sendCallStatus( &callList );
>              }
>          }
>          return true;
> @@ -551,6 +562,7 @@ bool CallManager::chld1x( int x )
>      if ( !hasCall( CallState_Active ) && !hasCall( CallState_Held ) )
>          waitingToIncoming();
>  
> +    emit sendCallStatus( &callList );
>      return found;
>  }
>  
> @@ -570,6 +582,7 @@ bool CallManager::chld2()
>          int index = indexForId( id );
>          callList[index].state = CallState_Active;
>          sendState( callList[index] );
> +        emit sendCallStatus( &callList );
>          return true;
>      } else if ( hasCall( CallState_Active ) && hasCall( CallState_Held ) ) {
>          // Swap the active and held calls.
> @@ -620,6 +633,7 @@ bool CallManager::chld2x( int x )
>              // No active calls, so make just this call active.
>              callList[index].state = CallState_Active;
>              sendState( callList[index] );
> +            emit sendCallStatus( &callList );
>          }
>          return true;
>      } else if ( callList[index].state == CallState_Active ) {
> @@ -634,6 +648,7 @@ bool CallManager::chld2x( int x )
>                      return false;
>                  callList[index2].state = CallState_Held;
>                  sendState( callList[index2] );
> +                emit sendCallStatus( &callList );
>              }
>          }
>          return true;
> @@ -691,6 +706,7 @@ void CallManager::dialingToConnected()
>      // Transition the call to its new state.
>      callList[index].state = CallState_Active;
>      sendState( callList[index] );
> +    emit sendCallStatus( &callList );
>      // If the dialed number starts with 05123, disconnect the
>      // call after xx seconds, where xx is part of the dial string
>      // as 05123xx
> @@ -714,6 +730,7 @@ void CallManager::dialingToAlerting()
>      // Transition the call to its new state.
>      callList[index].state = CallState_Alerting;
>      sendState( callList[index] );
> +    emit sendCallStatus( &callList );
>  }
>  
>  void CallManager::waitingToIncoming()
> @@ -856,6 +873,7 @@ void CallManager::changeGroup( CallState oldState, CallState newState )
>              sendState( callList[index] );
>          }
>      }
> +    emit sendCallStatus( &callList );
>  }
>  
>  void CallManager::sendState( const CallInfo& info )
> diff --git a/src/callmanager.h b/src/callmanager.h
> index 5876c87..69e8d3b 100644
> --- a/src/callmanager.h
> +++ b/src/callmanager.h
> @@ -114,6 +114,9 @@ signals:
>      // Send a call control event.
>      void controlEvent( const QSimControlEvent& event );
>  
> +    // Send calls list on status change
> +    void sendCallStatus( QList<CallInfo> *list );
> +

For Qt style APIs signals should use past-tense wording.  e.g. something
like callStatesChanged().  I know phonesim isn't really good in this
respect ;).  Lets strive to do better for new additions

>  private slots:
>      // Transition the active dialing or alerting call to connected.
>      void dialingToConnected();

Regards,
-Denis

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

* Re: [PATCH 2/6] control: Update UI using call status
  2011-04-28  9:49 ` [PATCH 2/6] control: Update UI using call status Nicolas Bertrand
@ 2011-04-28 19:58   ` Denis Kenzior
  0 siblings, 0 replies; 9+ messages in thread
From: Denis Kenzior @ 2011-04-28 19:58 UTC (permalink / raw)
  To: ofono

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

Hi Nicolas,

On 04/28/2011 04:49 AM, Nicolas Bertrand wrote:
> ---
>  src/control.cpp |   40 +++++++++++++++++++++++++++++++++++-----
>  src/control.h   |    5 +++++
>  2 files changed, 40 insertions(+), 5 deletions(-)
> 
> diff --git a/src/control.cpp b/src/control.cpp
> index 645219c..2f12d91 100644
> --- a/src/control.cpp
> +++ b/src/control.cpp
> @@ -134,6 +134,32 @@ Control::~Control()
>      delete widget;
>  }
>  
> +void Control::callManagement( QList<CallInfo> *list )
> +{
> +	bool enableCSSU = false;
> +	bool enableCSSI = false;
> +
> +	foreach( CallInfo i, *list ) {
> +		if ( i.incoming && !enableCSSU )
> +			enableCSSU = true;
> +		if ( !i.incoming && !enableCSSI )
> +			enableCSSI = true;

indentation consistency please ;)

> +	}
> +
> +	widget->CSSIactivation( enableCSSI );
> +	widget->CSSUactivation( enableCSSU );
> +}
> +
> +void ControlWidget::CSSIactivation( bool enableCSSI )
> +{
> +    ui->cbCSSI->setEnabled( enableCSSI );
> +}
> +
> +void ControlWidget::CSSUactivation( bool enableCSSU )
> +{
> +    ui->cbCSSU->setEnabled( enableCSSU );
> +}

These might be better named something like:

setCssiEnabled and setCssuEnabled.  Note that Qt APIs are strict
CamelCase, even with abbreviations and the first word of a function
should be all small-caps.

> +
>  void Control::setPhoneNumber( const QString &number )
>  {
>      widget->setWindowTitle("Phonesim - Number: " + number);
> @@ -146,6 +172,10 @@ void Control::warning( const QString &title, const QString &message )
>  
>  void ControlWidget::handleCSSNNotif()
>  {
> +
> +    ui->cbCSSU->setEnabled( false );
> +    ui->cbCSSI->setEnabled( false );
> +
>      ui->cbCSSU->insertItem(0, "");
>      ui->cbCSSU->insertItem(1, "0 - forwarded", 0);
>      ui->cbCSSU->insertItem(3, "2 - on hold", 2);
> @@ -160,15 +190,15 @@ void ControlWidget::handleCSSNNotif()
>  
>  void ControlWidget::sendCSSN()
>  {
> -    QVariant v = ui->cbCSSU->itemData(ui->cbCSSU->currentIndex());
> +    QVariant v = ui->cbCSSU->itemData( ui->cbCSSU->currentIndex() );
>  
> -    if (v.canConvert<int>())
> -        emit unsolicitedCommand("+CSSU: "+QString::number(v.toInt()));
> +    if ( v.canConvert<int>() && ui->cbCSSU->isEnabled() )
> +        emit unsolicitedCommand( "+CSSU: "+QString::number( v.toInt() ) );
>  
>      v = ui->cbCSSI->itemData(ui->cbCSSI->currentIndex());
>  
> -    if (v.canConvert<int>())
> -        emit unsolicitedCommand("+CSSI: "+QString::number(v.toInt()));
> +    if ( v.canConvert<int>() && ui->cbCSSI->isEnabled() )
> +        emit unsolicitedCommand( "+CSSI: "+QString::number( v.toInt() ) );
>  }
>  
>  void ControlWidget::sendSQ()
> diff --git a/src/control.h b/src/control.h
> index c17146a..2ccde29 100644
> --- a/src/control.h
> +++ b/src/control.h
> @@ -25,6 +25,7 @@
>  #include <QtScript>
>  #include "ui_controlbase.h"
>  #include "attranslator.h"
> +#include "callmanager.h"
>  
>  class Control;
>  
> @@ -71,6 +72,9 @@ public:
>      void handleToData( const QString& );
>      void handleNewApp();
>      void handleCSSNNotif();
> +    void CSSUactivation( bool enableCSSU );
> +    void CSSIactivation( bool enableCSSI );
> +
>  
>  private slots:
>      void sendSQ();
> @@ -146,6 +150,7 @@ public slots:
>      void handleToData( const QString& );
>      void setPhoneNumber( const QString& );
>      void handleNewApp();
> +    void callManagement( QList<CallInfo> *info );
>  
>  protected:
>      virtual void warning( const QString&, const QString& );

Regards,
-Denis

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

end of thread, other threads:[~2011-04-28 19:58 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-28  9:49 [PATCH 0/6] phonesim: Add call status UI Nicolas Bertrand
2011-04-28  9:49 ` [PATCH 1/6] callmanager: Add signal on call status change Nicolas Bertrand
2011-04-28 19:52   ` Denis Kenzior
2011-04-28  9:49 ` [PATCH 2/6] control: Update UI using call status Nicolas Bertrand
2011-04-28 19:58   ` Denis Kenzior
2011-04-28  9:49 ` [PATCH 3/6] hardwaremanipulator: add callmanagement method Nicolas Bertrand
2011-04-28  9:49 ` [PATCH 4/6] phonesim: Connect call status signal Nicolas Bertrand
2011-04-28  9:49 ` [PATCH 5/6] controlbase.ui: Add call mangement tab Nicolas Bertrand
2011-04-28  9:49 ` [PATCH 6/6] control: Update call view Nicolas Bertrand

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.