phoneapp/phoneuistates/src/cphonecallsetup.cpp
changeset 0 5f000ab63145
child 19 544e34b3255a
child 21 92ab7f8d0eab
equal deleted inserted replaced
-1:000000000000 0:5f000ab63145
       
     1 /*
       
     2 * Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: Implementation of CPhoneCallSetup class.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDES
       
    20 #include <MediatorDomainUIDs.h>
       
    21 #include <videotelcontrolmediatorapi.h>
       
    22 #include "cphonecallsetup.h"
       
    23 #include "mphonestatemachine.h"
       
    24 #include "tphonecmdparamboolean.h"
       
    25 #include "tphonecmdparamcallheaderdata.h"
       
    26 #include "phonestatedefinitionsgsm.h"
       
    27 #include "cphonetimer.h"
       
    28 #include "phonerssbase.h"
       
    29 #include "cphonemainresourceresolver.h"
       
    30 #include "phonelogger.h"
       
    31 #include "cphonegeneralgsmmessageshandler.h"
       
    32 #include "cphonemediatorfactory.h"
       
    33 #include "cphonemediatorsender.h"
       
    34 
       
    35 // ================= MEMBER FUNCTIONS =======================
       
    36 
       
    37 // C++ default constructor can NOT contain any code, that
       
    38 // might leave.
       
    39 //
       
    40 EXPORT_C CPhoneCallSetup::CPhoneCallSetup( 
       
    41     MPhoneStateMachine* aStateMachine, 
       
    42     MPhoneViewCommandHandle* aViewCommandHandle,
       
    43     MPhoneCustomization* aPhoneCustomization ) : 
       
    44     CPhoneStateCallSetup( aStateMachine, aViewCommandHandle, aPhoneCustomization )
       
    45     {
       
    46     }
       
    47 
       
    48 // -----------------------------------------------------------
       
    49 // CPhoneCallSetup::~CPhoneCallSetup()
       
    50 // Destructor
       
    51 // (other items were commented in a header).
       
    52 // -----------------------------------------------------------
       
    53 //
       
    54 EXPORT_C CPhoneCallSetup::~CPhoneCallSetup()
       
    55     {
       
    56     }
       
    57 
       
    58 // -----------------------------------------------------------
       
    59 // CPhoneCallSetup::ConstructL()
       
    60 // Constructor
       
    61 // (other items were commented in a header).
       
    62 // -----------------------------------------------------------
       
    63 //
       
    64 EXPORT_C void CPhoneCallSetup::ConstructL()
       
    65     {
       
    66     CPhoneStateCallSetup::ConstructL();
       
    67     }
       
    68 
       
    69 // -----------------------------------------------------------
       
    70 // CPhoneCallSetup::NewL()
       
    71 // Constructor
       
    72 // (other items were commented in a header).
       
    73 // -----------------------------------------------------------
       
    74 //
       
    75 CPhoneCallSetup* CPhoneCallSetup::NewL( 
       
    76     MPhoneStateMachine* aStateMachine, 
       
    77     MPhoneViewCommandHandle* aViewCommandHandle,
       
    78     MPhoneCustomization* aPhoneCustomization )
       
    79     {
       
    80     CPhoneCallSetup* self = new (ELeave) CPhoneCallSetup( 
       
    81         aStateMachine, aViewCommandHandle, aPhoneCustomization );
       
    82     
       
    83     CleanupStack::PushL( self );
       
    84     self->ConstructL();
       
    85     CleanupStack::Pop( self );
       
    86     
       
    87     return self;
       
    88     }
       
    89 
       
    90 // -----------------------------------------------------------
       
    91 // CPhoneCallSetup::HandlePhoneEngineMessageL
       
    92 // -----------------------------------------------------------
       
    93 //
       
    94 EXPORT_C void CPhoneCallSetup::HandlePhoneEngineMessageL( 
       
    95     const TInt aMessage, 
       
    96     TInt aCallId )
       
    97     {
       
    98     __LOGMETHODSTARTEND( EPhoneUIStates, 
       
    99         "CPhoneCallSetup::HandlePhoneEngineMessageL()");
       
   100     switch ( aMessage )
       
   101         {
       
   102         case MEngineMonitor::EPEMessageConnecting:
       
   103             HandleConnectingL( aCallId );
       
   104             break;
       
   105 
       
   106         // fall through.    
       
   107         case MEngineMonitor::EPEMessageIssuingSSRequest:
       
   108         case MEngineMonitor::EPEMessageCallBarred:
       
   109         case MEngineMonitor::EPEMessageShowVersion:
       
   110         case MEngineMonitor::EPEMessageIssuedSSRequest:
       
   111         case MEngineMonitor::EPEMessageTempClirActivationUnsuccessful:
       
   112         case MEngineMonitor::EPEMessageIncCallIsForw:
       
   113         case MEngineMonitor::EPEMessageIncCallForwToC:
       
   114         case MEngineMonitor::EPEMessageOutCallForwToC:
       
   115         case MEngineMonitor::EPEMessageForwardUnconditionalModeActive: 
       
   116         case MEngineMonitor::EPEMessageForwardConditionallyModeActive:
       
   117             {
       
   118             __PHONELOG1( 
       
   119                 EBasic, 
       
   120                 EPhoneUIStates, 
       
   121                 "CPhoneCallSetup::HandlePhoneEngineMessageL Start create gsm message handler %d",
       
   122                 aMessage ); 
       
   123             
       
   124             CPhoneGeneralGsmMessagesHandler* gsmMsgHandler =
       
   125                 CPhoneGeneralGsmMessagesHandler::NewL( *iStateMachine,
       
   126                                                        *iViewCommandHandle,
       
   127                                                        *this );
       
   128 
       
   129             CleanupStack::PushL( gsmMsgHandler );
       
   130             gsmMsgHandler->HandlePhoneEngineMessageL( aMessage, aCallId );
       
   131             CleanupStack::PopAndDestroy( gsmMsgHandler );       
       
   132             }
       
   133             break;
       
   134             
       
   135         default:
       
   136             CPhoneStateCallSetup::HandlePhoneEngineMessageL( aMessage, 
       
   137                 aCallId );
       
   138             break;
       
   139         }
       
   140     }
       
   141 
       
   142 // -----------------------------------------------------------------------------
       
   143 // CPhoneCallSetup::HandleConnectingL
       
   144 // -----------------------------------------------------------------------------
       
   145 //
       
   146 EXPORT_C void CPhoneCallSetup::HandleConnectingL( TInt aCallId )
       
   147     {
       
   148     // Only handle connecting case for GSM protocol. In CDMA, this message is 
       
   149     // set when the CDMA network receives the call, not (like in GSM) when
       
   150     // when the remote party receives the call. So, in CDMA, the user
       
   151     // should still be able to cancel the MO call before the call is connected.
       
   152     __LOGMETHODSTARTEND( EPhoneUIStates, 
       
   153         "CPhoneCallSetup::HandleConnectingL()");
       
   154     
       
   155     BeginUiUpdateLC();
       
   156     UpdateRemoteInfoDataL ( aCallId );
       
   157     
       
   158     // Re-enable global notes
       
   159     TPhoneCmdParamBoolean globalNotifierParam;
       
   160     globalNotifierParam.SetBoolean( EFalse );
       
   161     iViewCommandHandle->ExecuteCommandL( EPhoneViewSetGlobalNotifiersDisabled,
       
   162         &globalNotifierParam );
       
   163 
       
   164     // Stop capturing keys
       
   165     CaptureKeysDuringCallNotificationL( EFalse );
       
   166     
       
   167     TPhoneCmdParamCallHeaderData callHeaderParam;
       
   168     callHeaderParam.SetCallState( EPEStateConnecting );
       
   169     iViewCommandHandle->ExecuteCommandL( EPhoneViewUpdateBubble, aCallId, 
       
   170         &callHeaderParam );
       
   171 
       
   172     // Remove the number entry if it isn't DTMF dialer
       
   173     if ( !iOnScreenDialer ||
       
   174          !IsNumberEntryVisibleL() ||
       
   175          !IsDTMFEditorVisibleL() )
       
   176         {
       
   177         iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveNumberEntry );
       
   178         }
       
   179 
       
   180     SetToolbarButtonLoudspeakerEnabled();
       
   181 
       
   182     EndUiUpdate();
       
   183     
       
   184     // Go to alerting state
       
   185     UpdateCbaL( EPhoneCallHandlingInCallCBA );
       
   186 
       
   187     iStateMachine->ChangeState( EPhoneStateAlerting );
       
   188     }
       
   189 
       
   190 // End of File