phoneapp/phoneuistates/src/cphonestartupsimlockui.cpp
branchRCL_3
changeset 14 24062c24fe38
child 17 38529f706030
equal deleted inserted replaced
9:8871b09be73b 14:24062c24fe38
       
     1 /*
       
     2  * Copyright (c) 2010 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 CPhoneStartup class.
       
    15  *
       
    16  */
       
    17 
       
    18 // INCLUDES
       
    19 #include "phonerssbase.h"
       
    20 #include "phonelogger.h"
       
    21 #include "cphonestartupsimlockui.h"
       
    22 #include "tphonecmdparamappinfo.h"
       
    23 #include "TPhoneCmdParamBoolean.h"
       
    24 #include "phoneconstants.h"
       
    25 #include "cphonestatestartup.h"
       
    26 #include "phonestatedefinitions.h"
       
    27 #include "mphonestatemachine.h"
       
    28 #include "tphonecmdparamkeycapture.h"
       
    29 #include "tphonecmdparamboolean.h"
       
    30 #include "cphonepubsubproxy.h"
       
    31 #include "phoneconstants.h"
       
    32 #include <startupdomainpskeys.h>
       
    33 #include <oem/simlockuikeys.h>
       
    34 
       
    35 
       
    36 // ================= MEMBER FUNCTIONS =======================
       
    37 
       
    38 // C++ default constructor can NOT contain any code, that
       
    39 // might leave.
       
    40 //
       
    41 
       
    42 CPhoneStartupSimlockUi::CPhoneStartupSimlockUi(
       
    43         MPhoneStateMachine* aStateMachine,
       
    44         MPhoneViewCommandHandle* aViewCommandHandle, TBool aPEReady ) :
       
    45 CPhoneStateStartup( aStateMachine, aViewCommandHandle, NULL ), iSimLockActive (EFalse)
       
    46     {
       
    47     iPEReady = aPEReady;
       
    48     }
       
    49 
       
    50 // -----------------------------------------------------------
       
    51 // CPhoneStartupSimlockUi::~CPhoneStartupSimlockUi()
       
    52 // Destructor
       
    53 // (other items were commented in a header).
       
    54 // -----------------------------------------------------------
       
    55 
       
    56 CPhoneStartupSimlockUi::~CPhoneStartupSimlockUi()
       
    57     {
       
    58     }
       
    59 
       
    60 // -----------------------------------------------------------
       
    61 // CPhoneStartupSimlockUi::ConstructL()
       
    62 // Constructor
       
    63 // (other items were commented in a header).
       
    64 // -----------------------------------------------------------
       
    65 //
       
    66 void CPhoneStartupSimlockUi::ConstructL()
       
    67     {
       
    68     __LOGMETHODSTARTEND( EPhoneUIStates, "CPhoneStartupSimlockUi::ConstructL()" );
       
    69 
       
    70     CPhoneStateStartup::ConstructL();
       
    71     iSimLockActive = ETrue;
       
    72     EnterSimLockModeL();
       
    73 
       
    74     }
       
    75 
       
    76 // -----------------------------------------------------------
       
    77 // CPhoneStartupSimlockUi::NewL()
       
    78 // Constructor
       
    79 // (other items were commented in a header).
       
    80 // -----------------------------------------------------------
       
    81 //
       
    82 CPhoneStartupSimlockUi* CPhoneStartupSimlockUi::NewL(
       
    83         MPhoneStateMachine* aStateMachine,
       
    84         MPhoneViewCommandHandle* aViewCommandHandle, TBool aPEReady )
       
    85 
       
    86     {
       
    87     __LOGMETHODSTARTEND( EPhoneUIStates, "CPhoneStartupSimlockUi::NewL()");
       
    88     
       
    89     CPhoneStartupSimlockUi* self = new (ELeave) CPhoneStartupSimlockUi(
       
    90             aStateMachine, aViewCommandHandle, aPEReady );
       
    91 
       
    92     CleanupStack::PushL( self );
       
    93     self->ConstructL();
       
    94     CleanupStack::Pop( self );
       
    95 
       
    96     return self;
       
    97 
       
    98     }
       
    99 
       
   100 // -----------------------------------------------------------
       
   101 // CPhoneStateStartup::HandlePhoneEngineMessageL
       
   102 // -----------------------------------------------------------
       
   103 //
       
   104 EXPORT_C void CPhoneStartupSimlockUi::HandlePhoneEngineMessageL( 
       
   105     const TInt aMessage, 
       
   106     TInt aCallId )
       
   107     {
       
   108     __LOGMETHODSTARTEND( EPhoneControl, "CPhoneStartupSimlockUi::HandlePhoneEngineMessageL() " );
       
   109     switch ( aMessage )
       
   110         {
       
   111         case MEngineMonitor::EPEMessagePEConstructionReady:
       
   112 
       
   113             // phone start is now possible
       
   114             if ( !iSimLockActive )
       
   115                 {
       
   116                 CPhoneStateStartup::HandlePhoneEngineMessageL( aMessage, aCallId );
       
   117                 }
       
   118             else
       
   119                 {
       
   120                 iPEReady = ETrue;
       
   121                 }
       
   122             break;
       
   123             
       
   124         default:
       
   125         	CPhoneStateStartup::HandlePhoneEngineMessageL( aMessage, aCallId );
       
   126             break;
       
   127         }
       
   128     }
       
   129 
       
   130 // -----------------------------------------------------------
       
   131 // CPhoneStartupSimlockUi::HandlePhoneStartupL
       
   132 // -----------------------------------------------------------
       
   133 //
       
   134 EXPORT_C void CPhoneStartupSimlockUi::HandlePhoneStartupL()
       
   135     {
       
   136     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneStartupSimlockUi::HandlePhoneStartupL() ");
       
   137 
       
   138     if( !iSimLockActive )
       
   139         {
       
   140         CPhoneStateStartup::HandlePhoneStartupL();
       
   141         }
       
   142     else
       
   143         {
       
   144         // set the flag in base class
       
   145         iPhoneReady = ETrue;
       
   146         }        
       
   147     }
       
   148 
       
   149 // -----------------------------------------------------------
       
   150 // CPhoneStartupSimlockUi::HandlePropertyChangedL
       
   151 // -----------------------------------------------------------
       
   152 //
       
   153 EXPORT_C void CPhoneStartupSimlockUi::HandlePropertyChangedL(
       
   154         const TUid& aCategory, const TUint aKey, const TInt aValue )
       
   155     {
       
   156     __LOGMETHODSTARTEND( EPhoneUIStates,"CPhoneStartupSimlockUi::HandlePropertyChangedL( ) " );
       
   157 
       
   158     if ( aCategory == KSimLockProperty )
       
   159         {
       
   160         if ( aKey == ESimLockActiveStatus )
       
   161             {
       
   162             if ( aValue == KSimLockStatusDone )
       
   163                 {
       
   164                 // No longer in Sim Lock mode
       
   165                 ExitSimLockModeL();
       
   166                 }
       
   167             }
       
   168         }
       
   169     else
       
   170         {
       
   171         CPhoneState::HandlePropertyChangedL( aCategory, aKey, aValue );
       
   172         }
       
   173     }
       
   174 
       
   175 // -----------------------------------------------------------------------------
       
   176 // CPhoneStartupSimlockUi::EnterSimLockModeL
       
   177 // -----------------------------------------------------------------------------
       
   178 //
       
   179 void CPhoneStartupSimlockUi::EnterSimLockModeL()
       
   180     {
       
   181     __LOGMETHODSTARTEND( EPhoneUIStates,"CPhoneStartupSimlockUi::EnterSimLockModeL( ) " );
       
   182 
       
   183     TPhoneCmdParamAppInfo appInfoParam;
       
   184     appInfoParam.SetAppUid( KSimLockUIApplicationUid );
       
   185     iViewCommandHandle->ExecuteCommandL( EPhoneViewActivateApp, &appInfoParam );
       
   186 
       
   187     }
       
   188 // -----------------------------------------------------------------------------
       
   189 // CPhoneStartupSimlockUi::ExitSimLockModeL
       
   190 // -----------------------------------------------------------------------------
       
   191 //
       
   192 void CPhoneStartupSimlockUi::ExitSimLockModeL()
       
   193     {
       
   194     __LOGMETHODSTARTEND( EPhoneUIStates,"CPhoneStartupSimlockUi::ExitSimLockModeL( ) " );
       
   195     iSimLockActive = EFalse;
       
   196 	
       
   197 	if ( iPhoneReady )
       
   198 		{
       
   199 		CPhoneStateStartup::HandlePhoneStartupL();
       
   200     	}
       
   201 	else if ( iPEReady )
       
   202 		{
       
   203 		CPhoneStateStartup::HandlePEConstructionReadyL( 0 );
       
   204 		}
       
   205 
       
   206 	//if iPhoneReady or iPEReady is EFalse, we should just wait.
       
   207     }
       
   208 
       
   209 // End of File