Open Source Telephony
 help / color / mirror / Atom feed
From: Nicolas Bertrand <nicolas.bertrand@linux.intel.com>
To: ofono@ofono.org
Subject: [PATCH 1/6] callmanager: Add signal on call status change
Date: Thu, 28 Apr 2011 11:49:34 +0200	[thread overview]
Message-ID: <1303984179-8333-2-git-send-email-nicolas.bertrand@linux.intel.com> (raw)
In-Reply-To: <1303984179-8333-1-git-send-email-nicolas.bertrand@linux.intel.com>

[-- 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


  reply	other threads:[~2011-04-28  9:49 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-28  9:49 [PATCH 0/6] phonesim: Add call status UI Nicolas Bertrand
2011-04-28  9:49 ` Nicolas Bertrand [this message]
2011-04-28 19:52   ` [PATCH 1/6] callmanager: Add signal on call status change 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1303984179-8333-2-git-send-email-nicolas.bertrand@linux.intel.com \
    --to=nicolas.bertrand@linux.intel.com \
    --cc=ofono@ofono.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox