phoneapp/phoneuistates/src/cphonesingleandcallsetupandwaiting.cpp
changeset 78 baacf668fe89
parent 76 cfea66083b62
equal deleted inserted replaced
76:cfea66083b62 78:baacf668fe89
    32 #include "tphonecmdparaminteger.h"
    32 #include "tphonecmdparaminteger.h"
    33 #include "tphonecmdparamboolean.h"
    33 #include "tphonecmdparamboolean.h"
    34 #include "tphonecmdparamstring.h"
    34 #include "tphonecmdparamstring.h"
    35 #include "tphonecmdparamcallheaderdata.h"
    35 #include "tphonecmdparamcallheaderdata.h"
    36 #include "tphonecmdparamglobalnote.h"
    36 #include "tphonecmdparamglobalnote.h"
    37 #include "tphonecmdparamcallstatedata.h"
       
    38 #include "phonestatedefinitionsgsm.h"
    37 #include "phonestatedefinitionsgsm.h"
    39 #include "phonelogger.h"
    38 #include "phonelogger.h"
       
    39 #include "phonecallutil.h"
    40 
    40 
    41 enum TTerminatedCall
    41 enum TTerminatedCall
    42 {
    42 {
    43     ENull = 0,
    43     ENull = 0,
    44     EHold,
    44     EHold,
    77 //
    77 //
    78 void CPhoneSingleAndCallSetupAndWaiting::ConstructL()
    78 void CPhoneSingleAndCallSetupAndWaiting::ConstructL()
    79     {
    79     {
    80     CPhoneGsmInCall::ConstructL();
    80     CPhoneGsmInCall::ConstructL();
    81 
    81 
    82     TPhoneCmdParamCallStateData callStateData;
    82     iWaitingCallId = PhoneCallUtil::CallIdByState( EPEStateRinging );
    83     callStateData.SetCallState( EPEStateRinging );
       
    84     iViewCommandHandle->HandleCommandL(
       
    85         EPhoneViewGetCallIdByState, &callStateData );
       
    86     iWaitingCallId = callStateData.CallId();
       
    87     }
    83     }
    88 
    84 
    89 // -----------------------------------------------------------
    85 // -----------------------------------------------------------
    90 // CPhoneSingleAndCallSetupAndWaiting::NewL()
    86 // CPhoneSingleAndCallSetupAndWaiting::NewL()
    91 // Constructor
    87 // Constructor
   223 // -----------------------------------------------------------
   219 // -----------------------------------------------------------
   224 //
   220 //
   225 void CPhoneSingleAndCallSetupAndWaiting::HandleIdleL( TInt aCallId )
   221 void CPhoneSingleAndCallSetupAndWaiting::HandleIdleL( TInt aCallId )
   226     {
   222     {
   227     __LOGMETHODSTARTEND( EPhoneUIStates, "CPhoneSingleAndCallSetupAndWaiting::HandleIdleL() ");
   223     __LOGMETHODSTARTEND( EPhoneUIStates, "CPhoneSingleAndCallSetupAndWaiting::HandleIdleL() ");
   228     // Fetch call ids for hold, ringing and alerting bubbles
       
   229     TInt holdCallId;
       
   230     TInt ringingCallId;
       
   231     TInt alertingCallId;
       
   232     TPhoneViewResponseId heldResponse;
       
   233     TPhoneViewResponseId ringingResponse;
       
   234     TPhoneViewResponseId alertingResponse;
       
   235     TPhoneCmdParamCallStateData callStateData;
       
   236     
   224     
   237     iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveCallHeader, aCallId );
   225     iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveCallHeader, aCallId );
   238     
   226 
   239     callStateData.SetCallState( EPEStateHeld );
   227     TInt holdCallId = PhoneCallUtil::CallIdByState( EPEStateHeld );
   240     heldResponse = iViewCommandHandle->HandleCommandL(
   228     TInt ringingCallId = PhoneCallUtil::CallIdByState( EPEStateRinging );
   241         EPhoneViewGetCallIdByState, &callStateData );
   229     TInt alertingCallId = PhoneCallUtil::CallIdByState( EPEStateConnecting );
   242     holdCallId = callStateData.CallId();
       
   243     
       
   244     callStateData.SetCallState( EPEStateRinging );
       
   245     ringingResponse = iViewCommandHandle->HandleCommandL(
       
   246         EPhoneViewGetCallIdByState, &callStateData );
       
   247     ringingCallId = callStateData.CallId();
       
   248                 
       
   249     callStateData.SetCallState( EPEStateConnecting );
       
   250     alertingResponse = iViewCommandHandle->HandleCommandL(
       
   251         EPhoneViewGetCallIdByState, &callStateData );
       
   252     alertingCallId = callStateData.CallId();
       
   253     
       
   254     if( heldResponse != EPhoneViewResponseSuccess ||
       
   255         ringingResponse != EPhoneViewResponseSuccess ||
       
   256         alertingResponse != EPhoneViewResponseSuccess )
       
   257         {
       
   258         // Some or all call id fetches were unsuccesfull.
       
   259         // Terminate all connections and return to idle state.
       
   260         // TBD: Kill all bubbles here
       
   261         iStateMachine->SendPhoneEngineMessage(
       
   262             MPEPhoneModel::EPEMessageTerminateAllConnections );
       
   263         CPhoneGsmInCall::HandleIdleL( aCallId );
       
   264         return;
       
   265         }
       
   266 
   230 
   267     // Find out which call was terminated
   231     // Find out which call was terminated
   268     TTerminatedCall terminatedCall = ENull;
   232     TTerminatedCall terminatedCall = ENull;
   269     if( holdCallId < 0 )
   233     if( holdCallId < 0 )
   270         {
   234         {