phoneapp/phoneuicontrol/src/cphonestatestartup.cpp
changeset 65 2a5d4ab426d3
parent 50 377c906a8701
child 74 d1c62c765e48
equal deleted inserted replaced
60:1eef62f5c541 65:2a5d4ab426d3
    12 * Contributors:
    12 * Contributors:
    13 *
    13 *
    14 * Description: Implementation of CPhoneStateStartup class.
    14 * Description: Implementation of CPhoneStateStartup class.
    15 *
    15 *
    16 */
    16 */
    17 
       
    18 
    17 
    19 // INCLUDES
    18 // INCLUDES
    20 #include "cphonestatestartup.h"
    19 #include "cphonestatestartup.h"
    21 #include "phonestatedefinitions.h"
    20 #include "phonestatedefinitions.h"
    22 #include "mphonestatemachine.h"
    21 #include "mphonestatemachine.h"
    60 //
    59 //
    61 EXPORT_C void CPhoneStateStartup::ConstructL()
    60 EXPORT_C void CPhoneStateStartup::ConstructL()
    62     {
    61     {
    63     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateStartup::ConstructL() ");
    62     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateStartup::ConstructL() ");
    64     CPhoneState::BaseConstructL();
    63     CPhoneState::BaseConstructL();
    65 
       
    66     // CAPTURE KEY EVENTS PERMANENTLY
       
    67         
       
    68     // Capture the up and down events for the No key
       
    69     /*TPhoneCmdParamKeyCapture noKeyCaptureParam;
       
    70     noKeyCaptureParam.SetKey( EStdKeyNo );
       
    71     noKeyCaptureParam.SetKeyCode( EKeyNo );
       
    72     noKeyCaptureParam.SetCaptureType( EPhoneKeyAllEvents );
       
    73     iViewCommandHandle->ExecuteCommandL( EPhoneViewStartCapturingKey, 
       
    74         &noKeyCaptureParam );*/
       
    75           
       
    76     // Capture the up and down events for the EStdKeyEnd key
       
    77     /*TPhoneCmdParamKeyCapture endKeyCaptureParam;
       
    78     endKeyCaptureParam.SetKey( EStdKeyEnd );
       
    79     endKeyCaptureParam.SetKeyCode( EKeyEnd );
       
    80     endKeyCaptureParam.SetCaptureType( EPhoneKeyAllEvents );
       
    81     iViewCommandHandle->ExecuteCommandL( EPhoneViewStartCapturingKey, 
       
    82         &endKeyCaptureParam );*/
       
    83     }
    64     }
    84 
    65 
    85 // -----------------------------------------------------------
    66 // -----------------------------------------------------------
    86 // CPhoneStateStartup::NewL()
    67 // CPhoneStateStartup::NewL()
    87 // Constructor
    68 // Constructor
   131 void CPhoneStateStartup::HandlePEConstructionReadyL( TInt /*aCallId*/ )
   112 void CPhoneStateStartup::HandlePEConstructionReadyL( TInt /*aCallId*/ )
   132     {
   113     {
   133     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateStartup::HandlePEConstructionReadyL() ");
   114     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateStartup::HandlePEConstructionReadyL() ");
   134     // Indicate that phone engine construction is ready
   115     // Indicate that phone engine construction is ready
   135     iPEReady = ETrue;
   116     iPEReady = ETrue;
   136 
       
   137     // Only go to the idle state if phone is also ready
   117     // Only go to the idle state if phone is also ready
   138     if ( iPhoneReady )
   118     if ( iPhoneReady )
   139         {
   119         {
   140         // Security mode check. 
   120         TPhoneCmdParamBoolean isSecurityMode;
   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         }
       
   158     }
       
   159 
       
   160 // -----------------------------------------------------------
       
   161 // CPhoneStateStartup::HandleKeyMessageL
       
   162 // -----------------------------------------------------------
       
   163 //
       
   164 EXPORT_C void CPhoneStateStartup::HandleKeyMessageL( 
       
   165     TPhoneKeyEventMessages /*aMessage*/,
       
   166     TKeyCode /*aCode*/ )
       
   167     {
       
   168     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateStartup::HandleKeyMessageL( ) ");
       
   169 
       
   170     // TBD: Panic if PE Construction fails
       
   171     // For Debug use only
       
   172     // 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
       
   174     // if the phone engine is not ready.
       
   175     if ( iPhoneReady && !iPEReady )
       
   176         {
       
   177         SendGlobalErrorNoteL( EPhoneNoteTextPEFailedAtStartup, ETrue );
       
   178         }
       
   179     }
       
   180 
       
   181 // -----------------------------------------------------------
       
   182 // CPhoneStateStartup::HandleKeyEventL
       
   183 // -----------------------------------------------------------
       
   184 //
       
   185 EXPORT_C void CPhoneStateStartup::HandleKeyEventL(
       
   186         const TKeyEvent& /*aKeyEvent*/, TEventCode /*aEventCode*/ )
       
   187     {
       
   188     // Empty implementation
       
   189     }
       
   190 
       
   191 // -----------------------------------------------------------
       
   192 // CPhoneStateStartup::HandleDtmfKeyToneL
       
   193 // -----------------------------------------------------------
       
   194 //
       
   195 EXPORT_C void CPhoneStateStartup::HandleDtmfKeyToneL( 
       
   196         const TKeyEvent& /* aKeyEvent */,
       
   197         TEventCode /* aEventCode */ )
       
   198     {
       
   199     // Empty implementation
       
   200     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateStartup::HandleDtmfKeyToneL() ");
       
   201     }
       
   202     
       
   203 // -----------------------------------------------------------
       
   204 // CPhoneStateStartup::HandlePhoneStartupL
       
   205 // -----------------------------------------------------------
       
   206 //
       
   207 EXPORT_C void CPhoneStateStartup::HandlePhoneStartupL()
       
   208     {
       
   209     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateStartup::HandlePhoneStartupL() ");
       
   210     // Indicate that the phone is ready
       
   211     iPhoneReady = ETrue;
       
   212 
       
   213     // Only go to idle state when Phone engine is also ready
       
   214     if ( iPEReady )
       
   215         {
       
   216         // Security mode check.
       
   217         TPhoneCmdParamBoolean isSecurityMode;      
       
   218         iViewCommandHandle->ExecuteCommandL( EPhoneViewGetSecurityModeStatus, &isSecurityMode );
   121         iViewCommandHandle->ExecuteCommandL( EPhoneViewGetSecurityModeStatus, &isSecurityMode );
   219         if ( !isSecurityMode.Boolean() && !IsSimOk() )
   122         if ( !isSecurityMode.Boolean() && !IsSimOk() )
   220             {
   123             {
   221             TPhoneCmdParamBoolean securityMode;
   124             TPhoneCmdParamBoolean securityMode;
   222             securityMode.SetBoolean( ETrue );
   125             securityMode.SetBoolean( ETrue );
   223             iViewCommandHandle->ExecuteCommandL( EPhoneViewSetSecurityMode, &securityMode );
   126             iViewCommandHandle->ExecuteCommandL( EPhoneViewSetSecurityMode, &securityMode );
   224             iCreateNote = CIdle::NewL( CActive::EPriorityHigh );
   127             iCreateNote = CIdle::NewL( CActive::EPriorityHigh );
   225             
       
   226             CreateAndShowNoteAfterIdle(); 
   128             CreateAndShowNoteAfterIdle(); 
   227             }
   129             }
   228         // Go to idle state
       
   229         SetDefaultFlagsL();
   130         SetDefaultFlagsL();
   230         iCbaManager->UpdateCbaL( EPhoneEmptyCBA );
   131         iCbaManager->UpdateCbaL( EPhoneEmptyCBA );
   231         
   132         iStateMachine->ChangeState( EPhoneStateIdle );
       
   133         }
       
   134     }
       
   135 
       
   136 // -----------------------------------------------------------
       
   137 // CPhoneStateStartup::HandleKeyMessageL
       
   138 // -----------------------------------------------------------
       
   139 //
       
   140 EXPORT_C void CPhoneStateStartup::HandleKeyMessageL( 
       
   141     TPhoneKeyEventMessages /*aMessage*/,
       
   142     TKeyCode /*aCode*/ )
       
   143     {
       
   144     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateStartup::HandleKeyMessageL( ) ");
       
   145     // TBD: Panic if PE Construction fails
       
   146     // For Debug use only
       
   147     // If a key event is received in this state, either the phone engine
       
   148     // is not ready or the phone has not started up yet. Display an error note
       
   149     // if the phone engine is not ready.
       
   150     if ( iPhoneReady && !iPEReady )
       
   151         {
       
   152         SendGlobalErrorNoteL( EPhoneNoteTextPEFailedAtStartup, ETrue );
       
   153         }
       
   154     }
       
   155 
       
   156 // -----------------------------------------------------------
       
   157 // CPhoneStateStartup::HandleKeyEventL
       
   158 // -----------------------------------------------------------
       
   159 //
       
   160 EXPORT_C void CPhoneStateStartup::HandleKeyEventL(
       
   161         const TKeyEvent& /*aKeyEvent*/, TEventCode /*aEventCode*/ )
       
   162     {
       
   163     // Empty implementation
       
   164     }
       
   165 
       
   166 // -----------------------------------------------------------
       
   167 // CPhoneStateStartup::HandleDtmfKeyToneL
       
   168 // -----------------------------------------------------------
       
   169 //
       
   170 EXPORT_C void CPhoneStateStartup::HandleDtmfKeyToneL( 
       
   171         const TKeyEvent& /* aKeyEvent */, TEventCode /* aEventCode */ )
       
   172     {
       
   173     // Empty implementation
       
   174     }
       
   175     
       
   176 // -----------------------------------------------------------
       
   177 // CPhoneStateStartup::HandlePhoneStartupL
       
   178 // -----------------------------------------------------------
       
   179 //
       
   180 EXPORT_C void CPhoneStateStartup::HandlePhoneStartupL()
       
   181     {
       
   182     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateStartup::HandlePhoneStartupL() ");
       
   183     // Indicate that the phone is ready
       
   184     iPhoneReady = ETrue;
       
   185     // Only go to idle state when Phone engine is also ready
       
   186     if ( iPEReady )
       
   187         {
       
   188         TPhoneCmdParamBoolean isSecurityMode;
       
   189         iViewCommandHandle->ExecuteCommandL( EPhoneViewGetSecurityModeStatus, &isSecurityMode );
       
   190         if ( !isSecurityMode.Boolean() && !IsSimOk() )
       
   191             {
       
   192             TPhoneCmdParamBoolean securityMode;
       
   193             securityMode.SetBoolean( ETrue );
       
   194             iViewCommandHandle->ExecuteCommandL( EPhoneViewSetSecurityMode, &securityMode );
       
   195             iCreateNote = CIdle::NewL( CActive::EPriorityHigh );
       
   196             CreateAndShowNoteAfterIdle(); 
       
   197             }
       
   198         SetDefaultFlagsL();
       
   199         iCbaManager->UpdateCbaL( EPhoneEmptyCBA );
   232         iStateMachine->ChangeState( EPhoneStateIdle );
   200         iStateMachine->ChangeState( EPhoneStateIdle );
   233         }
   201         }
   234     }
   202     }
   235 
   203 
   236 // ---------------------------------------------------------
   204 // ---------------------------------------------------------
   240 // ---------------------------------------------------------
   208 // ---------------------------------------------------------
   241 //
   209 //
   242 EXPORT_C void CPhoneStateStartup::HandleIdleForegroundEventL()
   210 EXPORT_C void CPhoneStateStartup::HandleIdleForegroundEventL()
   243     {
   211     {
   244     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateStartup::HandleIdleForegroundEventL( ) ");
   212     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateStartup::HandleIdleForegroundEventL( ) ");
   245     // Security mode check. 
       
   246     TPhoneCmdParamBoolean isSecurityMode;      
   213     TPhoneCmdParamBoolean isSecurityMode;      
   247     iViewCommandHandle->ExecuteCommandL( EPhoneViewGetSecurityModeStatus, &isSecurityMode );        
   214     iViewCommandHandle->ExecuteCommandL( EPhoneViewGetSecurityModeStatus, &isSecurityMode );
   248     if ( !isSecurityMode.Boolean() && !IsSimOk() )
   215     if ( !isSecurityMode.Boolean() && !IsSimOk() )
   249         {
   216         {
   250         TPhoneCmdParamBoolean securityMode;
   217         TPhoneCmdParamBoolean securityMode;
   251         securityMode.SetBoolean( ETrue );
   218         securityMode.SetBoolean( ETrue );
   252         iViewCommandHandle->ExecuteCommandL( EPhoneViewSetSecurityMode, &securityMode );
   219         iViewCommandHandle->ExecuteCommandL( EPhoneViewSetSecurityMode, &securityMode );
   262 // Callback function.
   229 // Callback function.
   263 // -----------------------------------------------------------------------------
   230 // -----------------------------------------------------------------------------
   264 //
   231 //
   265 void CPhoneStateStartup::CreateAndShowNoteAfterIdle()
   232 void CPhoneStateStartup::CreateAndShowNoteAfterIdle()
   266     {
   233     {
   267  __LOGMETHODSTARTEND( EPhoneControl, "CPhoneStateStartup::CreateAndShowNoteAfterIdle ");
   234     __LOGMETHODSTARTEND( EPhoneControl, "CPhoneStateStartup::CreateAndShowNoteAfterIdle ");
   268         
       
   269     if ( !iCreateNote->IsActive() )
   235     if ( !iCreateNote->IsActive() )
   270         {
   236         {
   271         iCreateNote->Start( 
   237         iCreateNote->Start( 
   272             TCallBack( DoShowNoteL, this ) );
   238             TCallBack( DoShowNoteL, this ) );
   273         }
   239         }
   282 TInt CPhoneStateStartup::DoShowNoteL( TAny* aAny )
   248 TInt CPhoneStateStartup::DoShowNoteL( TAny* aAny )
   283     {        
   249     {        
   284     __LOGMETHODSTARTEND( EPhoneControl, "CPhoneStateStartup::DoShowNoteL ");
   250     __LOGMETHODSTARTEND( EPhoneControl, "CPhoneStateStartup::DoShowNoteL ");
   285     static_cast< CPhoneStateStartup* >( aAny )->
   251     static_cast< CPhoneStateStartup* >( aAny )->
   286         StartShowSecurityNoteL();
   252         StartShowSecurityNoteL();
   287 
       
   288     return KErrNone;
   253     return KErrNone;
   289     }
   254     }
   290 
   255 
   291 // End of File
   256 // End of File