From: =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis <frederic.danis@linux.intel.com>
To: ofono@ofono.org
Subject: [PATCH] phonesim: Fix AT+CHLD=1x
Date: Tue, 13 Mar 2012 15:33:15 +0100 [thread overview]
Message-ID: <1331649195-23257-1-git-send-email-frederic.danis@linux.intel.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 2238 bytes --]
AT+CHLD=1x should only hangup active call
---
src/callmanager.cpp | 38 ++++++++++++++++++++++++--------------
1 files changed, 24 insertions(+), 14 deletions(-)
diff --git a/src/callmanager.cpp b/src/callmanager.cpp
index dfa2b9e..7208100 100644
--- a/src/callmanager.cpp
+++ b/src/callmanager.cpp
@@ -441,7 +441,21 @@ void CallManager::hangupConnectedAndHeld()
void CallManager::hangupCall( int id )
{
- chld1x( id );
+ QList<CallInfo> newCallList;
+ for ( int index = 0; index < callList.size(); ++index ) {
+ if ( callList[index].id == id ) {
+ callList[index].state = CallState_Hangup;
+ sendState( callList[index] );
+ } else {
+ newCallList += callList[index];
+ }
+ }
+ callList = newCallList;
+
+ if ( !hasCall( CallState_Active ) && !hasCall( CallState_Held ) )
+ waitingToIncoming();
+
+ emit callStatesChanged( &callList );
}
void CallManager::hangupRemote( int id )
@@ -491,8 +505,10 @@ bool CallManager::chld0()
{
// If there is an incoming call, then that is the one to hang up.
int id = idForIncoming();
- if ( id >= 0 )
- return chld1x( id );
+ if ( id >= 0 ) {
+ hangupCall( id );
+ return true;
+ }
// Bail out if no held calls.
if ( !hasCall( CallState_Held ) )
@@ -540,24 +556,18 @@ bool CallManager::chld1()
bool CallManager::chld1x( int x )
{
- QList<CallInfo> newCallList;
- bool found = false;
for ( int index = 0; index < callList.size(); ++index ) {
- if ( callList[index].id == x ) {
- callList[index].state = CallState_Hangup;
- sendState( callList[index] );
- found = true;
- } else {
- newCallList += callList[index];
+ if ( callList[index].id == x && callList[index].state == CallState_Active) {
+ hangupCall( x );
+ return true;
}
}
- callList = newCallList;
if ( !hasCall( CallState_Active ) && !hasCall( CallState_Held ) )
- waitingToIncoming();
+ waitingToIncoming();
emit callStatesChanged( &callList );
- return found;
+ return false;
}
bool CallManager::chld2()
--
1.7.1
next reply other threads:[~2012-03-13 14:33 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-13 14:33 =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis [this message]
2012-03-14 2:38 ` [PATCH] phonesim: Fix AT+CHLD=1x Denis Kenzior
2012-03-14 11:39 ` Frederic Danis
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=1331649195-23257-1-git-send-email-frederic.danis@linux.intel.com \
--to=frederic.danis@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