phoneapp/phoneuicontrol/src/cphonestatestartup.cpp
branchRCL_3
changeset 62 5266b1f337bd
parent 61 41a7f70b3818
equal deleted inserted replaced
61:41a7f70b3818 62:5266b1f337bd
     1 /*
     1 /*
     2 * Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies). 
     2 * Copyright (c) 2005-2010 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 "cphonestatestartup.h"
    20 #include "cphonestatestartup.h"
    21 #include "phonestatedefinitions.h"
    21 #include "phonestatedefinitions.h"
    22 #include "mphonestatemachine.h"
    22 #include "mphonestatemachine.h"
    23 #include "tphonecmdparamkeycapture.h"
    23 #include "tphonecmdparamKeycapture.h"
    24 #include "tphonecmdparamboolean.h"
    24 #include "tphonecmdparamboolean.h"
    25 #include "phonelogger.h"
    25 #include "phonelogger.h"
    26 #include "phonerssbase.h"
    26 #include "phonerssbase.h"
       
    27 #include "mphonesecuritymodeobserver.h"
    27 
    28 
    28 // ================= MEMBER FUNCTIONS =======================
    29 // ================= MEMBER FUNCTIONS =======================
    29 
    30 
    30 // C++ default constructor can NOT contain any code, that
    31 // C++ default constructor can NOT contain any code, that
    31 // might leave.
    32 // might leave.
    60 //
    61 //
    61 EXPORT_C void CPhoneStateStartup::ConstructL()
    62 EXPORT_C void CPhoneStateStartup::ConstructL()
    62     {
    63     {
    63     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateStartup::ConstructL() ");
    64     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateStartup::ConstructL() ");
    64     CPhoneState::BaseConstructL();
    65     CPhoneState::BaseConstructL();
       
    66     
       
    67     // Set send key activation off.
       
    68     TPhoneCmdParamBoolean boolean;
       
    69     boolean.SetBoolean( EFalse );
       
    70     iViewCommandHandle->ExecuteCommandL( EPhoneViewSetSendKeyDialerActivationFlag, 
       
    71             &boolean );
    65 
    72 
    66     // CAPTURE KEY EVENTS PERMANENTLY
    73     // CAPTURE KEY EVENTS PERMANENTLY
    67         
    74         
    68     // Capture the up and down events for the No key
    75     // Capture the up and down events for the No key
    69     /*TPhoneCmdParamKeyCapture noKeyCaptureParam;
    76     TPhoneCmdParamKeyCapture noKeyCaptureParam;
    70     noKeyCaptureParam.SetKey( EStdKeyNo );
    77     noKeyCaptureParam.SetKey( EStdKeyNo );
    71     noKeyCaptureParam.SetKeyCode( EKeyNo );
    78     noKeyCaptureParam.SetKeyCode( EKeyNo );
    72     noKeyCaptureParam.SetCaptureType( EPhoneKeyAllEvents );
    79     noKeyCaptureParam.SetCaptureType( EPhoneKeyAllEvents );
    73     iViewCommandHandle->ExecuteCommandL( EPhoneViewStartCapturingKey, 
    80     iViewCommandHandle->ExecuteCommandL( EPhoneViewStartCapturingKey, 
    74         &noKeyCaptureParam );*/
    81         &noKeyCaptureParam );
    75           
    82           
    76     // Capture the up and down events for the EStdKeyEnd key
    83     // Capture the up and down events for the EStdKeyEnd key
    77     /*TPhoneCmdParamKeyCapture endKeyCaptureParam;
    84     TPhoneCmdParamKeyCapture endKeyCaptureParam;
    78     endKeyCaptureParam.SetKey( EStdKeyEnd );
    85     endKeyCaptureParam.SetKey( EStdKeyEnd );
    79     endKeyCaptureParam.SetKeyCode( EKeyEnd );
    86     endKeyCaptureParam.SetKeyCode( EKeyEnd );
    80     endKeyCaptureParam.SetCaptureType( EPhoneKeyAllEvents );
    87     endKeyCaptureParam.SetCaptureType( EPhoneKeyAllEvents );
    81     iViewCommandHandle->ExecuteCommandL( EPhoneViewStartCapturingKey, 
    88     iViewCommandHandle->ExecuteCommandL( EPhoneViewStartCapturingKey, 
    82         &endKeyCaptureParam );*/
    89         &endKeyCaptureParam );
    83     }
    90     }
    84 
    91 
    85 // -----------------------------------------------------------
    92 // -----------------------------------------------------------
    86 // CPhoneStateStartup::NewL()
    93 // CPhoneStateStartup::NewL()
    87 // Constructor
    94 // Constructor
   126 
   133 
   127 // -----------------------------------------------------------
   134 // -----------------------------------------------------------
   128 // CPhoneStateStartup::HandlePEConstructionReadyL
   135 // CPhoneStateStartup::HandlePEConstructionReadyL
   129 // -----------------------------------------------------------
   136 // -----------------------------------------------------------
   130 //
   137 //
   131 void CPhoneStateStartup::HandlePEConstructionReadyL( TInt /*aCallId*/ )
   138 EXPORT_C void CPhoneStateStartup::HandlePEConstructionReadyL( TInt /*aCallId*/ )
   132     {
   139     {
   133     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateStartup::HandlePEConstructionReadyL() ");
   140     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateStartup::HandlePEConstructionReadyL() ");
   134     // Indicate that phone engine construction is ready
   141     // Indicate that phone engine construction is ready
   135     iPEReady = ETrue;
   142     iPEReady = ETrue;
   136 
   143 
   137     // Only go to the idle state if phone is also ready
   144     // Only go to the idle state if phone is also ready
   138     if ( iPhoneReady )
   145     if ( iPhoneReady )
   139         {
   146         {
   140         // Security mode check. 
   147         InitializationReadyL();
   141         TPhoneCmdParamBoolean isSecurityMode;      
       
   142         iViewCommandHandle->ExecuteCommandL( EPhoneViewGetSecurityModeStatus, &isSecurityMode );        
       
   143         if ( !isSecurityMode.Boolean() && !IsSimOk() )
       
   144             {
       
   145             TPhoneCmdParamBoolean securityMode;
       
   146             securityMode.SetBoolean( ETrue );
       
   147             iViewCommandHandle->ExecuteCommandL( EPhoneViewSetSecurityMode, &securityMode );
       
   148             iCreateNote = CIdle::NewL( CActive::EPriorityHigh );
       
   149             
       
   150             CreateAndShowNoteAfterIdle(); 
       
   151             }
       
   152         // Go to idle state
       
   153         SetDefaultFlagsL();
       
   154         iCbaManager->UpdateCbaL( EPhoneEmptyCBA );
       
   155         
       
   156         iStateMachine->ChangeState( EPhoneStateIdle );
       
   157         }
   148         }
   158     }
   149     }
   159 
   150 
   160 // -----------------------------------------------------------
   151 // -----------------------------------------------------------
   161 // CPhoneStateStartup::HandleKeyMessageL
   152 // CPhoneStateStartup::HandleKeyMessageL
   172     // If a key event is received in this state, either the phone engine
   163     // If a key event is received in this state, either the phone engine
   173     // is not ready or the phone has not started up yet. Display an error note
   164     // is not ready or the phone has not started up yet. Display an error note
   174     // if the phone engine is not ready.
   165     // if the phone engine is not ready.
   175     if ( iPhoneReady && !iPEReady )
   166     if ( iPhoneReady && !iPEReady )
   176         {
   167         {
   177         SendGlobalErrorNoteL( EPhoneNoteTextPEFailedAtStartup, ETrue );
   168         SendGlobalErrorNoteL( EPhoneNoteTextPEFailedAtStartup );
   178         }
   169         }
   179     }
   170     }
   180 
   171 
   181 // -----------------------------------------------------------
   172 // -----------------------------------------------------------
   182 // CPhoneStateStartup::HandleKeyEventL
   173 // CPhoneStateStartup::HandleKeyEventL
   184 //
   175 //
   185 EXPORT_C void CPhoneStateStartup::HandleKeyEventL(
   176 EXPORT_C void CPhoneStateStartup::HandleKeyEventL(
   186         const TKeyEvent& /*aKeyEvent*/, TEventCode /*aEventCode*/ )
   177         const TKeyEvent& /*aKeyEvent*/, TEventCode /*aEventCode*/ )
   187     {
   178     {
   188     // Empty implementation
   179     // Empty implementation
       
   180     }
       
   181 
       
   182 // CPhoneStateStartup::HandleCreateNumberEntryL
       
   183 // -----------------------------------------------------------
       
   184 //
       
   185 EXPORT_C void CPhoneStateStartup::HandleCreateNumberEntryL( 
       
   186         const TKeyEvent& /* aKeyEvent */ ,
       
   187         TEventCode /* aEventCode */ )
       
   188     {
       
   189     // Empty implementation
       
   190     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateStartup::HandleCreateNumberEntryL() ");   
   189     }
   191     }
   190 
   192 
   191 // -----------------------------------------------------------
   193 // -----------------------------------------------------------
   192 // CPhoneStateStartup::HandleDtmfKeyToneL
   194 // CPhoneStateStartup::HandleDtmfKeyToneL
   193 // -----------------------------------------------------------
   195 // -----------------------------------------------------------
   208     {
   210     {
   209     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateStartup::HandlePhoneStartupL() ");
   211     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateStartup::HandlePhoneStartupL() ");
   210     // Indicate that the phone is ready
   212     // Indicate that the phone is ready
   211     iPhoneReady = ETrue;
   213     iPhoneReady = ETrue;
   212 
   214 
       
   215     // Sim security status is available at this phase.
       
   216     iStateMachine->SecurityMode()->Initialize();
       
   217     if ( !IsSimOk() )
       
   218         {
       
   219         iCreateNote = CIdle::NewL( CActive::EPriorityHigh );
       
   220         CreateAndShowNoteAfterIdle(); 
       
   221         }
       
   222     
   213     // Only go to idle state when Phone engine is also ready
   223     // Only go to idle state when Phone engine is also ready
   214     if ( iPEReady )
   224     if ( iPEReady )
   215         {
   225         {
   216         // Security mode check.
   226         InitializationReadyL();
   217         TPhoneCmdParamBoolean isSecurityMode;      
       
   218         iViewCommandHandle->ExecuteCommandL( EPhoneViewGetSecurityModeStatus, &isSecurityMode );
       
   219         if ( !isSecurityMode.Boolean() && !IsSimOk() )
       
   220             {
       
   221             TPhoneCmdParamBoolean securityMode;
       
   222             securityMode.SetBoolean( ETrue );
       
   223             iViewCommandHandle->ExecuteCommandL( EPhoneViewSetSecurityMode, &securityMode );
       
   224             iCreateNote = CIdle::NewL( CActive::EPriorityHigh );
       
   225             
       
   226             CreateAndShowNoteAfterIdle(); 
       
   227             }
       
   228         // Go to idle state
       
   229         SetDefaultFlagsL();
       
   230         iCbaManager->UpdateCbaL( EPhoneEmptyCBA );
       
   231         
       
   232         iStateMachine->ChangeState( EPhoneStateIdle );
       
   233         }
   227         }
   234     }
   228     }
   235 
   229 
   236 // ---------------------------------------------------------
   230 // ---------------------------------------------------------
   237 // CPhoneStateStartup::HandleIdleForegroundEventL
   231 // CPhoneStateStartup::HandleIdleForegroundEventL
   241 //
   235 //
   242 EXPORT_C void CPhoneStateStartup::HandleIdleForegroundEventL()
   236 EXPORT_C void CPhoneStateStartup::HandleIdleForegroundEventL()
   243     {
   237     {
   244     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateStartup::HandleIdleForegroundEventL( ) ");
   238     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateStartup::HandleIdleForegroundEventL( ) ");
   245     // Security mode check. 
   239     // Security mode check. 
   246     TPhoneCmdParamBoolean isSecurityMode;      
   240     if ( !iStateMachine->SecurityMode()->IsSecurityMode() && !IsSimOk() )
   247     iViewCommandHandle->ExecuteCommandL( EPhoneViewGetSecurityModeStatus, &isSecurityMode );        
   241         {
   248     if ( !isSecurityMode.Boolean() && !IsSimOk() )
       
   249         {
       
   250         TPhoneCmdParamBoolean securityMode;
       
   251         securityMode.SetBoolean( ETrue );
       
   252         iViewCommandHandle->ExecuteCommandL( EPhoneViewSetSecurityMode, &securityMode );
       
   253         iCreateNote = CIdle::NewL( CActive::EPriorityHigh );
   242         iCreateNote = CIdle::NewL( CActive::EPriorityHigh );
   254         
       
   255         CreateAndShowNoteAfterIdle(); 
   243         CreateAndShowNoteAfterIdle(); 
   256         }
   244         }
   257     }
   245     }
   258 
   246 
   259 // -----------------------------------------------------------------------------
   247 // -----------------------------------------------------------------------------
   286         StartShowSecurityNoteL();
   274         StartShowSecurityNoteL();
   287 
   275 
   288     return KErrNone;
   276     return KErrNone;
   289     }
   277     }
   290 
   278 
       
   279 // -----------------------------------------------------------------------------
       
   280 // CPhoneStateStartup::InitializationReadyL
       
   281 //
       
   282 // -----------------------------------------------------------------------------
       
   283 //
       
   284 void CPhoneStateStartup::InitializationReadyL()
       
   285     {
       
   286     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateStartup::InitializationReady() ");
       
   287     // Go to idle state
       
   288     SetDefaultFlagsL();
       
   289     iCbaManager->UpdateCbaL( EPhoneEmptyCBA );
       
   290     iViewCommandHandle->ExecuteCommand( EPhoneViewPrepareIcons );
       
   291     iViewCommandHandle->ExecuteCommand( EPhoneViewLoadPlugins );
       
   292     iStateMachine->ChangeState( EPhoneStateIdle );   
       
   293     }
       
   294 
       
   295 
   291 // End of File
   296 // End of File