phoneapp/phoneuistates/src/cphoneemergency.cpp
branchRCL_3
changeset 61 41a7f70b3818
parent 58 40a3f856b14d
child 62 5266b1f337bd
equal deleted inserted replaced
58:40a3f856b14d 61:41a7f70b3818
    29 #include "tphonecmdparamstring.h"
    29 #include "tphonecmdparamstring.h"
    30 #include "tphonecmdparaminteger.h"
    30 #include "tphonecmdparaminteger.h"
    31 #include "tphonecmdparamboolean.h"
    31 #include "tphonecmdparamboolean.h"
    32 #include "tphonecmdparamemergencycallheaderdata.h"
    32 #include "tphonecmdparamemergencycallheaderdata.h"
    33 #include "tphonecmdparamcallheaderdata.h"
    33 #include "tphonecmdparamcallheaderdata.h"
       
    34 #include "tphonecmdparamkeycapture.h"
    34 #include "mphonestatemachine.h"
    35 #include "mphonestatemachine.h"
    35 #include "phonestatedefinitionsgsm.h"
    36 #include "phonestatedefinitionsgsm.h"
    36 #include "phoneviewcommanddefinitions.h"
    37 #include "phoneviewcommanddefinitions.h"
    37 #include "phoneui.hrh"
    38 #include "phoneui.hrh"
    38 #include "phonerssbase.h"
    39 #include "phonerssbase.h"
    39 #include "cphonemainresourceresolver.h"
    40 #include "cphonemainresourceresolver.h"
    40 #include "phonelogger.h"
    41 #include "phonelogger.h"
    41 #include "cphonepubsubproxy.h"
    42 #include "cphonepubsubproxy.h"
    42 #include "cphonekeys.h"
    43 #include "cphonekeys.h"
    43 #include "tphonecmdparamaudiooutput.h"
    44 #include "tphonecmdparamaudiooutput.h"
    44 #include "cphonesecuritymodeobserver.h"
    45 #include "phoneresourceids.h"
    45 
    46 
    46 // ================= MEMBER FUNCTIONS =======================
    47 // ================= MEMBER FUNCTIONS =======================
    47 
    48 
    48 // -----------------------------------------------------------
       
    49 // C++ default constructor can NOT contain any code, that
    49 // C++ default constructor can NOT contain any code, that
    50 // might leave.
    50 // might leave.
    51 // -----------------------------------------------------------
       
    52 //
    51 //
    53 CPhoneEmergency::CPhoneEmergency(
    52 CPhoneEmergency::CPhoneEmergency(
    54     MPhoneStateMachine* aStateMachine,
    53     MPhoneStateMachine* aStateMachine,
    55     MPhoneViewCommandHandle* aViewCommandHandle,
    54     MPhoneViewCommandHandle* aViewCommandHandle,
    56     MPhoneCustomization* aPhoneCustomization ) :
    55     MPhoneCustomization* aPhoneCustomization ) :
    62 // -----------------------------------------------------------
    61 // -----------------------------------------------------------
    63 // CPhoneEmergency::~CPhoneEmergency()
    62 // CPhoneEmergency::~CPhoneEmergency()
    64 // Destructor
    63 // Destructor
    65 // (other items were commented in a header).
    64 // (other items were commented in a header).
    66 // -----------------------------------------------------------
    65 // -----------------------------------------------------------
    67 //
    66 
    68 CPhoneEmergency::~CPhoneEmergency()
    67 CPhoneEmergency::~CPhoneEmergency()
    69     {
    68     {
    70     }
    69     }
    71 
    70 
    72 // -----------------------------------------------------------
    71 // -----------------------------------------------------------
   172         case MEngineMonitor::EPEMessageSentDTMF:         // fall through
   171         case MEngineMonitor::EPEMessageSentDTMF:         // fall through
   173         case MEngineMonitor::EPEMessageDTMFSendingAborted:
   172         case MEngineMonitor::EPEMessageDTMFSendingAborted:
   174             CPhoneGsmInCall::HandlePhoneEngineMessageL( aMessage, aCallId );
   173             CPhoneGsmInCall::HandlePhoneEngineMessageL( aMessage, aCallId );
   175             if ( iStateMachine->PhoneEngineInfo()->CallState( KPEEmergencyCallId ) == EPEStateDialing )
   174             if ( iStateMachine->PhoneEngineInfo()->CallState( KPEEmergencyCallId ) == EPEStateDialing )
   176                 {
   175                 {
   177                 TPhoneCmdParamBoolean isNoteVisible;
   176                 UpdateSetupCbaL();
   178                 iViewCommandHandle->ExecuteCommandL( EPhoneViewGetIsNoteVisible,
   177                 }
   179                       &isNoteVisible );
   178             break;
   180 
   179             
   181                 if ( !isNoteVisible.Boolean() )
       
   182                     {
       
   183                     ShowNoteL( EPhoneEmergencyConnectWaitNote );
       
   184                     UpdateSetupCbaL();
       
   185                     }
       
   186                  }
       
   187             break;
       
   188 
       
   189         case MEngineMonitor::EPEMessageColpNumberAvailable:
   180         case MEngineMonitor::EPEMessageColpNumberAvailable:
   190             //Don't show COLP note during emergency call.
   181             //Don't show COLP note during emergency call.
   191             break;
   182             break; 
   192 
   183 
   193         default:
   184         default:
   194             CPhoneGsmInCall::HandlePhoneEngineMessageL(
   185             CPhoneGsmInCall::HandlePhoneEngineMessageL(
   195                 aMessage, aCallId );
   186                 aMessage, aCallId );
   196             break;
   187             break;
   210     TPhoneCmdParamBoolean globalNotifierParam;
   201     TPhoneCmdParamBoolean globalNotifierParam;
   211     globalNotifierParam.SetBoolean( EFalse );
   202     globalNotifierParam.SetBoolean( EFalse );
   212     iViewCommandHandle->ExecuteCommandL( EPhoneViewSetGlobalNotifiersDisabled,
   203     iViewCommandHandle->ExecuteCommandL( EPhoneViewSetGlobalNotifiersDisabled,
   213         &globalNotifierParam );
   204         &globalNotifierParam );
   214 
   205 
   215     if ( iOnScreenDialer && IsDTMFEditorVisibleL() )
       
   216         {
       
   217         CloseDTMFEditorL();
       
   218         }
       
   219 
       
   220     if ( aCallId == KEmergencyCallId )
   206     if ( aCallId == KEmergencyCallId )
   221         {
   207         {
   222         iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveCallHeader, aCallId );
   208         iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveCallHeader, aCallId );
   223         // Make sure that toolbar is not shown any more
       
   224         iViewCommandHandle->ExecuteCommandL( EPhoneViewHideToolbar );
       
   225         // Remove emergency connecting note if still there
   209         // Remove emergency connecting note if still there
   226         iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveNote );
   210         iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveNote );
   227         // Close menu bar, if it is displayed
   211         
   228         iViewCommandHandle->ExecuteCommandL( EPhoneViewMenuBarClose );
   212         TPhoneCmdParamKeyCapture captureParam;
       
   213         captureParam.SetKeyCode( EKeyNo );
       
   214         iViewCommandHandle->ExecuteCommand( 
       
   215                 EPhoneViewStopCapturingKey, &captureParam );
   229 
   216 
   230         const TBool isSimStateNotPresentWithSecurityMode = IsSimStateNotPresentWithSecurityModeEnabled();
   217         const TBool isSimStateNotPresentWithSecurityMode = IsSimStateNotPresentWithSecurityModeEnabled();
   231 
   218 
   232         // Sim IS not ok when making emergency call from Pin query, no note
   219         // Sim IS not ok when making emergency call from Pin query, no note
   233         if ( (!IsSimOk() && !iStartupInterrupted) || isSimStateNotPresentWithSecurityMode )
   220         if ( (!IsSimOk() && !iStartupInterrupted) || isSimStateNotPresentWithSecurityMode )
   234             {
   221             {
   235             StartShowSecurityNoteL();
   222             StartShowSecurityNoteL();
   236             }
   223             }
   237         else
   224         else
   238             {
   225             {
   239             if ( !TopAppIsDisplayedL() || iStateMachine->SecurityMode()->IsAutolockEnabled() )
   226             if ( !TopAppIsDisplayedL() || iDeviceLockOn  )
   240                 {
   227                 {
   241                 // Continue displaying current app but set up the
   228                 // Continue displaying current app but set up the
   242                 // idle screen in the background
   229                 // idle screen in the background
   243                 SetupIdleScreenInBackgroundL();
   230                 SetupIdleScreenInBackgroundL();
   244                 // Update toolbar
       
   245                 iViewCommandHandle->ExecuteCommandL( EPhoneViewUpdateToolbar );
       
   246                 }
   231                 }
   247 
   232 
   248             else if ( iOnScreenDialer && IsNumberEntryContentStored() )
   233             else if ( iOnScreenDialer && IsNumberEntryContentStored() )
   249                 {
   234                 {
   250                 if ( !IsNumberEntryUsedL() )
       
   251                     {
       
   252                     CreateNumberEntryL();
       
   253                     }
       
   254                 // Restore the number entry content from cache
       
   255                 RestoreNumberEntryContentL();
       
   256                 SetNumberEntryVisibilityL(ETrue);
   235                 SetNumberEntryVisibilityL(ETrue);
   257                 }
   236                 }
   258 
   237 
   259             else if ( IsNumberEntryUsedL() )
   238             else if ( IsNumberEntryUsedL() )
   260                 {
   239                 {
   261                 // Show the number entry if it exists
   240                 // Show the number entry if it exists
   262                 SetNumberEntryVisibilityL(ETrue);
   241                 SetNumberEntryVisibilityL(ETrue);
   263                 // Update toolbar
       
   264                 iViewCommandHandle->ExecuteCommandL( EPhoneViewUpdateToolbar );
       
   265                 }
   242                 }
   266 
   243 
   267             else
   244             else
   268                 {
   245                 {
   269                  // Display idle screen
   246                  // Display idle screen
   288             {
   265             {
   289             if ( !isSimStateNotPresentWithSecurityMode )
   266             if ( !isSimStateNotPresentWithSecurityMode )
   290                 {
   267                 {
   291                 SetDefaultFlagsL();
   268                 SetDefaultFlagsL();
   292                 }
   269                 }
   293 
   270             
   294             // As long as security note is not shown with feature flag
   271             // As long as security note is not shown with feature flag 
   295             // KFeatureIdFfSimlessOfflineSupport undef it is ok to do SetupIdleScreenInBackgroundL.
   272             // KFeatureIdFfSimlessOfflineSupport undef it is ok to do SetupIdleScreenInBackgroundL.
   296             if ( ( !IsNumberEntryUsedL() ) &&
   273             if ( ( !IsNumberEntryUsedL() ) && 
   297                  !( IsSimStateNotPresentWithSecurityModeEnabled() &&
   274                  !( IsSimStateNotPresentWithSecurityModeEnabled() && 
   298                     !FeatureManager::FeatureSupported( KFeatureIdFfSimlessOfflineSupport ) ) )
   275                     !FeatureManager::FeatureSupported( KFeatureIdFfSimlessOfflineSupport ) ) )
   299                 {
   276                 {
   300                 UpdateCbaL( EPhoneEmptyCBA );
   277                 UpdateCbaL( EPhoneEmptyCBA );
   301 
   278                 
   302                 if ( !iStateMachine->SecurityMode()->IsSecurityMode() )
   279                 TPhoneCmdParamBoolean securityMode;
       
   280                 iViewCommandHandle->ExecuteCommandL( EPhoneViewGetSecurityModeStatus, &securityMode );
       
   281                 if ( !securityMode.Boolean() )
   303                     {
   282                     {
   304                     // Setup idle as next active app.
   283                     // Setup idle as next active app.
   305                     SetupIdleScreenInBackgroundL();
   284                     SetupIdleScreenInBackgroundL();
   306                     }
   285                     }
   307                 }
   286                 }
   308 
   287             
   309             iStateMachine->ChangeState( EPhoneStateIdle );
   288             iStateMachine->ChangeState( EPhoneStateIdle );
   310             }
   289             }
   311         }
   290         }
   312     else
   291     else
   313         {
   292         {
   330     // because PE messages are processed asynchronously.
   309     // because PE messages are processed asynchronously.
   331     __LOGMETHODSTARTEND(EPhoneUIStates, "CPhoneEmergency::HandleDialingL() ");
   310     __LOGMETHODSTARTEND(EPhoneUIStates, "CPhoneEmergency::HandleDialingL() ");
   332 
   311 
   333     if ( aCallId == KPEEmergencyCallId )
   312     if ( aCallId == KPEEmergencyCallId )
   334         {
   313         {
   335         if ( !IsSimOk() || IsSimStateNotPresentWithSecurityModeEnabled() )
   314 
   336             {
   315         iDeviceLockOn = IsAutoLockOn();
   337             TPhoneCmdParamBoolean visibleMode;
       
   338             visibleMode.SetBoolean( ETrue );
       
   339             iViewCommandHandle->ExecuteCommandL( EPhoneViewSetStatusPaneVisible, &visibleMode );
       
   340             }
       
   341 
       
   342         // Close menu bar, if it is displayed
       
   343         iViewCommandHandle->ExecuteCommandL( EPhoneViewMenuBarClose );
       
   344 
       
   345         // Dim toolbar items
       
   346         SetToolbarDimming( ETrue );
       
   347 
       
   348         // Request that dimmed toolbar is visible.
       
   349         // Do it already here. Otherwice a white/black toolbar area is shortly shown and
       
   350         // a white screen can be a result when touching it.
       
   351         iViewCommandHandle->HandleCommandL( EPhoneViewShowToolbar );
       
   352 
   316 
   353         // Disable global notes when the phone is dialling
   317         // Disable global notes when the phone is dialling
   354         TPhoneCmdParamBoolean globalNotifierParam;
   318         TPhoneCmdParamBoolean globalNotifierParam;
   355         globalNotifierParam.SetBoolean( ETrue );
   319         globalNotifierParam.SetBoolean( ETrue );
   356         iViewCommandHandle->ExecuteCommandL(
   320         iViewCommandHandle->ExecuteCommandL(
   357             EPhoneViewSetGlobalNotifiersDisabled,
   321             EPhoneViewSetGlobalNotifiersDisabled,
   358             &globalNotifierParam );
   322             &globalNotifierParam );
   359 
   323 
       
   324         TPhoneCmdParamKeyCapture captureParam;
       
   325         captureParam.SetKeyCode( EKeyNo );
       
   326         iViewCommandHandle->ExecuteCommand( EPhoneViewStartCapturingKey, &captureParam );
       
   327         
   360         // Capture keys when the phone is dialling
   328         // Capture keys when the phone is dialling
   361         CaptureKeysDuringCallNotificationL( ETrue );
   329         CaptureKeysDuringCallNotificationL( ETrue );
   362 
   330 
   363         // Indicate that the Phone needs to be sent to the background if
   331         // Indicate that the Phone needs to be sent to the background if
   364         // an application other than the top application is in the foreground
   332         // an application other than the top application is in the foreground
   365         SetNeedToReturnToForegroundAppStatusL( !TopAppIsDisplayedL() );
   333         TPhoneCmdParamBoolean booleanParam;
   366         
   334         booleanParam.SetBoolean( !TopAppIsDisplayedL() );
       
   335         iViewCommandHandle->ExecuteCommandL(
       
   336             EPhoneViewSetNeedToSendToBackgroundStatus,
       
   337             &booleanParam );
       
   338 
   367         // Bring Phone app in the foreground
   339         // Bring Phone app in the foreground
   368         TPhoneCmdParamInteger uidParam;
   340         TPhoneCmdParamInteger uidParam;
   369         uidParam.SetInteger( KUidPhoneApplication.iUid );
   341         uidParam.SetInteger( KUidPhoneApplication.iUid );
   370         iViewCommandHandle->ExecuteCommandL( EPhoneViewBringAppToForeground,
   342         iViewCommandHandle->ExecuteCommandL( EPhoneViewBringAppToForeground,
   371             &uidParam );
   343             &uidParam );
   381             iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveNumberEntry );
   353             iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveNumberEntry );
   382             }
   354             }
   383 
   355 
   384         // Remove exit emergency mode query, if it exists
   356         // Remove exit emergency mode query, if it exists
   385         iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveQuery );
   357         iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveQuery );
   386 
   358         
   387         // Enable the volume display
   359         BeginUiUpdateLC();
   388         iViewCommandHandle->ExecuteCommandL( EPhoneViewShowNaviPaneAudioVolume );
   360         
       
   361         TPhoneCmdParamEmergencyCallHeaderData emergencyHeaderParam;
       
   362         // Set call header
       
   363         TBuf<KPhoneCallHeaderLabelMaxLength> headerText( KNullDesC );
       
   364         StringLoader::Load(
       
   365             headerText,
       
   366             CPhoneMainResourceResolver::Instance()->ResolveResourceID(
       
   367                 EPhoneEmergencyCallHeader ),
       
   368             CCoeEnv::Static() );
       
   369         emergencyHeaderParam.SetHeaderText( headerText );
       
   370 
       
   371         // Set call header ciphering status
       
   372         emergencyHeaderParam.SetCiphering(
       
   373             iStateMachine->PhoneEngineInfo()->IsSecureCall( aCallId ) );
       
   374         emergencyHeaderParam.SetCipheringIndicatorAllowed(
       
   375             iStateMachine->PhoneEngineInfo()->SecureSpecified() );
       
   376 
       
   377         // Notify the view
       
   378         iViewCommandHandle->ExecuteCommandL(
       
   379             EPhoneViewCreateEmergencyCallHeader,
       
   380             aCallId,
       
   381             &emergencyHeaderParam );
       
   382 
       
   383         TPhoneCmdParamCallHeaderData headerParam;
       
   384         headerParam.SetCallState( EPEStateDialing );
       
   385         
       
   386         StringLoader::Load(
       
   387             headerText,
       
   388             CPhoneMainResourceResolver::Instance()->ResolveResourceID(
       
   389                     EPhoneAttemptingEmergencyText ),
       
   390             CCoeEnv::Static() );
       
   391         headerParam.SetLabelText( headerText );
       
   392         
       
   393         iViewCommandHandle->ExecuteCommandL(
       
   394             EPhoneViewUpdateBubble,
       
   395             aCallId,
       
   396             &headerParam );
   389 
   397 
   390         SetTouchPaneButtons( EPhoneEmergencyCallButtons );
   398         SetTouchPaneButtons( EPhoneEmergencyCallButtons );
   391 
   399         SetBackButtonActive(EFalse);
   392         ShowNoteL( EPhoneEmergencyConnectWaitNote );
   400         
   393 
   401         EndUiUpdate();        
       
   402 
       
   403         // ShowNoteL( EPhoneEmergencyConnectWaitNote );
   394         UpdateSetupCbaL();
   404         UpdateSetupCbaL();
   395         }
   405         }
   396     }
   406     }
   397 // -----------------------------------------------------------
   407 // -----------------------------------------------------------
   398 // CPhoneEmergency::HandleConnectingL
   408 // CPhoneEmergency::HandleConnectingL
   418             {
   428             {
   419             // Stop capturing keys
   429             // Stop capturing keys
   420             CaptureKeysDuringCallNotificationL( EFalse );
   430             CaptureKeysDuringCallNotificationL( EFalse );
   421             }
   431             }
   422         }
   432         }
   423     else if ( !iStateMachine->SecurityMode()->IsAutolockEnabled() && SimState() == EPESimUsable )
   433     else if ( !iDeviceLockOn && SimState() == EPESimUsable )
   424         {
   434         {
   425         // Stop capturing keys
   435         // Stop capturing keys
   426         CaptureKeysDuringCallNotificationL( EFalse );
   436         CaptureKeysDuringCallNotificationL( EFalse );
   427         }
   437         }
   428 
   438 
       
   439     // Keep Phone in the foreground
       
   440     TPhoneCmdParamBoolean booleanParam;
       
   441     booleanParam.SetBoolean( EFalse );
       
   442     iViewCommandHandle->ExecuteCommandL(
       
   443         EPhoneViewSetNeedToSendToBackgroundStatus, &booleanParam );
       
   444 
   429     // Remove emergency connecting note
   445     // Remove emergency connecting note
   430     iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveNote );
   446     iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveNote );
   431 
       
   432     TPhoneCmdParamEmergencyCallHeaderData emergencyHeaderParam;
       
   433     // Set call header
       
   434     TBuf<KPhoneCallHeaderLabelMaxLength> headerText( KNullDesC );
       
   435     StringLoader::Load(
       
   436         headerText,
       
   437         CPhoneMainResourceResolver::Instance()->ResolveResourceID(
       
   438             EPhoneEmergencyCallHeader ),
       
   439         CCoeEnv::Static() );
       
   440     emergencyHeaderParam.SetHeaderText( headerText );
       
   441 
       
   442     // Set call header ciphering status
       
   443     emergencyHeaderParam.SetCiphering(
       
   444         iStateMachine->PhoneEngineInfo()->IsSecureCall( aCallId ) );
       
   445     emergencyHeaderParam.SetCipheringIndicatorAllowed(
       
   446         iStateMachine->PhoneEngineInfo()->SecureSpecified() );
       
   447 
       
   448     BeginUiUpdateLC();
       
   449 
       
   450     // Notify the view
       
   451     iViewCommandHandle->ExecuteCommandL(
       
   452         EPhoneViewCreateEmergencyCallHeader,
       
   453         aCallId,
       
   454         &emergencyHeaderParam );
       
   455 
   447 
   456     TPhoneCmdParamCallHeaderData headerParam;
   448     TPhoneCmdParamCallHeaderData headerParam;
   457     headerParam.SetCallState( EPEStateConnecting );
   449     headerParam.SetCallState( EPEStateConnecting );
   458     // Notify the view
   450     // Notify the view
   459     iViewCommandHandle->ExecuteCommandL(
   451     iViewCommandHandle->ExecuteCommandL(
   460         EPhoneViewUpdateBubble,
   452         EPhoneViewUpdateBubble,
   461         aCallId,
   453         aCallId,
   462         &headerParam );
   454         &headerParam );
   463 
   455 
   464     EndUiUpdate();
   456     SetToolbarButtonLoudspeakerEnabled();
   465 
   457 
   466     UpdateInCallCbaL();
   458     UpdateInCallCbaL();
   467     }
   459     }
   468 
   460 
   469 // -----------------------------------------------------------
   461 // -----------------------------------------------------------
   482     iViewCommandHandle->ExecuteCommandL(
   474     iViewCommandHandle->ExecuteCommandL(
   483         EPhoneViewUpdateBubble,
   475         EPhoneViewUpdateBubble,
   484         aCallId,
   476         aCallId,
   485         &emergencyHeaderParam );
   477         &emergencyHeaderParam );
   486 
   478 
       
   479     SetBackButtonActive(ETrue);
       
   480 
   487     EndUiUpdate();
   481     EndUiUpdate();
   488     SetToolbarDimming( ETrue );
       
   489     UpdateInCallCbaL();
   482     UpdateInCallCbaL();
   490     }
   483     }
   491 
       
   492 // -----------------------------------------------------------
       
   493 // CPhoneEmergency::OpenMenuBarL
       
   494 // -----------------------------------------------------------
       
   495 //
       
   496 void CPhoneEmergency::OpenMenuBarL()
       
   497     {
       
   498     __LOGMETHODSTARTEND(EPhoneUIStates, "CPhoneEmergency::OpenMenuBarL() ");
       
   499     TInt resourceId;
       
   500 
       
   501     if ( iOnScreenDialer && IsDTMFEditorVisibleL() )
       
   502         {
       
   503         resourceId = EPhoneDtmfDialerMenubar;
       
   504         }
       
   505     else if ( IsNumberEntryVisibleL() )
       
   506         {
       
   507         resourceId = EPhoneCallHandlingEmergencyMenubarWithNumberEntry;
       
   508         }
       
   509     else
       
   510         {
       
   511         resourceId = EPhoneCallHandlingEmergencyMenubar;
       
   512         }
       
   513 
       
   514     TPhoneCmdParamInteger integerParam;
       
   515     integerParam.SetInteger(
       
   516         CPhoneMainResourceResolver::Instance()->
       
   517         ResolveResourceID( resourceId ) );
       
   518     iViewCommandHandle->ExecuteCommandL( EPhoneViewMenuBarOpen,
       
   519         &integerParam );
       
   520     }
       
   521 
       
   522 
   484 
   523 // -----------------------------------------------------------
   485 // -----------------------------------------------------------
   524 // CPhoneEmergency::UpdateInCallCbaL
   486 // CPhoneEmergency::UpdateInCallCbaL
   525 // -----------------------------------------------------------
   487 // -----------------------------------------------------------
   526 //
   488 //
   527 void CPhoneEmergency::UpdateInCallCbaL()
   489 void CPhoneEmergency::UpdateInCallCbaL()
   528     {
   490     {
   529     __LOGMETHODSTARTEND(EPhoneUIStates, "CPhoneEmergency::UpdateInCallCbaL() ");
   491     __LOGMETHODSTARTEND(EPhoneUIStates, "CPhoneEmergency::UpdateInCallCbaL() ");
   530     TInt resourceId = EPhoneCallHandlingEmergencyCBA;
   492     TInt resourceId = EPhoneCallHandlingEmergencyCBA;
   531     const TPEAudioOutput audioOutput =
       
   532         iStateMachine->PhoneEngineInfo()->AudioOutput();
       
   533     const TBool btAvailable =
       
   534         iStateMachine->PhoneEngineInfo()->AudioOutputAvailable( EPEBTAudioAccessory );
       
   535 
       
   536     __PHONELOG2( EOnlyFatal, EPhoneUIStates,
       
   537             "CPhoneEmergency - AudioOutput: %d, BTAvailable: %d",
       
   538             audioOutput, btAvailable );
       
   539 
       
   540     if ( IsNumberEntryVisibleL() )
       
   541         {
       
   542         if ( IsDTMFEditorVisibleL() )
       
   543             {
       
   544             resourceId = EPhoneDtmfDialerCBA;
       
   545             }
       
   546         else
       
   547             {
       
   548             resourceId = EPhoneInCallNumberAcqCBA;
       
   549             }
       
   550         }
       
   551     else if ( iStateMachine->SecurityMode()->IsAutolockEnabled()
       
   552         || SimState() != EPESimUsable
       
   553         || iStartupInterrupted )
       
   554         {
       
   555         if ( TouchCallHandlingSupported() )
       
   556             {
       
   557             resourceId = EPhoneCallHandlingEmergencyInCallNoOptions;
       
   558             }
       
   559         else if ( audioOutput == EPEWiredAudioAccessory || IsSwivelClosed())
       
   560             {
       
   561             resourceId = EPhoneCallHandlingEmergencyNoOptionsNoIhfCBA;
       
   562             }
       
   563         else if ( audioOutput == EPELoudspeaker )
       
   564             {
       
   565             resourceId = EPhoneCallHandlingEmergencyNoOptionsHandsetCBA;
       
   566             }
       
   567         else
       
   568             {
       
   569             resourceId = EPhoneCallHandlingEmergencyNoOptionsCBA;
       
   570             }
       
   571         }
       
   572     else
       
   573         {
       
   574         if ( UseEmergencyNoIhfCBA( audioOutput ) )
       
   575             {
       
   576             resourceId = EPhoneCallHandlingEmergencyNoIhfCBA;
       
   577             }
       
   578         else if ( UseHandsetEmergencyCBA( audioOutput ) )
       
   579             {
       
   580             resourceId = EPhoneCallHandlingEmergencyHandsetCBA;
       
   581             }
       
   582         else if ( ( audioOutput == EPEHandset )
       
   583                 && ( btAvailable ) )
       
   584             {
       
   585             resourceId = EPhoneCallHandlingInCallBtaaCBA;
       
   586             }
       
   587         }
       
   588 
       
   589     iCbaManager->SetCbaL( resourceId );
   493     iCbaManager->SetCbaL( resourceId );
   590     }
   494     }
   591 
   495 
   592 // --------------------------------------------------------------
   496 // --------------------------------------------------------------
   593 // CPhoneEmergency::HandleKeyMessageL
   497 // CPhoneEmergency::HandleKeyMessageL
   602     switch ( aCode )
   506     switch ( aCode )
   603         {
   507         {
   604         // end-key
   508         // end-key
   605         case EKeyNo:
   509         case EKeyNo:
   606             // handle end key
   510             // handle end key
   607             if ( iOnScreenDialer && IsDTMFEditorVisibleL() )
       
   608                 {
       
   609                 CloseDTMFEditorL();
       
   610                 }
       
   611             DisconnectEmergencyCallL();
   511             DisconnectEmergencyCallL();
   612             break;
   512             break;
   613 
   513 
   614         // send-key
   514         // send-key
   615         case EKeyYes:
   515         case EKeyYes:
   620                             &numberEntryCountParam );
   520                             &numberEntryCountParam );
   621                     TInt neLength( numberEntryCountParam.Integer() );
   521                     TInt neLength( numberEntryCountParam.Integer() );
   622                 if ( neLength )
   522                 if ( neLength )
   623                     {
   523                     {
   624                     // Show not allowed note
   524                     // Show not allowed note
   625                     SendGlobalErrorNoteL( EPhoneNoteTextNotAllowed );
   525                     SendGlobalErrorNoteL( EPhoneNoteTextNotAllowed, ETrue );
   626                     }
   526                     }
   627                 else
   527                 else
   628                     {
   528                     {
   629                     // Logs to open
   529                     // Logs to open
   630                     CallFromNumberEntryL();
   530                     CallFromNumberEntryL();
   631                     }
   531                     }
   632                 }
   532                 }
   633             else
   533             else
   634                 {
   534                 {
   635                 // Show not allowed note
   535                 // Show not allowed note
   636                 SendGlobalErrorNoteL( EPhoneNoteTextNotAllowed );
   536                 SendGlobalErrorNoteL( EPhoneNoteTextNotAllowed, ETrue );
   637                 }
   537                 }
   638             break;
   538             break;
   639 
   539 
   640         default:
   540         default:
   641             {
   541             {
   642             if ( TouchCallHandlingSupported() )
   542             if ( TouchCallHandlingSupported() )
   643                 {
   543                 {
   644                 CPhoneGsmInCall::HandleKeyMessageL( aMessage, aCode );
   544                 CPhoneGsmInCall::HandleKeyMessageL( aMessage, aCode ); 
   645                 }
   545                 }
   646             else if ( !iStateMachine->SecurityMode()->IsAutolockEnabled()
   546             else if ( !iDeviceLockOn && SimState() == EPESimUsable )   
   647                 && SimState() == EPESimUsable )
       
   648                 {
   547                 {
   649                 // do base operation
   548                 // do base operation
   650                 CPhoneGsmInCall::HandleKeyMessageL( aMessage, aCode );
   549                 CPhoneGsmInCall::HandleKeyMessageL( aMessage, aCode );
   651                 }
   550                 }
   652             break;
   551             break;
   663     __LOGMETHODSTARTEND(EPhoneUIStates, "CPhoneEmergency::HandleCommandL()");
   562     __LOGMETHODSTARTEND(EPhoneUIStates, "CPhoneEmergency::HandleCommandL()");
   664     TBool commandStatus = ETrue;
   563     TBool commandStatus = ETrue;
   665 
   564 
   666     switch( aCommand )
   565     switch( aCommand )
   667         {
   566         {
       
   567         case EPhoneInCallCmdDtmfManualQuery:
       
   568             if ( iStateMachine->PhoneEngineInfo()->CallState( KPEEmergencyCallId ) == EPEStateDialing )
       
   569                 {
       
   570                 // Remove emergency connecting note
       
   571                 iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveNote );
       
   572                 }
       
   573             commandStatus = CPhoneGsmInCall::HandleCommandL( aCommand );
       
   574             break;
       
   575 
   668         case EPhoneDtmfDialerExit:      // fall through
   576         case EPhoneDtmfDialerExit:      // fall through
   669         case EPhoneDtmfDialerCancel:
   577         case EPhoneDtmfDialerCancel:
   670              {
   578              {
   671              if ( iStateMachine->PhoneEngineInfo()->CallState( KPEEmergencyCallId ) == EPEStateDialing )
   579              if ( iStateMachine->PhoneEngineInfo()->CallState( KPEEmergencyCallId ) == EPEStateDialing )
   672                  {
   580                  {
   673                  CloseDTMFEditorL();
   581 
   674 
   582                  UpdateSetupCbaL();
   675                  TPhoneCmdParamBoolean isNoteVisible;
       
   676                  iViewCommandHandle->ExecuteCommandL( EPhoneViewGetIsNoteVisible,
       
   677                         &isNoteVisible );
       
   678 
       
   679                  if ( !isNoteVisible.Boolean() )
       
   680                      {
       
   681                      ShowNoteL( EPhoneEmergencyConnectWaitNote );
       
   682                      UpdateSetupCbaL();
       
   683                      }
       
   684                  }
   583                  }
   685              else
   584              else
   686                  {
   585                  {
   687                  commandStatus = CPhoneGsmInCall::HandleCommandL( aCommand );
   586                  commandStatus = CPhoneGsmInCall::HandleCommandL( aCommand );
   688                  }
   587                  }
   690              break;
   589              break;
   691 
   590 
   692         case EPhoneInCallCmdEndThisOutgoingCall:
   591         case EPhoneInCallCmdEndThisOutgoingCall:
   693         case EPhoneInCallCmdEndThisActiveCall:
   592         case EPhoneInCallCmdEndThisActiveCall:
   694             DisconnectEmergencyCallL();
   593             DisconnectEmergencyCallL();
   695             break;
       
   696 
       
   697         case EPhoneCmdUpdateEmergencyCba:
       
   698             UpdateInCallCbaL();
       
   699             break;
   594             break;
   700 
   595 
   701         default:
   596         default:
   702             commandStatus = CPhoneGsmInCall::HandleCommandL( aCommand );
   597             commandStatus = CPhoneGsmInCall::HandleCommandL( aCommand );
   703             break;
   598             break;
   745         case ECCPErrorConnectionError:
   640         case ECCPErrorConnectionError:
   746         case ECCPErrorCCIncompatibleMessageInProtocolState:
   641         case ECCPErrorCCIncompatibleMessageInProtocolState:
   747         case ECCPErrorCCNoChannelAvailable:
   642         case ECCPErrorCCNoChannelAvailable:
   748         case ECCPErrorNetworkBusy:
   643         case ECCPErrorNetworkBusy:
   749         case ECCPEmergencyFailed:
   644         case ECCPEmergencyFailed:
   750             SendGlobalErrorNoteL( EPhoneNoteNoNetworkCallEmergency );
   645             SendGlobalErrorNoteL( EPhoneNoteNoNetworkCallEmergency, ETrue );
   751             break;
   646             break;
   752 
   647 
   753        default:
   648        default:
   754         __PHONELOG1(
   649         __PHONELOG1(
   755             EOnlyFatal,
   650             EOnlyFatal,
   768 void CPhoneEmergency::HandleKeyEventL(
   663 void CPhoneEmergency::HandleKeyEventL(
   769     const TKeyEvent& aKeyEvent,
   664     const TKeyEvent& aKeyEvent,
   770     TEventCode aEventCode )
   665     TEventCode aEventCode )
   771     {
   666     {
   772     __LOGMETHODSTARTEND(EPhoneUIStates, "CPhoneEmergency::HandleKeyEventL( ) ");
   667     __LOGMETHODSTARTEND(EPhoneUIStates, "CPhoneEmergency::HandleKeyEventL( ) ");
   773 
   668     
   774     if ( TouchCallHandlingSupported() )
   669     if ( TouchCallHandlingSupported() )
   775         {
   670         {
   776         CPhoneState::HandleKeyEventL( aKeyEvent, aEventCode );
   671         CPhoneState::HandleKeyEventL( aKeyEvent, aEventCode );
   777         }
   672         }
   778     else
   673     else
   779         {
   674         {
   780          if ( iStateMachine->SecurityMode()->IsAutolockEnabled()
   675          if ( iDeviceLockOn && CPhoneKeys::IsNumericKey( aKeyEvent, aEventCode ) )
   781             && CPhoneKeys::IsNumericKey( aKeyEvent, aEventCode ) )
       
   782             {
   676             {
   783             // Send the key event to the phone engine
   677             // Send the key event to the phone engine
   784             SendKeyEventL( aKeyEvent, aEventCode );
   678             SendKeyEventL( aKeyEvent, aEventCode );
   785             }
   679             }
   786         else
   680         else
   850     // Output
   744     // Output
   851     const TPEAudioOutput audioOutput =
   745     const TPEAudioOutput audioOutput =
   852         iStateMachine->PhoneEngineInfo()->AudioOutput();
   746         iStateMachine->PhoneEngineInfo()->AudioOutput();
   853 
   747 
   854     UpdateSetupCbaL();
   748     UpdateSetupCbaL();
   855 
   749     SetTouchPaneButtons(0);
       
   750     
   856     // view update
   751     // view update
   857     outputParam.SetAudioOutput( audioOutput );
   752     outputParam.SetAudioOutput( audioOutput );
   858     iViewCommandHandle->ExecuteCommandL( EPhoneViewActivateAudioPathUIChanges,
   753     iViewCommandHandle->ExecuteCommandL( EPhoneViewActivateAudioPathUIChanges,
   859         &outputParam );
   754         &outputParam );
   860 
   755 
   874 // -----------------------------------------------------------
   769 // -----------------------------------------------------------
   875 //
   770 //
   876 void CPhoneEmergency::UpdateSetupCbaL()
   771 void CPhoneEmergency::UpdateSetupCbaL()
   877     {
   772     {
   878     __LOGMETHODSTARTEND(EPhoneUIStates, "CPhoneEmergency::UpdateSetupCbaL() ");
   773     __LOGMETHODSTARTEND(EPhoneUIStates, "CPhoneEmergency::UpdateSetupCbaL() ");
   879 
   774    TInt resourceId = EPhoneCallHandlingEmergencyCBA;        
   880     TInt resourceId = EPhoneCallHandlingCallSetupCBA;
   775    iCbaManager->SetCbaL( resourceId );
   881 
   776     }
   882     const TPEAudioOutput audioOutput =
   777 
   883         iStateMachine->PhoneEngineInfo()->AudioOutput();
       
   884 
       
   885     if ( !( TouchCallHandlingSupported() )
       
   886             && iCallSetup && audioOutput != EPENotActive )
       
   887         {
       
   888         if ( audioOutput == EPELoudspeaker )
       
   889             {
       
   890             resourceId = EPhoneCallHandlingCallSetupToHandsetCBA;
       
   891             }
       
   892         else if ( audioOutput == EPEHandset )
       
   893             {
       
   894             resourceId =  EPhoneCallHandlingCallSetupToIhfCBA;
       
   895             }
       
   896         else
       
   897             {
       
   898             resourceId = EPhoneCallHandlingCallSetupCBA;
       
   899             }
       
   900         TPhoneCmdParamInteger integerParam;
       
   901         integerParam.SetInteger(
       
   902                 CPhoneMainResourceResolver::Instance()->
       
   903                 ResolveResourceID( resourceId ) );
       
   904 
       
   905         iViewCommandHandle->ExecuteCommandL( EPhoneViewUpdateNoteSoftkeys,
       
   906                 &integerParam );
       
   907         }
       
   908     }
       
   909 
       
   910 // ---------------------------------------------------------
       
   911 // CPhoneEmergency::HandleCreateNumberEntryL
       
   912 //
       
   913 // ---------------------------------------------------------
       
   914 //
       
   915 void CPhoneEmergency::HandleCreateNumberEntryL( const TKeyEvent& aKeyEvent,
       
   916         TEventCode aEventCode )
       
   917     {
       
   918     __LOGMETHODSTARTEND( EPhoneControl, "CPhoneEmergency::HandleCreateNumberEntryL() ");
       
   919     if ( !iCallSetup && !iStartupInterrupted )
       
   920         {
       
   921         CPhoneGsmInCall::HandleCreateNumberEntryL( aKeyEvent, aEventCode );
       
   922         }
       
   923 
       
   924     }
       
   925 
   778 
   926 // -----------------------------------------------------------------------------
   779 // -----------------------------------------------------------------------------
   927 // CPhoneEmergency::HandleRemConCommandL
   780 // CPhoneEmergency::HandleRemConCommandL
   928 // -----------------------------------------------------------------------------
   781 // -----------------------------------------------------------------------------
   929 //
   782 //
   932     TRemConCoreApiButtonAction aButtonAct )
   785     TRemConCoreApiButtonAction aButtonAct )
   933     {
   786     {
   934     TBool handled = EFalse;
   787     TBool handled = EFalse;
   935 
   788 
   936     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneEmergency::MrccatoCommand() ");
   789     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneEmergency::MrccatoCommand() ");
   937 
   790     
   938     switch ( aOperationId )
   791     switch ( aOperationId )
   939         {
   792         {
   940          case ERemConCoreApiMute:
   793          case ERemConCoreApiMute:
   941              __PHONELOG( EBasic, EPhoneControl, "CPhoneEmergency::MrccatoCommand emerg. call no muting" );
   794              __PHONELOG( EBasic, EPhoneControl, "CPhoneEmergency::MrccatoCommand emerg. call no muting" );
   942              // Not Allowed
   795              // Not Allowed
   956     {
   809     {
   957     if ( FeatureManager::FeatureSupported ( KFeatureIdTouchCallHandling ) )
   810     if ( FeatureManager::FeatureSupported ( KFeatureIdTouchCallHandling ) )
   958         {
   811         {
   959         return ETrue;
   812         return ETrue;
   960         }
   813         }
   961     else
   814     else 
   962         {
   815         {
   963         return EFalse;
   816         return EFalse;
   964         }
   817         }
   965     }
   818     }
   966 
   819 
   968 // CPhoneEmergency::UseEmergencyNoIhfCBA
   821 // CPhoneEmergency::UseEmergencyNoIhfCBA
   969 // --------------------------------------------------------------
   822 // --------------------------------------------------------------
   970 //
   823 //
   971 TBool CPhoneEmergency::UseEmergencyNoIhfCBA( const TPEAudioOutput& aAudioOutput ) const
   824 TBool CPhoneEmergency::UseEmergencyNoIhfCBA( const TPEAudioOutput& aAudioOutput ) const
   972     {
   825     {
   973     if ( !( TouchCallHandlingSupported() )
   826     if ( !( TouchCallHandlingSupported() ) 
   974         && ( ( aAudioOutput == EPEWiredAudioAccessory ) || ( IsSwivelClosed() ) ) )
   827         && ( ( aAudioOutput == EPEWiredAudioAccessory ) || ( IsSwivelClosed() ) ) )
   975         {
   828         {
   976         return ETrue;
   829         return ETrue;
   977         }
   830         }
   978     else
   831     else 
   979         {
   832         {
   980         return EFalse;
   833         return EFalse;
   981         }
   834         }
   982     }
   835     }
   983 
   836 
   984 // --------------------------------------------------------------
   837 // --------------------------------------------------------------
   985 // CPhoneEmergency::UseHandsetEmergencyCBA
   838 // CPhoneEmergency::UseHandsetEmergencyCBA
   986 // --------------------------------------------------------------
   839 // --------------------------------------------------------------
   987 //
   840 //
   988 TBool CPhoneEmergency::UseHandsetEmergencyCBA( const TPEAudioOutput& aAudioOutput ) const
   841 TBool CPhoneEmergency::UseHandsetEmergencyCBA( const TPEAudioOutput& aAudioOutput ) const
   989     {
   842 {
   990     if ( !( TouchCallHandlingSupported() )
   843     if ( !( TouchCallHandlingSupported() ) 
   991         && ( ( aAudioOutput == EPELoudspeaker ) || ( aAudioOutput == EPEBTAudioAccessory ) ) )
   844         && ( ( aAudioOutput == EPELoudspeaker ) || ( aAudioOutput == EPEBTAudioAccessory ) ) )
   992         {
   845         {
   993         return ETrue;
   846         return ETrue;
   994         }
   847         }
   995     else
   848     else 
   996         {
   849         {
   997         return EFalse;
   850         return EFalse;
   998         }
   851         }
   999     }
   852 }
  1000 
       
  1001 // --------------------------------------------------------------
       
  1002 // CPhoneEmergency::HandlePhoneStartupL
       
  1003 // --------------------------------------------------------------
       
  1004 //
       
  1005 void CPhoneEmergency::HandlePhoneStartupL()
       
  1006     {
       
  1007     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneEmergency::HandlePhoneStartupL( ) ");
       
  1008     iStartupInterrupted = EFalse;
       
  1009     }
       
  1010 
   853 
  1011 // End of File
   854 // End of File