phoneapp/phoneuistates/src/cphonesingleandcallsetupandwaiting.cpp
changeset 78 baacf668fe89
parent 76 cfea66083b62
--- a/phoneapp/phoneuistates/src/cphonesingleandcallsetupandwaiting.cpp	Mon Oct 04 16:06:10 2010 +0300
+++ b/phoneapp/phoneuistates/src/cphonesingleandcallsetupandwaiting.cpp	Fri Oct 15 12:58:46 2010 +0300
@@ -34,9 +34,9 @@
 #include "tphonecmdparamstring.h"
 #include "tphonecmdparamcallheaderdata.h"
 #include "tphonecmdparamglobalnote.h"
-#include "tphonecmdparamcallstatedata.h"
 #include "phonestatedefinitionsgsm.h"
 #include "phonelogger.h"
+#include "phonecallutil.h"
 
 enum TTerminatedCall
 {
@@ -79,11 +79,7 @@
     {
     CPhoneGsmInCall::ConstructL();
 
-    TPhoneCmdParamCallStateData callStateData;
-    callStateData.SetCallState( EPEStateRinging );
-    iViewCommandHandle->HandleCommandL(
-        EPhoneViewGetCallIdByState, &callStateData );
-    iWaitingCallId = callStateData.CallId();
+    iWaitingCallId = PhoneCallUtil::CallIdByState( EPEStateRinging );
     }
 
 // -----------------------------------------------------------
@@ -225,44 +221,12 @@
 void CPhoneSingleAndCallSetupAndWaiting::HandleIdleL( TInt aCallId )
     {
     __LOGMETHODSTARTEND( EPhoneUIStates, "CPhoneSingleAndCallSetupAndWaiting::HandleIdleL() ");
-    // Fetch call ids for hold, ringing and alerting bubbles
-    TInt holdCallId;
-    TInt ringingCallId;
-    TInt alertingCallId;
-    TPhoneViewResponseId heldResponse;
-    TPhoneViewResponseId ringingResponse;
-    TPhoneViewResponseId alertingResponse;
-    TPhoneCmdParamCallStateData callStateData;
     
     iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveCallHeader, aCallId );
-    
-    callStateData.SetCallState( EPEStateHeld );
-    heldResponse = iViewCommandHandle->HandleCommandL(
-        EPhoneViewGetCallIdByState, &callStateData );
-    holdCallId = callStateData.CallId();
-    
-    callStateData.SetCallState( EPEStateRinging );
-    ringingResponse = iViewCommandHandle->HandleCommandL(
-        EPhoneViewGetCallIdByState, &callStateData );
-    ringingCallId = callStateData.CallId();
-                
-    callStateData.SetCallState( EPEStateConnecting );
-    alertingResponse = iViewCommandHandle->HandleCommandL(
-        EPhoneViewGetCallIdByState, &callStateData );
-    alertingCallId = callStateData.CallId();
-    
-    if( heldResponse != EPhoneViewResponseSuccess ||
-        ringingResponse != EPhoneViewResponseSuccess ||
-        alertingResponse != EPhoneViewResponseSuccess )
-        {
-        // Some or all call id fetches were unsuccesfull.
-        // Terminate all connections and return to idle state.
-        // TBD: Kill all bubbles here
-        iStateMachine->SendPhoneEngineMessage(
-            MPEPhoneModel::EPEMessageTerminateAllConnections );
-        CPhoneGsmInCall::HandleIdleL( aCallId );
-        return;
-        }
+
+    TInt holdCallId = PhoneCallUtil::CallIdByState( EPEStateHeld );
+    TInt ringingCallId = PhoneCallUtil::CallIdByState( EPEStateRinging );
+    TInt alertingCallId = PhoneCallUtil::CallIdByState( EPEStateConnecting );
 
     // Find out which call was terminated
     TTerminatedCall terminatedCall = ENull;