phoneapp/phoneuistates/src/cphoneidle.cpp
changeset 37 ba76fc04e6c2
child 45 6b911d05207e
equal deleted inserted replaced
36:2eacb6118286 37:ba76fc04e6c2
       
     1 /*
       
     2 * Copyright (c) 2006 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 CPhoneIdle class.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDES
       
    20 #include "cphoneidle.h"
       
    21 #include "phonerssbase.h"
       
    22 #include "phonelogger.h"
       
    23 #include "cphonegeneralgsmmessageshandler.h"
       
    24 #include "tphonecmdparamboolean.h"
       
    25 
       
    26 // ================= MEMBER FUNCTIONS =======================
       
    27 
       
    28 // C++ default constructor can NOT contain any code, that
       
    29 // might leave.
       
    30 //
       
    31 EXPORT_C CPhoneIdle::CPhoneIdle( 
       
    32     MPhoneStateMachine* aStateMachine, 
       
    33     MPhoneViewCommandHandle* aViewCommandHandle,
       
    34     MPhoneCustomization* aPhoneCustomization ) : 
       
    35     CPhoneStateIdle( aStateMachine, aViewCommandHandle, aPhoneCustomization )
       
    36     {
       
    37     }
       
    38 
       
    39 // -----------------------------------------------------------
       
    40 // CPhoneIdle::~CPhoneIdle()
       
    41 // Destructor
       
    42 // (other items were commented in a header).
       
    43 // -----------------------------------------------------------
       
    44 
       
    45 EXPORT_C CPhoneIdle::~CPhoneIdle()
       
    46     {
       
    47     }
       
    48 
       
    49 // -----------------------------------------------------------
       
    50 // CPhoneIdle::ConstructL()
       
    51 // Constructor
       
    52 // (other items were commented in a header).
       
    53 // -----------------------------------------------------------
       
    54 //
       
    55 EXPORT_C void CPhoneIdle::ConstructL()
       
    56     {
       
    57     __LOGMETHODSTARTEND( EPhoneUIStates, "CPhoneIdle::ConstructL()");
       
    58     CPhoneStateIdle::ConstructL();
       
    59     }
       
    60 
       
    61 // -----------------------------------------------------------
       
    62 // CPhoneIdle::NewL()
       
    63 // Constructor
       
    64 // (other items were commented in a header).
       
    65 // -----------------------------------------------------------
       
    66 //
       
    67 CPhoneIdle* CPhoneIdle::NewL( 
       
    68     MPhoneStateMachine* aStateMachine, 
       
    69     MPhoneViewCommandHandle* aViewCommandHandle,
       
    70     MPhoneCustomization* aPhoneCustomization )
       
    71     {
       
    72     CPhoneIdle* self = new (ELeave) 
       
    73         CPhoneIdle( aStateMachine, aViewCommandHandle, aPhoneCustomization );
       
    74     
       
    75     CleanupStack::PushL( self );
       
    76     self->ConstructL();
       
    77     CleanupStack::Pop( self );
       
    78     
       
    79     return self;
       
    80     }
       
    81 
       
    82 // -----------------------------------------------------------
       
    83 // CPhoneIdle::HandlePhoneEngineMessageL
       
    84 // -----------------------------------------------------------
       
    85 //
       
    86 EXPORT_C void CPhoneIdle::HandlePhoneEngineMessageL( 
       
    87     const TInt aMessage, 
       
    88     TInt aCallId )
       
    89     {
       
    90     __LOGMETHODSTARTEND(EPhoneUIStates, 
       
    91         "CPhoneIdle::HandlePhoneEngineMessageL() ");
       
    92     switch ( aMessage )
       
    93         {
       
    94         case MEngineMonitor::EPEMessageRemoteHeld:
       
    95             CPhoneState::SendGlobalInfoNoteL( 
       
    96                 EPhoneInformationRemotePutOnHoldNote );
       
    97             break;
       
    98         
       
    99         case MEngineMonitor::EPEMessageRemoteResumed:
       
   100             CPhoneState::SendGlobalInfoNoteL( 
       
   101                 EPhoneInformationConnectedNote );
       
   102             break;
       
   103             
       
   104         case MEngineMonitor::EPEMessageAudioOutputChanged:
       
   105             HandleAudioOutputChangedL();
       
   106             break;
       
   107 
       
   108         case MEngineMonitor::EPEMessageIssuedSSRequest: // fall through 
       
   109             // Note that after the sending of SS 
       
   110             // strings the view stays in Dialer.
       
   111             if ( !iOnScreenDialer )  
       
   112                 {
       
   113                 SetupIdleScreenInBackgroundL();
       
   114                 }
       
   115         case MEngineMonitor::EPEMessageIssuingSSRequest: // fall through
       
   116         case MEngineMonitor::EPEMessageCallBarred: // fall through
       
   117         case MEngineMonitor::EPEMessageShowVersion: // fall through
       
   118         case MEngineMonitor::EPEMessageTempClirActivationUnsuccessful:
       
   119         case MEngineMonitor::EPEMessageIncCallIsForw: // fall through
       
   120         case MEngineMonitor::EPEMessageIncCallForwToC: // fall through
       
   121         case MEngineMonitor::EPEMessageOutCallForwToC: // fall through
       
   122         case MEngineMonitor::EPEMessageForwardUnconditionalModeActive: // fall through
       
   123         case MEngineMonitor::EPEMessageForwardConditionallyModeActive:
       
   124             {
       
   125             CPhoneGeneralGsmMessagesHandler* gsmMsgHandler =
       
   126                 CPhoneGeneralGsmMessagesHandler::NewL( *iStateMachine,
       
   127                                                        *iViewCommandHandle,
       
   128                                                        *this );
       
   129             CleanupStack::PushL( gsmMsgHandler );
       
   130             gsmMsgHandler->HandlePhoneEngineMessageL( aMessage, aCallId );
       
   131             CleanupStack::PopAndDestroy( gsmMsgHandler );
       
   132             }
       
   133             break;
       
   134 
       
   135         default:
       
   136             CPhoneStateIdle::HandlePhoneEngineMessageL( 
       
   137                 aMessage, aCallId );
       
   138             break;
       
   139         }
       
   140 
       
   141 #ifndef __SYNCML_DM
       
   142       switch ( aMessage )
       
   143         {
       
   144         case MEngineMonitor::EPEMessageShowVersion:
       
   145             if ( !iOnScreenDialer )
       
   146                 {
       
   147                 HandleNumberEntryClearedL();
       
   148                 }
       
   149             break;
       
   150         default:    
       
   151             break;
       
   152         }
       
   153 #endif        
       
   154     }
       
   155 
       
   156 // -----------------------------------------------------------
       
   157 // CPhoneIdle::HandleErrorL
       
   158 // -----------------------------------------------------------
       
   159 //
       
   160 EXPORT_C void CPhoneIdle::HandleErrorL( const TPEErrorInfo& aErrorInfo )
       
   161     {
       
   162     __LOGMETHODSTARTEND( EPhoneUIStates, "CPhoneIdle::HandleErrorL() ");
       
   163     
       
   164     TPhoneCmdParamBoolean blockingDialogStatus;
       
   165     iViewCommandHandle->ExecuteCommandL( EPhoneViewGetBlockingDialogStatus, 
       
   166         &blockingDialogStatus );
       
   167 
       
   168     if( blockingDialogStatus.Boolean() )
       
   169         {
       
   170         blockingDialogStatus.SetBoolean( EFalse );
       
   171         iViewCommandHandle->ExecuteCommandL( EPhoneViewSetBlockingDialogStatus, 
       
   172             &blockingDialogStatus );
       
   173         }
       
   174     
       
   175     CPhoneState::HandleErrorL( aErrorInfo );
       
   176     }
       
   177 
       
   178 // End of File