phoneapp/phoneuistates/src/cphonecallsetupandwaiting.cpp
branchRCL_3
changeset 61 41a7f70b3818
parent 58 40a3f856b14d
child 62 5266b1f337bd
equal deleted inserted replaced
58:40a3f856b14d 61:41a7f70b3818
     1 /*
     1 /*
     2 * Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). 
     2 * Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
    18 
    18 
    19 // INCLUDES
    19 // INCLUDES
    20 #include <pevirtualengine.h>
    20 #include <pevirtualengine.h>
    21 #include <StringLoader.h>
    21 #include <StringLoader.h>
    22 #include <MediatorDomainUIDs.h>
    22 #include <MediatorDomainUIDs.h>
    23 #include <videotelcontrolmediatorapi.h>
       
    24 
    23 
    25 #include "cphonecallsetupandwaiting.h"
    24 #include "cphonecallsetupandwaiting.h"
    26 #include "tphonecmdparamboolean.h"
    25 #include "tphonecmdparamboolean.h"
    27 #include "mphonestatemachine.h"
    26 #include "mphonestatemachine.h"
    28 #include "tphonecmdparamboolean.h"
    27 #include "tphonecmdparamboolean.h"
    42 // ================= MEMBER FUNCTIONS =======================
    41 // ================= MEMBER FUNCTIONS =======================
    43 
    42 
    44 // C++ default constructor can NOT contain any code, that
    43 // C++ default constructor can NOT contain any code, that
    45 // might leave.
    44 // might leave.
    46 //
    45 //
    47 CPhoneCallSetupAndWaiting::CPhoneCallSetupAndWaiting( 
    46 CPhoneCallSetupAndWaiting::CPhoneCallSetupAndWaiting(
    48     MPhoneStateMachine* aStateMachine, 
    47     MPhoneStateMachine* aStateMachine,
    49     MPhoneViewCommandHandle* aViewCommandHandle,
    48     MPhoneViewCommandHandle* aViewCommandHandle,
    50     MPhoneCustomization* aPhoneCustomization ) : 
    49     MPhoneCustomization* aPhoneCustomization ) :
    51     CPhoneGsmInCall( aStateMachine, aViewCommandHandle, aPhoneCustomization )
    50     CPhoneGsmInCall( aStateMachine, aViewCommandHandle, aPhoneCustomization )
    52     {
    51     {
    53     }
    52     }
    54 
    53 
    55 // -----------------------------------------------------------
    54 // -----------------------------------------------------------
    77 // CPhoneCallSetupAndWaiting::NewL()
    76 // CPhoneCallSetupAndWaiting::NewL()
    78 // Constructor
    77 // Constructor
    79 // (other items were commented in a header).
    78 // (other items were commented in a header).
    80 // -----------------------------------------------------------
    79 // -----------------------------------------------------------
    81 //
    80 //
    82 CPhoneCallSetupAndWaiting* CPhoneCallSetupAndWaiting::NewL( 
    81 CPhoneCallSetupAndWaiting* CPhoneCallSetupAndWaiting::NewL(
    83     MPhoneStateMachine* aStateMachine, 
    82     MPhoneStateMachine* aStateMachine,
    84     MPhoneViewCommandHandle* aViewCommandHandle,
    83     MPhoneViewCommandHandle* aViewCommandHandle,
    85     MPhoneCustomization* aPhoneCustomization )
    84     MPhoneCustomization* aPhoneCustomization )
    86     {
    85     {
    87     CPhoneCallSetupAndWaiting* self = new( ELeave ) CPhoneCallSetupAndWaiting( 
    86     CPhoneCallSetupAndWaiting* self = new( ELeave ) CPhoneCallSetupAndWaiting(
    88         aStateMachine, aViewCommandHandle, aPhoneCustomization );
    87         aStateMachine, aViewCommandHandle, aPhoneCustomization );
    89     
    88 
    90     CleanupStack::PushL( self );
    89     CleanupStack::PushL( self );
    91     self->ConstructL();
    90     self->ConstructL();
    92     CleanupStack::Pop( self );
    91     CleanupStack::Pop( self );
    93     
    92 
    94     return self;
    93     return self;
    95     }
    94     }
    96 
    95 
    97 // -----------------------------------------------------------
    96 // -----------------------------------------------------------
    98 // CPhoneCallSetupAndWaiting::HandlePhoneEngineMessageL
    97 // CPhoneCallSetupAndWaiting::HandlePhoneEngineMessageL
    99 // -----------------------------------------------------------
    98 // -----------------------------------------------------------
   100 //
    99 //
   101 void CPhoneCallSetupAndWaiting::HandlePhoneEngineMessageL( 
   100 void CPhoneCallSetupAndWaiting::HandlePhoneEngineMessageL(
   102     const TInt aMessage, 
   101     const TInt aMessage,
   103     TInt aCallId )
   102     TInt aCallId )
   104     {
   103     {
   105     __LOGMETHODSTARTEND( EPhoneUIStates, 
   104     __LOGMETHODSTARTEND( EPhoneUIStates,
   106         "CPhoneCallSetupAndWaiting::HandlePhoneEngineMessageL()");
   105         "CPhoneCallSetupAndWaiting::HandlePhoneEngineMessageL()");
   107     switch ( aMessage )
   106     switch ( aMessage )
   108         {
   107         {
   109         case MEngineMonitor::EPEMessageIdle:
   108         case MEngineMonitor::EPEMessageIdle:
   110             HandleIdleL( aCallId );
   109             HandleIdleL( aCallId );
   111             break;
   110             break;
   112 
   111 
   113         case MEngineMonitor::EPEMessageConnected:
   112         case MEngineMonitor::EPEMessageConnected:
   114             HandleConnectedL( aCallId );
   113             HandleConnectedL( aCallId );
   115             break;
   114             break;
   116             
   115 
   117         default:
   116         default:
   118             CPhoneGsmInCall::HandlePhoneEngineMessageL( aMessage, aCallId );
   117             CPhoneGsmInCall::HandlePhoneEngineMessageL( aMessage, aCallId );
   119             break;
   118             break;
   120         }
   119         }
   121     }
   120     }
   122 
   121 
   123 // -----------------------------------------------------------
   122 // -----------------------------------------------------------
   124 // CPhoneCallSetupAndWaiting::HandleErrorL
       
   125 // -----------------------------------------------------------
       
   126 //
       
   127 EXPORT_C void CPhoneCallSetupAndWaiting::HandleErrorL( 
       
   128         const TPEErrorInfo& aErrorInfo )
       
   129     {
       
   130     __LOGMETHODSTARTEND( EPhoneUIStates, "CPhoneCallSetupAndWaiting::HandleErrorL()");
       
   131     
       
   132     if( aErrorInfo.iErrorCode == ECCPErrorCCUserAlertingNoAnswer )
       
   133         {
       
   134         // Should not shown "No Answer" note
       
   135         __PHONELOG1( EBasic, EPhoneUIStates,
       
   136        "PhoneUIStates: CPhoneCallSetupAndWaiting::HandleErrorL - aErrorInfo.iErrorCode =%d ",
       
   137             aErrorInfo.iErrorCode);
       
   138         }
       
   139     else
       
   140         {
       
   141         CPhoneState::HandleErrorL( aErrorInfo );
       
   142         }
       
   143     }
       
   144 
       
   145 // -----------------------------------------------------------
       
   146 // CPhoneCallSetupAndWaiting::OpenMenuBarL
       
   147 // -----------------------------------------------------------
       
   148 //
       
   149 void CPhoneCallSetupAndWaiting::OpenMenuBarL()
       
   150     {
       
   151     __LOGMETHODSTARTEND( EPhoneUIStates, 
       
   152         "CPhoneCallSetupAndWaiting::OpenMenuBarL()");
       
   153     TInt resourceId;
       
   154 
       
   155     if ( iOnScreenDialer && IsDTMFEditorVisibleL() )
       
   156         {
       
   157         resourceId = EPhoneDtmfDialerMenubar;
       
   158         }
       
   159     else if ( IsNumberEntryVisibleL() )
       
   160         {
       
   161         resourceId = EPhoneAlertingAndWaitingCallMenuBarWithNumberEntry;
       
   162         }
       
   163     else
       
   164         {
       
   165         resourceId = EPhoneAlertingAndWaitingCallMenuBar;
       
   166         }
       
   167 
       
   168     TPhoneCmdParamInteger integerParam;
       
   169     integerParam.SetInteger( 
       
   170         CPhoneMainResourceResolver::Instance()->
       
   171         ResolveResourceID( resourceId ) );
       
   172     iViewCommandHandle->ExecuteCommandL( EPhoneViewMenuBarOpen, 
       
   173         &integerParam );
       
   174     }
       
   175 
       
   176 // -----------------------------------------------------------
       
   177 // CPhoneCallSetupAndWaiting::HandleIdleL
   123 // CPhoneCallSetupAndWaiting::HandleIdleL
   178 // -----------------------------------------------------------
   124 // -----------------------------------------------------------
   179 //
   125 //
   180 void CPhoneCallSetupAndWaiting::HandleIdleL( TInt aCallId )
   126 void CPhoneCallSetupAndWaiting::HandleIdleL( TInt aCallId )
   181     {
   127     {
   182     __LOGMETHODSTARTEND( EPhoneUIStates, 
   128     __LOGMETHODSTARTEND( EPhoneUIStates,
   183         "CPhoneCallSetupAndWaiting::HandleIdleL()");
   129         "CPhoneCallSetupAndWaiting::HandleIdleL()");
   184         
   130 
   185     BeginUiUpdateLC();
   131     BeginUiUpdateLC();
   186             
   132 
   187     // Remove call 
   133     // Remove call
   188     iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveCallHeader, aCallId );
   134     iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveCallHeader, aCallId );
   189 
       
   190     // Close menu bar, if it is displayed
       
   191     iViewCommandHandle->ExecuteCommandL( EPhoneViewMenuBarClose );
       
   192 
   135 
   193     // Find out do we have waiting or outgoing call left
   136     // Find out do we have waiting or outgoing call left
   194     TPhoneCmdParamCallStateData callStateData;
   137     TPhoneCmdParamCallStateData callStateData;
   195     callStateData.SetCallState( EPEStateRinging );
   138     callStateData.SetCallState( EPEStateRinging );
   196     iViewCommandHandle->HandleCommandL( EPhoneViewGetCallIdByState, 
   139     iViewCommandHandle->HandleCommandL( EPhoneViewGetCallIdByState,
   197         &callStateData );
   140         &callStateData );
   198         
   141 
   199     if( callStateData.CallId() > KErrNotFound )
   142     if( callStateData.CallId() > KErrNotFound )
   200         {
   143         {
   201         // Idle message came for callSetup
   144 
   202 
       
   203         if ( iOnScreenDialer && IsDTMFEditorVisibleL()  )
       
   204             {
       
   205             CloseDTMFEditorL();
       
   206             }
       
   207                 
       
   208         // Display ringing bubble
   145         // Display ringing bubble
   209         TPhoneCmdParamCallHeaderData callHeaderParam;
   146         TPhoneCmdParamCallHeaderData callHeaderParam;
   210         callHeaderParam.SetCallState( EPEStateRinging );
   147         callHeaderParam.SetCallState( EPEStateRinging );
   211          
   148 
   212         SetCallHeaderTextsForCallComingInL( callStateData.CallId(), EFalse, &callHeaderParam );
   149         SetCallHeaderTextsForCallComingInL( callStateData.CallId(), EFalse, &callHeaderParam );
   213         
   150 
   214         iViewCommandHandle->ExecuteCommandL( EPhoneViewUpdateBubble, 
   151         iViewCommandHandle->ExecuteCommandL( EPhoneViewUpdateBubble,
   215             callStateData.CallId(), 
   152             callStateData.CallId(),
   216             &callHeaderParam );
   153             &callHeaderParam );
   217         
   154 
   218         // Show incoming call buttons
   155         // Show incoming call buttons
   219         SetTouchPaneButtons( EPhoneIncomingCallButtons ); 
   156         SetTouchPaneButtons( EPhoneIncomingCallButtons );
   220         SetTouchPaneButtonEnabled( EPhoneCallComingCmdSilent );
   157 
   221         
   158         // Bring up callhandling view
   222         // Bring up callhandling view       
   159         BringIncomingToForegroundL();
   223         BringIncomingToForegroundL();   
   160 
   224         
       
   225         // state changes to Incoming
   161         // state changes to Incoming
   226         iCbaManager->UpdateIncomingCbaL( callStateData.CallId() );
   162         iCbaManager->UpdateIncomingCbaL( callStateData.CallId() );
   227         UpdateSilenceButtonDimming();
       
   228         SetRingingTonePlaybackL( callStateData.CallId() );
   163         SetRingingTonePlaybackL( callStateData.CallId() );
   229         iStateMachine->ChangeState( EPhoneStateIncoming );    
   164         SetBackButtonActive(EFalse);
   230         }    
   165         iStateMachine->ChangeState( EPhoneStateIncoming );
   231     
   166         }
       
   167 
   232     else
   168     else
   233         {
   169         {
   234         // Show call setup buttons
   170         // Show call setup buttons
   235         CPhoneState::SetTouchPaneButtons( EPhoneCallSetupButtons );
   171         CPhoneState::SetTouchPaneButtons( EPhoneCallSetupButtons );
   236         // Waiting call was terminated
   172         // Waiting call was terminated
   237         UpdateCbaL( EPhoneCallHandlingInCallCBA );
   173         UpdateCbaL( EPhoneCallHandlingInCallCBA );
   238         iStateMachine->ChangeState( EPhoneStateAlerting );            
   174         iStateMachine->ChangeState( EPhoneStateAlerting );
   239         }
   175         }
   240     
   176 
   241     EndUiUpdate();
   177     EndUiUpdate();
   242     }
   178     }
   243         
   179 
   244 // -----------------------------------------------------------
   180 // -----------------------------------------------------------
   245 // CPhoneCallSetupAndWaiting::UpdateInCallCbaL
   181 // CPhoneCallSetupAndWaiting::UpdateInCallCbaL
   246 // -----------------------------------------------------------
   182 // -----------------------------------------------------------
   247 //
   183 //
   248 void CPhoneCallSetupAndWaiting::UpdateInCallCbaL()
   184 void CPhoneCallSetupAndWaiting::UpdateInCallCbaL()
   249     {
   185     {
   250     __LOGMETHODSTARTEND( EPhoneControl, 
   186     __LOGMETHODSTARTEND( EPhoneControl,
   251         "CPhoneCallSetupAndWaiting::UpdateInCallCbaL() ");
   187         "CPhoneCallSetupAndWaiting::UpdateInCallCbaL() ");
   252         
   188 
   253     UpdateCbaL( EPhoneCallHandlingIncomingRejectCBA );
   189     UpdateCbaL( EPhoneCallHandlingIncomingRejectCBA );
   254     }
   190     }
   255 
   191 
   256 // -----------------------------------------------------------
   192 // -----------------------------------------------------------
   257 // CPhoneCallSetupAndWaiting::HandleConnectedL
   193 // CPhoneCallSetupAndWaiting::HandleConnectedL
   259 //
   195 //
   260 void CPhoneCallSetupAndWaiting::HandleConnectedL( TInt aCallId )
   196 void CPhoneCallSetupAndWaiting::HandleConnectedL( TInt aCallId )
   261     {
   197     {
   262     __LOGMETHODSTARTEND( EPhoneUIStates, "CPhoneCallSetupAndWaiting::HandleConnectedL() ");
   198     __LOGMETHODSTARTEND( EPhoneUIStates, "CPhoneCallSetupAndWaiting::HandleConnectedL() ");
   263 
   199 
   264     // Close menu bar, if it is displayed
       
   265     iViewCommandHandle->ExecuteCommandL( EPhoneViewMenuBarClose );
       
   266     
       
   267     CPhoneState::BeginUiUpdateLC();
   200     CPhoneState::BeginUiUpdateLC();
   268 
   201 
   269     // Update bubble
   202     // Update bubble
   270     TPhoneCmdParamCallHeaderData callHeaderParam;
   203     TPhoneCmdParamCallHeaderData callHeaderParam;
   271     callHeaderParam.SetCallState( EPEStateConnected );
   204     callHeaderParam.SetCallState( EPEStateConnected );
   272     iViewCommandHandle->ExecuteCommandL( EPhoneViewUpdateBubble, aCallId, 
   205     iViewCommandHandle->ExecuteCommandL( EPhoneViewUpdateBubble, aCallId,
   273         &callHeaderParam );
   206         &callHeaderParam );
   274       
   207 
   275     // Update Touch buttons    
   208     // Update Touch buttons
   276     CPhoneState::SetTouchPaneButtons( EPhoneWaitingCallButtons );
   209     CPhoneState::SetTouchPaneButtons( EPhoneWaitingCallButtons );
   277     SetToolbarDimming( EFalse );
   210 
   278     
   211     CPhoneState::EndUiUpdate();
   279     EndUiUpdate();
   212 
   280  
       
   281     if ( CPhoneState::IsNumberEntryUsedL() )
   213     if ( CPhoneState::IsNumberEntryUsedL() )
   282         {
   214         {
   283         // Show number entry
   215         // Show number entry
   284         TPhoneCmdParamBoolean booleanParam;
   216         TPhoneCmdParamBoolean booleanParam;
   285         booleanParam.SetBoolean( ETrue );
   217         booleanParam.SetBoolean( ETrue );
   286         iViewCommandHandle->ExecuteCommandL( EPhoneViewSetNumberEntryVisible, &booleanParam );
   218         iViewCommandHandle->ExecuteCommandL( EPhoneViewSetNumberEntryVisible, &booleanParam );
   287         }
   219         }
   288  
   220 
   289     // Go to Single And Waiting state 
   221     // Go to Single And Waiting state
   290     UpdateCbaL( EPhoneCallHandlingCallWaitingCBA );   
   222     UpdateCbaL( EPhoneCallHandlingCallWaitingCBA );
   291     iStateMachine->ChangeState( EPhoneStateWaitingInSingle );        
   223     iStateMachine->ChangeState( EPhoneStateWaitingInSingle );
   292     }
   224     }
   293     
   225 
   294 // End of File
   226 // End of File