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