Skip to contentSkip to conversation

phonesim: Fix AT+CHLD=1x

PATCH In review Frédéric Danis 2 participants 3 messages Mar 13, 2012 – Mar 14, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 phonesim: Fix AT+CHLD=1x

AT+CHLD=1x should only hangup active call

---
 src/callmanager.cpp |   38 ++++++++++++++++++++++++--------------
 1 files changed, 24 insertions(+), 14 deletions(-)
src/callmanager.cpp +24 -14
index dfa2b9e..7208100 100644
@@ -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()
Signature · 1 line
1.7.1
#1 lore raw

Hi Frédéric,

Quoted 5 lines · Frédéric Danis

AT+CHLD=1x should only hangup active call

---
 src/callmanager.cpp |   38 ++++++++++++++++++++++++--------------
 1 files changed, 24 insertions(+), 14 deletions(-)

What are you trying to fix here? Phonesim models the behavior of an 'ideal' modem which can hangup any call using release_specific. Plenty of modems exhibit this behavior via vendor specific AT commands, so if this is related to HFP emulation then we probably need to do something else.

Regards,
-Denis

#2 lore raw

Hello Denis,

Quoted 9 lines · Denis Kenzior

Hi Frédéric,

Quoted 5 lines · Frédéric Danis

AT+CHLD=1x should only hangup active call

---
  src/callmanager.cpp |   38 ++++++++++++++++++++++++--------------
  1 files changed, 24 insertions(+), 14 deletions(-)
Quoted 8 lines

What are you trying to fix here? Phonesim models the behavior of an 'ideal' modem which can hangup any call using release_specific. Plenty of modems exhibit this behavior via vendor specific AT commands, so if this is related to HFP emulation then we probably need to do something else.

Regards,
-Denis

I found this during tests around AT+CHLD commands.
I just follows HFP and 3GPP specs about the AT+CHLD=1x command :
"Releases a specific active call X.".
But if this is the attended behavior in phonesim, just forget my patch.

Regards

Fred

Signature · 2 lines
Frederic Danis                            Open Source Technology Center
frederic.danis(a)intel.com                              Intel Corporation