phoneapp/phoneuicontrol/src/cphonestateincall.cpp
changeset 78 baacf668fe89
parent 76 cfea66083b62
equal deleted inserted replaced
76:cfea66083b62 78:baacf668fe89
    30 #include "tphonecmdparamboolean.h"
    30 #include "tphonecmdparamboolean.h"
    31 #include "tphonecmdparaminteger.h"
    31 #include "tphonecmdparaminteger.h"
    32 #include "tphonecmdparamstring.h"
    32 #include "tphonecmdparamstring.h"
    33 #include "tphonecmdparamnote.h"
    33 #include "tphonecmdparamnote.h"
    34 #include "tphonecmdparamquery.h"
    34 #include "tphonecmdparamquery.h"
    35 #include "tphonecmdparamcallstatedata.h"
       
    36 #include "tphonecmdparamkeycapture.h"
    35 #include "tphonecmdparamkeycapture.h"
    37 #include "tphonecmdparamsfidata.h"
    36 #include "tphonecmdparamsfidata.h"
    38 #include "mphonestatemachine.h"
    37 #include "mphonestatemachine.h"
    39 #include "phonestatedefinitions.h"
    38 #include "phonestatedefinitions.h"
    40 #include "phoneviewcommanddefinitions.h"
    39 #include "phoneviewcommanddefinitions.h"
    48 #include "tphonecmdparamcallheaderdata.h"
    47 #include "tphonecmdparamcallheaderdata.h"
    49 #include "cphonemediatorfactory.h"
    48 #include "cphonemediatorfactory.h"
    50 #include "cphonemediatorsender.h"
    49 #include "cphonemediatorsender.h"
    51 #include "cphoneterminateallconnectionscommand.h"
    50 #include "cphoneterminateallconnectionscommand.h"
    52 #include "mphonecustomization.h"
    51 #include "mphonecustomization.h"
       
    52 #include "phonecallutil.h"
       
    53 
    53 
    54 
    54 // ================= MEMBER FUNCTIONS =======================
    55 // ================= MEMBER FUNCTIONS =======================
    55 
    56 
    56 // C++ default constructor can NOT contain any code, that
    57 // C++ default constructor can NOT contain any code, that
    57 // might leave.
    58 // might leave.
   245     if ( iNumberEntryManager->IsNumberEntryUsedL() )
   246     if ( iNumberEntryManager->IsNumberEntryUsedL() )
   246         {
   247         {
   247         iViewCommandHandle->ExecuteCommand(
   248         iViewCommandHandle->ExecuteCommand(
   248                 EPhoneViewGetNumberFromEntry,
   249                 EPhoneViewGetNumberFromEntry,
   249                 &stringParam );
   250                 &stringParam );
   250         iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveNumberEntry );
       
   251         showDialer = ETrue;
   251         showDialer = ETrue;
   252         }
   252         }
       
   253     
       
   254     iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveNumberEntry );
   253     
   255     
   254     if ( IsAutoLockOn() || !showDialer )
   256     if ( IsAutoLockOn() || !showDialer )
   255         {
   257         {
   256         RemoveDialogsAndSendPhoneToBackgroundL();
   258         RemoveDialogsAndSendPhoneToBackgroundL();
   257         }
   259         }
   610 void CPhoneStateInCall::LaunchDtmfListQueryL()
   612 void CPhoneStateInCall::LaunchDtmfListQueryL()
   611     {
   613     {
   612     __LOGMETHODSTARTEND(EPhoneControl,  
   614     __LOGMETHODSTARTEND(EPhoneControl,  
   613         "CPhoneStateInCall::LaunchDtmfListQueryL()" );
   615         "CPhoneStateInCall::LaunchDtmfListQueryL()" );
   614     
   616     
   615     TPhoneCmdParamCallStateData callStateData;
   617     TInt callId = PhoneCallUtil::CallIdByState( EPEStateConnected );
   616     callStateData.SetCallState( EPEStateConnected );
   618     if ( callId == KErrNotFound )
   617     iViewCommandHandle->HandleCommandL(
   619         {
   618         EPhoneViewGetCallIdByState, &callStateData );
   620         callId = PhoneCallUtil::CallIdByState( EPEStateConnecting );
   619    
       
   620     if ( callStateData.CallId() == KErrNotFound )
       
   621         {
       
   622         callStateData.SetCallState( EPEStateConnecting );
       
   623         iViewCommandHandle->HandleCommandL(
       
   624             EPhoneViewGetCallIdByState, &callStateData );    
       
   625         }
   621         }
   626         
   622         
   627     if ( callStateData.CallId() > KErrNotFound )
   623     if ( callId > KErrNotFound )
   628         {
   624         {
   629         //Get Array of DTMF strings from PhoneEngine
   625         //Get Array of DTMF strings from PhoneEngine
   630         const CDesCArray& dtmfArray = 
   626         const CDesCArray& dtmfArray = 
   631         iStateMachine->PhoneEngineInfo()->
   627         iStateMachine->PhoneEngineInfo()->
   632         RemotePredefinedDtmfStrings( callStateData.CallId() );
   628         RemotePredefinedDtmfStrings( callId );
   633         TInt itemCount = dtmfArray.Count();  
   629         TInt itemCount = dtmfArray.Count();  
   634         if ( itemCount )
   630         if ( itemCount )
   635             {
   631             {
   636             TPhoneCmdParamString stringParam;
   632             TPhoneCmdParamString stringParam;
   637             //Go through the array and send each dtmf string
   633             //Go through the array and send each dtmf string
   656         {
   652         {
   657         __PHONELOG( EOnlyFatal, EPhoneControl, 
   653         __PHONELOG( EOnlyFatal, EPhoneControl, 
   658             "CPhoneStateInCall::LaunchDtmfListQueryL() No found valid call id" );
   654             "CPhoneStateInCall::LaunchDtmfListQueryL() No found valid call id" );
   659         }
   655         }
   660     // if there is a connected call only then open DtmfListQuery.
   656     // if there is a connected call only then open DtmfListQuery.
   661     if ( IsAnyConnectedCalls() )
   657     if ( PhoneCallUtil::IsAnyConnectedCalls() )
   662        {
   658        {
   663        TPhoneCmdParamQuery queryDialogParam;
   659        TPhoneCmdParamQuery queryDialogParam;
   664        queryDialogParam.SetQueryType( EPhoneDtmfListQueryDialog );
   660        queryDialogParam.SetQueryType( EPhoneDtmfListQueryDialog );
   665        queryDialogParam.SetQueryResourceId(
   661        queryDialogParam.SetQueryResourceId(
   666                CPhoneMainResourceResolver::Instance()->
   662                CPhoneMainResourceResolver::Instance()->
   676 //
   672 //
   677 EXPORT_C TBool CPhoneStateInCall::IsVideoCallActiveL()
   673 EXPORT_C TBool CPhoneStateInCall::IsVideoCallActiveL()
   678     {
   674     {
   679     __LOGMETHODSTARTEND(EPhoneControl,  
   675     __LOGMETHODSTARTEND(EPhoneControl,  
   680         "CPhoneStateInCall::IsVideoCallActive()" );
   676         "CPhoneStateInCall::IsVideoCallActive()" );
   681     TBool retVal = EFalse;
   677     return PhoneCallUtil::CheckIfCallExists(
   682     TPhoneCmdParamCallStateData callStateData;
   678                 EPEStateConnected, EPECallTypeVideo);
   683     callStateData.SetCallState( EPEStateConnected );
       
   684     iViewCommandHandle->HandleCommandL(
       
   685         EPhoneViewGetCallIdByState, &callStateData );
       
   686     if ( callStateData.CallId() > KErrNotFound )
       
   687         {
       
   688         retVal = IsVideoCall( callStateData.CallId() );
       
   689         }
       
   690     return retVal;
       
   691     }
       
   692     
       
   693 // ---------------------------------------------------------
       
   694 // CPhoneStateInCall::IsVideoCallRingingL
       
   695 // ---------------------------------------------------------
       
   696 //
       
   697 
       
   698 EXPORT_C TBool CPhoneStateInCall::IsVideoCallRingingL()
       
   699     {
       
   700     __LOGMETHODSTARTEND(EPhoneControl,  
       
   701         "CPhoneStateInCall::IsVideoCallRingingL()" );
       
   702     TBool retVal = EFalse;
       
   703     TPhoneCmdParamCallStateData callStateData;
       
   704     callStateData.SetCallState( EPEStateRinging );
       
   705     iViewCommandHandle->HandleCommandL(
       
   706         EPhoneViewGetCallIdByState, &callStateData );
       
   707     if ( callStateData.CallId() > KErrNotFound )
       
   708         {
       
   709         retVal = IsVideoCall( callStateData.CallId() );
       
   710         }
       
   711     return retVal;
       
   712     }
       
   713 
       
   714 // ---------------------------------------------------------
       
   715 // CPhoneStateInCall::GetRingingCallL
       
   716 // ---------------------------------------------------------
       
   717 //
       
   718 
       
   719 EXPORT_C TInt CPhoneStateInCall::GetRingingCallL()
       
   720     {
       
   721     __LOGMETHODSTARTEND(EPhoneControl,  
       
   722         "CPhoneStateInCall::GetRingingCallL()" );
       
   723     TPhoneCmdParamCallStateData callStateData;
       
   724     callStateData.SetCallState( EPEStateRinging );
       
   725     iViewCommandHandle->HandleCommandL(
       
   726         EPhoneViewGetCallIdByState, &callStateData );
       
   727     return callStateData.CallId();
       
   728     }
   679     }
   729 
   680 
   730 // -----------------------------------------------------------
   681 // -----------------------------------------------------------
   731 // CPhoneStateInCall::DisconnectOutgoingCallL
   682 // CPhoneStateInCall::DisconnectOutgoingCallL
   732 // -----------------------------------------------------------
   683 // -----------------------------------------------------------
   733 //
   684 //
   734 EXPORT_C void CPhoneStateInCall::DisconnectOutgoingCallL()
   685 EXPORT_C void CPhoneStateInCall::DisconnectOutgoingCallL()
   735     {
   686     {
   736     __LOGMETHODSTARTEND(EPhoneControl, 
   687     __LOGMETHODSTARTEND(EPhoneControl, 
   737         "CPhoneStateInCall::DisconnectOutgoingCallL()");
   688         "CPhoneStateInCall::DisconnectOutgoingCallL()");    
   738     TPhoneCmdParamCallStateData callStateData;
   689     TInt callId = PhoneCallUtil::CallIdByState( EPEStateConnecting );
   739     callStateData.SetCallState( EPEStateConnecting );
   690     if( callId == KErrNotFound )
   740     iViewCommandHandle->HandleCommandL(
       
   741         EPhoneViewGetCallIdByState, &callStateData );
       
   742     if( callStateData.CallId() == KErrNotFound )
       
   743         {
   691         {
   744         // No connecting call, find the dialing call
   692         // No connecting call, find the dialing call
   745         callStateData.SetCallState( EPEStateDialing );
   693         callId = PhoneCallUtil::CallIdByState( EPEStateDialing );
   746         iViewCommandHandle->HandleCommandL(
       
   747             EPhoneViewGetCallIdByState, &callStateData );
       
   748         
   694         
   749         if( callStateData.CallId() == KErrNotFound )
   695         if( callId == KErrNotFound )
   750             {
   696             {
   751             // No dialing call, find the disconnectinging call
   697             // No dialing call, find the disconnectinging call
   752             callStateData.SetCallState( EPEStateDisconnecting );
   698             callId = PhoneCallUtil::CallIdByState( EPEStateDisconnecting );
   753             iViewCommandHandle->HandleCommandL(
       
   754                 EPhoneViewGetCallIdByState, &callStateData );
       
   755             }
   699             }
   756         else
   700         else
   757             {
   701             {
   758             iNumberEntryManager->SetVisibilityIfNumberEntryUsedL(ETrue);
   702             iNumberEntryManager->SetVisibilityIfNumberEntryUsedL(ETrue);
   759             }
   703             }
   760         }
   704         }
   761 
   705 
   762     if( callStateData.CallId() > KErrNotFound )
   706     if( callId > KErrNotFound )
   763         {
   707         {
   764         iStateMachine->SetCallId( callStateData.CallId() );
   708         iStateMachine->SetCallId( callId );
   765         iStateMachine->SendPhoneEngineMessage( 
   709         iStateMachine->SendPhoneEngineMessage( 
   766             MPEPhoneModel::EPEMessageRelease );
   710             MPEPhoneModel::EPEMessageRelease );
   767         }
   711         }
   768      else
   712      else
   769         {
   713         {
   780 void CPhoneStateInCall::HandleEndKeyPressL( TPhoneKeyEventMessages aMessage )
   724 void CPhoneStateInCall::HandleEndKeyPressL( TPhoneKeyEventMessages aMessage )
   781     {
   725     {
   782     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateInCall::HandleEndKeyPressL()");
   726     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateInCall::HandleEndKeyPressL()");
   783     if ( aMessage == EPhoneKeyLongPress )
   727     if ( aMessage == EPhoneKeyLongPress )
   784         {
   728         {
   785         TPhoneCmdParamCallStateData callStateData;
   729         if( PhoneCallUtil::CheckIfCallExists(
   786         callStateData.SetCallState( EPEStateConnected );
   730                 EPEStateConnected, EPECallTypeVideo) )
   787         iViewCommandHandle->HandleCommandL(
       
   788             EPhoneViewGetCallIdByState, &callStateData );
       
   789 
       
   790         if( IsVideoCall( callStateData.CallId() ) )
       
   791             {
   731             {
   792             // Video call can be released only after we get response to VT Shutdown Command 
   732             // Video call can be released only after we get response to VT Shutdown Command 
   793             CPhoneMediatorFactory::Instance()->Sender()->IssueCommand( 
   733             CPhoneMediatorFactory::Instance()->Sender()->IssueCommand( 
   794                 KMediatorVideoTelephonyDomain,
   734                 KMediatorVideoTelephonyDomain,
   795                 KCatPhoneToVideotelCommands, 
   735                 KCatPhoneToVideotelCommands,