phoneapp/phoneuistates/src/cphonecallsetup.cpp
changeset 36 2eacb6118286
parent 30 ebdbd102c78a
child 37 ba76fc04e6c2
equal deleted inserted replaced
30:ebdbd102c78a 36:2eacb6118286
     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 "cphonecallsetup.h"
       
    22 #include "mphonestatemachine.h"
       
    23 #include "tphonecmdparamboolean.h"
       
    24 #include "tphonecmdparamcallheaderdata.h"
       
    25 #include "phonestatedefinitionsgsm.h"
       
    26 #include "cphonetimer.h"
       
    27 #include "phonerssbase.h"
       
    28 #include "cphonemainresourceresolver.h"
       
    29 #include "phonelogger.h"
       
    30 #include "cphonegeneralgsmmessageshandler.h"
       
    31 #include "cphonemediatorfactory.h"
       
    32 #include "cphonemediatorsender.h"
       
    33 
       
    34 // ================= MEMBER FUNCTIONS =======================
       
    35 
       
    36 // C++ default constructor can NOT contain any code, that
       
    37 // might leave.
       
    38 //
       
    39 EXPORT_C CPhoneCallSetup::CPhoneCallSetup( 
       
    40     MPhoneStateMachine* aStateMachine, 
       
    41     MPhoneViewCommandHandle* aViewCommandHandle,
       
    42     MPhoneCustomization* aPhoneCustomization ) : 
       
    43     CPhoneStateCallSetup( aStateMachine, aViewCommandHandle, aPhoneCustomization )
       
    44     {
       
    45     }
       
    46 
       
    47 // -----------------------------------------------------------
       
    48 // CPhoneCallSetup::~CPhoneCallSetup()
       
    49 // Destructor
       
    50 // (other items were commented in a header).
       
    51 // -----------------------------------------------------------
       
    52 //
       
    53 EXPORT_C CPhoneCallSetup::~CPhoneCallSetup()
       
    54     {
       
    55     }
       
    56 
       
    57 // -----------------------------------------------------------
       
    58 // CPhoneCallSetup::ConstructL()
       
    59 // Constructor
       
    60 // (other items were commented in a header).
       
    61 // -----------------------------------------------------------
       
    62 //
       
    63 EXPORT_C void CPhoneCallSetup::ConstructL()
       
    64     {
       
    65     CPhoneStateCallSetup::ConstructL();
       
    66     }
       
    67 
       
    68 // -----------------------------------------------------------
       
    69 // CPhoneCallSetup::NewL()
       
    70 // Constructor
       
    71 // (other items were commented in a header).
       
    72 // -----------------------------------------------------------
       
    73 //
       
    74 CPhoneCallSetup* CPhoneCallSetup::NewL( 
       
    75     MPhoneStateMachine* aStateMachine, 
       
    76     MPhoneViewCommandHandle* aViewCommandHandle,
       
    77     MPhoneCustomization* aPhoneCustomization )
       
    78     {
       
    79     CPhoneCallSetup* self = new (ELeave) CPhoneCallSetup( 
       
    80         aStateMachine, aViewCommandHandle, aPhoneCustomization );
       
    81     
       
    82     CleanupStack::PushL( self );
       
    83     self->ConstructL();
       
    84     CleanupStack::Pop( self );
       
    85     
       
    86     return self;
       
    87     }
       
    88 
       
    89 // -----------------------------------------------------------
       
    90 // CPhoneCallSetup::HandlePhoneEngineMessageL
       
    91 // -----------------------------------------------------------
       
    92 //
       
    93 EXPORT_C void CPhoneCallSetup::HandlePhoneEngineMessageL( 
       
    94     const TInt aMessage, 
       
    95     TInt aCallId )
       
    96     {
       
    97     __LOGMETHODSTARTEND( EPhoneUIStates, 
       
    98         "CPhoneCallSetup::HandlePhoneEngineMessageL()");
       
    99     switch ( aMessage )
       
   100         {
       
   101         case MEngineMonitor::EPEMessageConnecting:
       
   102             HandleConnectingL( aCallId );
       
   103             break;
       
   104 
       
   105         // fall through.    
       
   106         case MEngineMonitor::EPEMessageIssuingSSRequest:
       
   107         case MEngineMonitor::EPEMessageCallBarred:
       
   108         case MEngineMonitor::EPEMessageShowVersion:
       
   109         case MEngineMonitor::EPEMessageIssuedSSRequest:
       
   110         case MEngineMonitor::EPEMessageTempClirActivationUnsuccessful:
       
   111         case MEngineMonitor::EPEMessageIncCallIsForw:
       
   112         case MEngineMonitor::EPEMessageIncCallForwToC:
       
   113         case MEngineMonitor::EPEMessageOutCallForwToC:
       
   114         case MEngineMonitor::EPEMessageForwardUnconditionalModeActive: 
       
   115         case MEngineMonitor::EPEMessageForwardConditionallyModeActive:
       
   116             {
       
   117             __PHONELOG1( 
       
   118                 EBasic, 
       
   119                 EPhoneUIStates, 
       
   120                 "CPhoneCallSetup::HandlePhoneEngineMessageL Start create gsm message handler %d",
       
   121                 aMessage ); 
       
   122             
       
   123             CPhoneGeneralGsmMessagesHandler* gsmMsgHandler =
       
   124                 CPhoneGeneralGsmMessagesHandler::NewL( *iStateMachine,
       
   125                                                        *iViewCommandHandle,
       
   126                                                        *this );
       
   127 
       
   128             CleanupStack::PushL( gsmMsgHandler );
       
   129             gsmMsgHandler->HandlePhoneEngineMessageL( aMessage, aCallId );
       
   130             CleanupStack::PopAndDestroy( gsmMsgHandler );       
       
   131             }
       
   132             break;
       
   133             
       
   134         default:
       
   135             CPhoneStateCallSetup::HandlePhoneEngineMessageL( aMessage, 
       
   136                 aCallId );
       
   137             break;
       
   138         }
       
   139     }
       
   140 
       
   141 // -----------------------------------------------------------------------------
       
   142 // CPhoneCallSetup::HandleConnectingL
       
   143 // -----------------------------------------------------------------------------
       
   144 //
       
   145 EXPORT_C void CPhoneCallSetup::HandleConnectingL( TInt aCallId )
       
   146     {
       
   147     // Only handle connecting case for GSM protocol. In CDMA, this message is 
       
   148     // set when the CDMA network receives the call, not (like in GSM) when
       
   149     // when the remote party receives the call. So, in CDMA, the user
       
   150     // should still be able to cancel the MO call before the call is connected.
       
   151     __LOGMETHODSTARTEND( EPhoneUIStates, 
       
   152         "CPhoneCallSetup::HandleConnectingL()");
       
   153     
       
   154     BeginUiUpdateLC();
       
   155     UpdateRemoteInfoDataL ( aCallId );
       
   156     
       
   157     // Re-enable global notes
       
   158     TPhoneCmdParamBoolean globalNotifierParam;
       
   159     globalNotifierParam.SetBoolean( EFalse );
       
   160     iViewCommandHandle->ExecuteCommandL( EPhoneViewSetGlobalNotifiersDisabled,
       
   161         &globalNotifierParam );
       
   162 
       
   163     // Home screen to foreground after call
       
   164     TPhoneCmdParamBoolean booleanParam;
       
   165     booleanParam.SetBoolean( ETrue );
       
   166     iViewCommandHandle->ExecuteCommand( EPhoneViewHsToForegroundAfterCall,
       
   167         &booleanParam );
       
   168     
       
   169     // Stop capturing keys
       
   170     CaptureKeysDuringCallNotificationL( EFalse );
       
   171     
       
   172     TPhoneCmdParamCallHeaderData callHeaderParam;
       
   173     callHeaderParam.SetCallState( EPEStateConnecting );
       
   174     iViewCommandHandle->ExecuteCommandL( EPhoneViewUpdateBubble, aCallId, 
       
   175         &callHeaderParam );
       
   176 
       
   177     // Remove the number entry if it isn't DTMF dialer
       
   178     /*if ( !iOnScreenDialer ||
       
   179          !IsNumberEntryVisibleL() ||
       
   180          !IsDTMFEditorVisibleL() )
       
   181         {
       
   182         iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveNumberEntry );
       
   183         }*/
       
   184 
       
   185     SetToolbarButtonLoudspeakerEnabled();
       
   186 
       
   187     EndUiUpdate();
       
   188     
       
   189     // Go to alerting state
       
   190     UpdateCbaL( EPhoneCallHandlingInCallCBA );
       
   191 
       
   192     iStateMachine->ChangeState( EPhoneStateAlerting );
       
   193     }
       
   194 
       
   195 // End of File