phoneapp/phoneuistates/src/cphoneemergency.cpp
changeset 72 c76a0b1755b9
parent 56 5bcb308bd24d
child 74 d1c62c765e48
equal deleted inserted replaced
64:6aaf0276100e 72:c76a0b1755b9
   193 // -----------------------------------------------------------
   193 // -----------------------------------------------------------
   194 //
   194 //
   195 void CPhoneEmergency::HandleIdleL( TInt aCallId )
   195 void CPhoneEmergency::HandleIdleL( TInt aCallId )
   196     {
   196     {
   197     __LOGMETHODSTARTEND(EPhoneUIStates, "CPhoneEmergency::HandleIdleL() ");
   197     __LOGMETHODSTARTEND(EPhoneUIStates, "CPhoneEmergency::HandleIdleL() ");
   198 
       
   199     // Re-enable global notes, this enables secui (if needed) to come on top
   198     // Re-enable global notes, this enables secui (if needed) to come on top
   200     // if call creation was rejected by user
   199     // if call creation was rejected by user
   201     TPhoneCmdParamBoolean globalNotifierParam;
   200     TPhoneCmdParamBoolean globalNotifierParam;
   202     globalNotifierParam.SetBoolean( EFalse );
   201     globalNotifierParam.SetBoolean( EFalse );
   203     iViewCommandHandle->ExecuteCommandL( EPhoneViewSetGlobalNotifiersDisabled,
   202     iViewCommandHandle->ExecuteCommandL( EPhoneViewSetGlobalNotifiersDisabled,
   213         captureParam.SetKeyCode( EKeyNo );
   212         captureParam.SetKeyCode( EKeyNo );
   214         iViewCommandHandle->ExecuteCommand( 
   213         iViewCommandHandle->ExecuteCommand( 
   215                 EPhoneViewStopCapturingKey, &captureParam );
   214                 EPhoneViewStopCapturingKey, &captureParam );
   216 
   215 
   217         const TBool isSimStateNotPresentWithSecurityMode = IsSimStateNotPresentWithSecurityModeEnabled();
   216         const TBool isSimStateNotPresentWithSecurityMode = IsSimStateNotPresentWithSecurityModeEnabled();
   218 
       
   219         // Sim IS not ok when making emergency call from Pin query, no note
   217         // Sim IS not ok when making emergency call from Pin query, no note
   220         if ( (!IsSimOk() && !iStartupInterrupted) || isSimStateNotPresentWithSecurityMode )
   218         if ( (!IsSimOk() && !iStartupInterrupted) || isSimStateNotPresentWithSecurityMode )
   221             {
   219             {
   222             StartShowSecurityNoteL();
   220             StartShowSecurityNoteL();
   223             }
   221             }
   228                 // Continue displaying current app but set up the
   226                 // Continue displaying current app but set up the
   229                 // idle screen in the background
   227                 // idle screen in the background
   230                 SetupIdleScreenInBackgroundL();
   228                 SetupIdleScreenInBackgroundL();
   231                 }
   229                 }
   232 
   230 
   233             else if ( iOnScreenDialer && IsNumberEntryContentStored() )
   231             else if ( IsNumberEntryContentStored() || IsNumberEntryUsedL() )
   234                 {
   232                 {
   235                 SetNumberEntryVisibilityL(ETrue);
   233                 SetNumberEntryVisibilityL(ETrue);
   236                 }
   234                 }
   237 
   235             
   238             else if ( IsNumberEntryUsedL() )
       
   239                 {
       
   240                 // Show the number entry if it exists
       
   241                 SetNumberEntryVisibilityL(ETrue);
       
   242                 }
       
   243 
       
   244             else
   236             else
   245                 {
   237                 {
   246                  // Display idle screen
       
   247                 DisplayIdleScreenL();
   238                 DisplayIdleScreenL();
   248                 }
   239                 }
   249 
   240 
   250             // Display call termination note, if necessary
       
   251             if ( iConnected )
   241             if ( iConnected )
   252                 {
   242                 {
   253                 DisplayCallTerminationNoteL();
   243                 DisplayCallTerminationNoteL();
   254                 }
   244                 }
   255             }
   245             }
   273             if ( ( !IsNumberEntryUsedL() ) && 
   263             if ( ( !IsNumberEntryUsedL() ) && 
   274                  !( IsSimStateNotPresentWithSecurityModeEnabled() && 
   264                  !( IsSimStateNotPresentWithSecurityModeEnabled() && 
   275                     !FeatureManager::FeatureSupported( KFeatureIdFfSimlessOfflineSupport ) ) )
   265                     !FeatureManager::FeatureSupported( KFeatureIdFfSimlessOfflineSupport ) ) )
   276                 {
   266                 {
   277                 UpdateCbaL( EPhoneEmptyCBA );
   267                 UpdateCbaL( EPhoneEmptyCBA );
   278                 
       
   279                 TPhoneCmdParamBoolean securityMode;
   268                 TPhoneCmdParamBoolean securityMode;
   280                 iViewCommandHandle->ExecuteCommandL( EPhoneViewGetSecurityModeStatus, &securityMode );
   269                 iViewCommandHandle->ExecuteCommandL( EPhoneViewGetSecurityModeStatus, &securityMode );
   281                 if ( !securityMode.Boolean() )
   270                 if ( !securityMode.Boolean() )
   282                     {
   271                     {
   283                     // Setup idle as next active app.
       
   284                     SetupIdleScreenInBackgroundL();
   272                     SetupIdleScreenInBackgroundL();
   285                     }
   273                     }
   286                 }
   274                 }
   287             
       
   288             iStateMachine->ChangeState( EPhoneStateIdle );
   275             iStateMachine->ChangeState( EPhoneStateIdle );
   289             }
   276             }
   290         }
   277         }
   291     else
   278     else
   292         {
   279         {
   293         iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveAllCallHeaders );
   280         iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveAllCallHeaders );
   294         }
   281         }
   295     }
   282     }
   296 
       
   297 
   283 
   298 // -----------------------------------------------------------
   284 // -----------------------------------------------------------
   299 // CPhoneEmergency::HandleDialingL
   285 // CPhoneEmergency::HandleDialingL
   300 // -----------------------------------------------------------
   286 // -----------------------------------------------------------
   301 //
   287 //
   306     // there could be a race condition between returning to Normal
   292     // there could be a race condition between returning to Normal
   307     // mode (receiving a network registration status message from PE)
   293     // mode (receiving a network registration status message from PE)
   308     // and receiving an EPEMessageDialling message. This can occur
   294     // and receiving an EPEMessageDialling message. This can occur
   309     // because PE messages are processed asynchronously.
   295     // because PE messages are processed asynchronously.
   310     __LOGMETHODSTARTEND(EPhoneUIStates, "CPhoneEmergency::HandleDialingL() ");
   296     __LOGMETHODSTARTEND(EPhoneUIStates, "CPhoneEmergency::HandleDialingL() ");
   311 
       
   312     if ( aCallId == KPEEmergencyCallId )
   297     if ( aCallId == KPEEmergencyCallId )
   313         {
   298         {
   314 
       
   315         iDeviceLockOn = IsAutoLockOn();
   299         iDeviceLockOn = IsAutoLockOn();
   316 
       
   317         // Disable global notes when the phone is dialling
       
   318         TPhoneCmdParamBoolean globalNotifierParam;
   300         TPhoneCmdParamBoolean globalNotifierParam;
   319         globalNotifierParam.SetBoolean( ETrue );
   301         globalNotifierParam.SetBoolean( ETrue );
   320         iViewCommandHandle->ExecuteCommandL(
   302         iViewCommandHandle->ExecuteCommandL(
   321             EPhoneViewSetGlobalNotifiersDisabled,
   303             EPhoneViewSetGlobalNotifiersDisabled,
   322             &globalNotifierParam );
   304             &globalNotifierParam );
   323 
   305 
   324         TPhoneCmdParamKeyCapture captureParam;
   306         TPhoneCmdParamKeyCapture captureParam;
   325         captureParam.SetKeyCode( EKeyNo );
   307         captureParam.SetKeyCode( EKeyNo );
   326         iViewCommandHandle->ExecuteCommand( EPhoneViewStartCapturingKey, &captureParam );
   308         iViewCommandHandle->ExecuteCommand( EPhoneViewStartCapturingKey, &captureParam );
   327         
   309         
   328         // Capture keys when the phone is dialling
       
   329         CaptureKeysDuringCallNotificationL( ETrue );
       
   330 
       
   331         // Indicate that the Phone needs to be sent to the background if
   310         // Indicate that the Phone needs to be sent to the background if
   332         // an application other than the top application is in the foreground
   311         // an application other than the top application is in the foreground
   333         TPhoneCmdParamBoolean booleanParam;
   312         TPhoneCmdParamBoolean booleanParam;
   334         booleanParam.SetBoolean( !TopAppIsDisplayedL() );
   313         booleanParam.SetBoolean( !TopAppIsDisplayedL() );
   335         iViewCommandHandle->ExecuteCommandL(
   314         iViewCommandHandle->ExecuteCommandL(
   336             EPhoneViewSetNeedToSendToBackgroundStatus,
   315             EPhoneViewSetNeedToSendToBackgroundStatus,
   337             &booleanParam );
   316             &booleanParam );
   338 
   317         
   339         // Bring Phone app in the foreground
       
   340         TPhoneCmdParamInteger uidParam;
   318         TPhoneCmdParamInteger uidParam;
   341         uidParam.SetInteger( KUidPhoneApplication.iUid );
   319         uidParam.SetInteger( KUidPhoneApplication.iUid );
   342         iViewCommandHandle->ExecuteCommandL( EPhoneViewBringAppToForeground,
   320         iViewCommandHandle->ExecuteCommandL( EPhoneViewBringAppToForeground,
   343             &uidParam );
   321             &uidParam );
   344 
       
   345         // Set Phone as the top application
       
   346         iViewCommandHandle->ExecuteCommandL( EPhoneViewSetTopApplication,
   322         iViewCommandHandle->ExecuteCommandL( EPhoneViewSetTopApplication,
   347             &uidParam );
   323             &uidParam );
   348 
       
   349         // Hide the number entry if it is visible
       
   350         if ( IsNumberEntryUsedL() )
   324         if ( IsNumberEntryUsedL() )
   351             {
   325             {
   352             // Remove number entry
   326             // Remove number entry
   353             iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveNumberEntry );
   327             iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveNumberEntry );
   354             }
   328             }
   357         iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveQuery );
   331         iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveQuery );
   358         
   332         
   359         BeginUiUpdateLC();
   333         BeginUiUpdateLC();
   360         
   334         
   361         TPhoneCmdParamEmergencyCallHeaderData emergencyHeaderParam;
   335         TPhoneCmdParamEmergencyCallHeaderData emergencyHeaderParam;
   362         // Set call header
       
   363         TBuf<KPhoneCallHeaderLabelMaxLength> headerText( KNullDesC );
   336         TBuf<KPhoneCallHeaderLabelMaxLength> headerText( KNullDesC );
   364         StringLoader::Load(
   337         StringLoader::Load(
   365             headerText,
   338             headerText,
   366             CPhoneMainResourceResolver::Instance()->ResolveResourceID(
   339             CPhoneMainResourceResolver::Instance()->ResolveResourceID(
   367                 EPhoneEmergencyCallHeader ),
   340                 EPhoneEmergencyCallHeader ),
   395             aCallId,
   368             aCallId,
   396             &headerParam );
   369             &headerParam );
   397 
   370 
   398         SetTouchPaneButtons( EPhoneEmergencyCallButtons );
   371         SetTouchPaneButtons( EPhoneEmergencyCallButtons );
   399         SetBackButtonActive(EFalse);
   372         SetBackButtonActive(EFalse);
   400         
   373         EndUiUpdate();
   401         EndUiUpdate();        
       
   402 
       
   403         // ShowNoteL( EPhoneEmergencyConnectWaitNote );
       
   404         UpdateSetupCbaL();
   374         UpdateSetupCbaL();
   405         }
   375         }
   406     }
   376     }
   407 // -----------------------------------------------------------
   377 // -----------------------------------------------------------
   408 // CPhoneEmergency::HandleConnectingL
   378 // CPhoneEmergency::HandleConnectingL
   409 // -----------------------------------------------------------
   379 // -----------------------------------------------------------
   410 //
   380 //
   411 void CPhoneEmergency::HandleConnectingL( TInt aCallId )
   381 void CPhoneEmergency::HandleConnectingL( TInt aCallId )
   412     {
   382     {
   413     __LOGMETHODSTARTEND(EPhoneUIStates, "CPhoneEmergency::HandleConnectingL() ");
   383     __LOGMETHODSTARTEND(EPhoneUIStates, "CPhoneEmergency::HandleConnectingL() ");
   414 
       
   415     iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveGlobalNote );
   384     iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveGlobalNote );
   416 
       
   417     // Re-enable global notes
       
   418     TPhoneCmdParamBoolean globalNotifierParam;
   385     TPhoneCmdParamBoolean globalNotifierParam;
   419     globalNotifierParam.SetBoolean( EFalse );
   386     globalNotifierParam.SetBoolean( EFalse );
   420     iViewCommandHandle->ExecuteCommandL( EPhoneViewSetGlobalNotifiersDisabled,
   387     iViewCommandHandle->ExecuteCommandL( EPhoneViewSetGlobalNotifiersDisabled,
   421         &globalNotifierParam );
   388         &globalNotifierParam );
   422     iViewCommandHandle->ExecuteCommandL( EPhoneViewSetEikonNotifiersDisabled,
   389     iViewCommandHandle->ExecuteCommandL( EPhoneViewSetEikonNotifiersDisabled,
   423           &globalNotifierParam );
   390           &globalNotifierParam );
   424 
   391     
   425     if(  TouchCallHandlingSupported() )
       
   426         {
       
   427         if ( !IsSimStateNotPresentWithSecurityModeEnabled() )
       
   428             {
       
   429             // Stop capturing keys
       
   430             CaptureKeysDuringCallNotificationL( EFalse );
       
   431             }
       
   432         }
       
   433     else if ( !iDeviceLockOn && SimState() == EPESimUsable )
       
   434         {
       
   435         // Stop capturing keys
       
   436         CaptureKeysDuringCallNotificationL( EFalse );
       
   437         }
       
   438 
       
   439     // Keep Phone in the foreground
       
   440     TPhoneCmdParamBoolean booleanParam;
   392     TPhoneCmdParamBoolean booleanParam;
   441     booleanParam.SetBoolean( EFalse );
   393     booleanParam.SetBoolean( EFalse );
   442     iViewCommandHandle->ExecuteCommandL(
   394     iViewCommandHandle->ExecuteCommandL(
   443         EPhoneViewSetNeedToSendToBackgroundStatus, &booleanParam );
   395         EPhoneViewSetNeedToSendToBackgroundStatus, &booleanParam );
   444 
   396     
   445     // Remove emergency connecting note
       
   446     iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveNote );
   397     iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveNote );
   447 
   398 
   448     TPhoneCmdParamCallHeaderData headerParam;
   399     TPhoneCmdParamCallHeaderData headerParam;
   449     headerParam.SetCallState( EPEStateConnecting );
   400     headerParam.SetCallState( EPEStateConnecting );
   450     // Notify the view
   401     // Notify the view
   452         EPhoneViewUpdateBubble,
   403         EPhoneViewUpdateBubble,
   453         aCallId,
   404         aCallId,
   454         &headerParam );
   405         &headerParam );
   455 
   406 
   456     SetToolbarButtonLoudspeakerEnabled();
   407     SetToolbarButtonLoudspeakerEnabled();
   457 
       
   458     UpdateInCallCbaL();
   408     UpdateInCallCbaL();
   459     }
   409     }
   460 
   410 
   461 // -----------------------------------------------------------
   411 // -----------------------------------------------------------
   462 // CPhoneEmergency::HandleConnectedL
   412 // CPhoneEmergency::HandleConnectedL
   463 // -----------------------------------------------------------
   413 // -----------------------------------------------------------
   464 //
   414 //
   465 void CPhoneEmergency::HandleConnectedL( TInt aCallId )
   415 void CPhoneEmergency::HandleConnectedL( TInt aCallId )
   466     {
   416     {
   467     __LOGMETHODSTARTEND(EPhoneUIStates, "CPhoneEmergency::HandleConnectedL() ");
   417     __LOGMETHODSTARTEND(EPhoneUIStates, "CPhoneEmergency::HandleConnectedL() ");
   468 
       
   469     BeginUiUpdateLC();
   418     BeginUiUpdateLC();
   470 
       
   471     TPhoneCmdParamCallHeaderData emergencyHeaderParam;
   419     TPhoneCmdParamCallHeaderData emergencyHeaderParam;
   472     emergencyHeaderParam.SetCallState( EPEStateConnected );
   420     emergencyHeaderParam.SetCallState( EPEStateConnected );
   473     // Notify the view
       
   474     iViewCommandHandle->ExecuteCommandL(
   421     iViewCommandHandle->ExecuteCommandL(
   475         EPhoneViewUpdateBubble,
   422         EPhoneViewUpdateBubble,
   476         aCallId,
   423         aCallId,
   477         &emergencyHeaderParam );
   424         &emergencyHeaderParam );
   478 
       
   479     SetBackButtonActive(ETrue);
   425     SetBackButtonActive(ETrue);
   480 
       
   481     EndUiUpdate();
   426     EndUiUpdate();
   482     UpdateInCallCbaL();
   427     UpdateInCallCbaL();
   483     }
   428     }
   484 
   429 
   485 // -----------------------------------------------------------
   430 // -----------------------------------------------------------
   487 // -----------------------------------------------------------
   432 // -----------------------------------------------------------
   488 //
   433 //
   489 void CPhoneEmergency::UpdateInCallCbaL()
   434 void CPhoneEmergency::UpdateInCallCbaL()
   490     {
   435     {
   491     __LOGMETHODSTARTEND(EPhoneUIStates, "CPhoneEmergency::UpdateInCallCbaL() ");
   436     __LOGMETHODSTARTEND(EPhoneUIStates, "CPhoneEmergency::UpdateInCallCbaL() ");
   492     TInt resourceId = EPhoneCallHandlingEmergencyCBA;
   437     iCbaManager->SetCbaL( EPhoneCallHandlingEmergencyCBA );
   493     iCbaManager->SetCbaL( resourceId );
       
   494     }
   438     }
   495 
   439 
   496 // --------------------------------------------------------------
   440 // --------------------------------------------------------------
   497 // CPhoneEmergency::HandleKeyMessageL
   441 // CPhoneEmergency::HandleKeyMessageL
   498 // --------------------------------------------------------------
   442 // --------------------------------------------------------------
   500 void CPhoneEmergency::HandleKeyMessageL(
   444 void CPhoneEmergency::HandleKeyMessageL(
   501     TPhoneKeyEventMessages aMessage,
   445     TPhoneKeyEventMessages aMessage,
   502     TKeyCode aCode )
   446     TKeyCode aCode )
   503     {
   447     {
   504     __LOGMETHODSTARTEND(EPhoneUIStates, "CPhoneEmergency::HandleKeyMessageL()");
   448     __LOGMETHODSTARTEND(EPhoneUIStates, "CPhoneEmergency::HandleKeyMessageL()");
   505 
       
   506     switch ( aCode )
   449     switch ( aCode )
   507         {
   450         {
   508         // end-key
   451         case EKeyNo: // end-key
   509         case EKeyNo:
       
   510             // handle end key
       
   511             DisconnectEmergencyCallL();
   452             DisconnectEmergencyCallL();
   512             break;
   453             break;
   513 
   454 
   514         // send-key
   455         case EKeyYes: // send-key
   515         case EKeyYes:
   456              if( IsNumberEntryVisibleL() )
   516              if( iOnScreenDialer && IsNumberEntryVisibleL() )
       
   517                 {
   457                 {
   518                 TPhoneCmdParamInteger numberEntryCountParam;
   458                 TPhoneCmdParamInteger numberEntryCountParam;
   519                     iViewCommandHandle->ExecuteCommandL( EPhoneViewGetNumberEntryCount,
   459                     iViewCommandHandle->ExecuteCommandL( 
       
   460                             EPhoneViewGetNumberEntryCount,
   520                             &numberEntryCountParam );
   461                             &numberEntryCountParam );
   521                     TInt neLength( numberEntryCountParam.Integer() );
   462                 TInt neLength( numberEntryCountParam.Integer() );
   522                 if ( neLength )
   463                 if ( neLength )
   523                     {
   464                     {
   524                     // Show not allowed note
       
   525                     SendGlobalErrorNoteL( EPhoneNoteTextNotAllowed, ETrue );
   465                     SendGlobalErrorNoteL( EPhoneNoteTextNotAllowed, ETrue );
   526                     }
   466                     }
   527                 else
   467                 else
   528                     {
   468                     {
   529                     // Logs to open
       
   530                     CallFromNumberEntryL();
   469                     CallFromNumberEntryL();
   531                     }
   470                     }
   532                 }
   471                 }
   533             else
   472             else
   534                 {
   473                 {
   535                 // Show not allowed note
       
   536                 SendGlobalErrorNoteL( EPhoneNoteTextNotAllowed, ETrue );
   474                 SendGlobalErrorNoteL( EPhoneNoteTextNotAllowed, ETrue );
   537                 }
   475                 }
   538             break;
   476             break;
   539 
   477 
   540         default:
   478         default:
   541             {
   479             {
   542             if ( TouchCallHandlingSupported() )
   480             CPhoneGsmInCall::HandleKeyMessageL( aMessage, aCode );
   543                 {
       
   544                 CPhoneGsmInCall::HandleKeyMessageL( aMessage, aCode ); 
       
   545                 }
       
   546             else if ( !iDeviceLockOn && SimState() == EPESimUsable )   
       
   547                 {
       
   548                 // do base operation
       
   549                 CPhoneGsmInCall::HandleKeyMessageL( aMessage, aCode );
       
   550                 }
       
   551             break;
   481             break;
   552             }
   482             }
   553         }
   483         }
   554     }
   484     }
   555 
   485 
   559 //
   489 //
   560 TBool CPhoneEmergency::HandleCommandL( TInt aCommand )
   490 TBool CPhoneEmergency::HandleCommandL( TInt aCommand )
   561     {
   491     {
   562     __LOGMETHODSTARTEND(EPhoneUIStates, "CPhoneEmergency::HandleCommandL()");
   492     __LOGMETHODSTARTEND(EPhoneUIStates, "CPhoneEmergency::HandleCommandL()");
   563     TBool commandStatus = ETrue;
   493     TBool commandStatus = ETrue;
   564 
       
   565     switch( aCommand )
   494     switch( aCommand )
   566         {
   495         {
   567         case EPhoneInCallCmdDtmfManualQuery:
   496         case EPhoneInCallCmdDtmfManualQuery:
   568             if ( iStateMachine->PhoneEngineInfo()->CallState( KPEEmergencyCallId ) == EPEStateDialing )
   497             if ( iStateMachine->PhoneEngineInfo()->CallState( KPEEmergencyCallId ) == EPEStateDialing )
   569                 {
   498                 {
   576         case EPhoneDtmfDialerExit:      // fall through
   505         case EPhoneDtmfDialerExit:      // fall through
   577         case EPhoneDtmfDialerCancel:
   506         case EPhoneDtmfDialerCancel:
   578              {
   507              {
   579              if ( iStateMachine->PhoneEngineInfo()->CallState( KPEEmergencyCallId ) == EPEStateDialing )
   508              if ( iStateMachine->PhoneEngineInfo()->CallState( KPEEmergencyCallId ) == EPEStateDialing )
   580                  {
   509                  {
   581 
       
   582                  UpdateSetupCbaL();
   510                  UpdateSetupCbaL();
   583                  }
   511                  }
   584              else
   512              else
   585                  {
   513                  {
   586                  commandStatus = CPhoneGsmInCall::HandleCommandL( aCommand );
   514                  commandStatus = CPhoneGsmInCall::HandleCommandL( aCommand );
   595 
   523 
   596         default:
   524         default:
   597             commandStatus = CPhoneGsmInCall::HandleCommandL( aCommand );
   525             commandStatus = CPhoneGsmInCall::HandleCommandL( aCommand );
   598             break;
   526             break;
   599         }
   527         }
   600 
       
   601     return commandStatus;
   528     return commandStatus;
   602     }
   529     }
   603 
   530 
   604 // -----------------------------------------------------------
   531 // -----------------------------------------------------------
   605 // CPhoneEmergency::DisconnectEmergencyCallL
   532 // CPhoneEmergency::DisconnectEmergencyCallL
   607 //
   534 //
   608 void CPhoneEmergency::DisconnectEmergencyCallL()
   535 void CPhoneEmergency::DisconnectEmergencyCallL()
   609     {
   536     {
   610     __LOGMETHODSTARTEND(EPhoneUIStates,
   537     __LOGMETHODSTARTEND(EPhoneUIStates,
   611         "CPhoneEmergency::DisconnectEmergencyCallL()");
   538         "CPhoneEmergency::DisconnectEmergencyCallL()");
   612     // Release the call
   539     iStateMachine->SetCallId( KEmergencyCallId );
   613     iStateMachine->SetCallId(
       
   614         KEmergencyCallId );
       
   615     iStateMachine->SendPhoneEngineMessage(
   540     iStateMachine->SendPhoneEngineMessage(
   616         CPEPhoneModelIF::EPEMessageRelease );
   541         CPEPhoneModelIF::EPEMessageRelease );
   617     }
   542     }
   618 
   543 
   619 // -----------------------------------------------------------
   544 // -----------------------------------------------------------
   663 void CPhoneEmergency::HandleKeyEventL(
   588 void CPhoneEmergency::HandleKeyEventL(
   664     const TKeyEvent& aKeyEvent,
   589     const TKeyEvent& aKeyEvent,
   665     TEventCode aEventCode )
   590     TEventCode aEventCode )
   666     {
   591     {
   667     __LOGMETHODSTARTEND(EPhoneUIStates, "CPhoneEmergency::HandleKeyEventL( ) ");
   592     __LOGMETHODSTARTEND(EPhoneUIStates, "CPhoneEmergency::HandleKeyEventL( ) ");
   668     
   593     CPhoneState::HandleKeyEventL( aKeyEvent, aEventCode );
   669     if ( TouchCallHandlingSupported() )
       
   670         {
       
   671         CPhoneState::HandleKeyEventL( aKeyEvent, aEventCode );
       
   672         }
       
   673     else
       
   674         {
       
   675          if ( iDeviceLockOn && CPhoneKeys::IsNumericKey( aKeyEvent, aEventCode ) )
       
   676             {
       
   677             // Send the key event to the phone engine
       
   678             SendKeyEventL( aKeyEvent, aEventCode );
       
   679             }
       
   680         else
       
   681             {
       
   682             // Handle numeric keys when key events are received in idle state
       
   683             CPhoneState::HandleKeyEventL( aKeyEvent, aEventCode );
       
   684             }
       
   685         }
       
   686     }
   594     }
   687 
   595 
   688 // -----------------------------------------------------------
   596 // -----------------------------------------------------------
   689 // CPhoneEmergency::SendKeyEventL
   597 // CPhoneEmergency::SendKeyEventL
   690 // -----------------------------------------------------------
   598 // -----------------------------------------------------------
   694     TEventCode aEventCode )
   602     TEventCode aEventCode )
   695     {
   603     {
   696     __LOGMETHODSTARTEND(EPhoneUIStates, "CPhoneEmergency::SendKeyEventL( ) ");
   604     __LOGMETHODSTARTEND(EPhoneUIStates, "CPhoneEmergency::SendKeyEventL( ) ");
   697     switch( aEventCode )
   605     switch( aEventCode )
   698         {
   606         {
   699         // EEventKey
       
   700         case EEventKey:
   607         case EEventKey:
   701             {
   608             {
   702             // Convert key code to western.
   609             // Convert key code to western.
   703             TBuf<1> buffer; // one character
   610             TBuf<1> buffer; // one character
   704             buffer.Append( aKeyEvent.iCode );
   611             buffer.Append( aKeyEvent.iCode );
   710                 "CPhoneEmergency::SendKeyEventL(%S)",
   617                 "CPhoneEmergency::SendKeyEventL(%S)",
   711                 &buffer );
   618                 &buffer );
   712             TLex code( buffer );
   619             TLex code( buffer );
   713             // Save the key code
   620             // Save the key code
   714             iStateMachine->PhoneEngineInfo()->SetKeyCode( code.Peek() );
   621             iStateMachine->PhoneEngineInfo()->SetKeyCode( code.Peek() );
   715             // Plays a DTMF tone if active call
       
   716             iStateMachine->SendPhoneEngineMessage(
   622             iStateMachine->SendPhoneEngineMessage(
   717                 CPEPhoneModelIF::EPEMessagePlayDTMF );
   623                 CPEPhoneModelIF::EPEMessagePlayDTMF );
   718             }
   624             }
   719             break;
   625             break;
   720         // EEventKeyUp
       
   721         case EEventKeyUp:
   626         case EEventKeyUp:
   722             // Send a key up event for the last key code sent to
   627             // Send a key up event for the last key code sent to
   723             // the phone engine
   628             // the phone engine
   724             iStateMachine->SendPhoneEngineMessage(
   629             iStateMachine->SendPhoneEngineMessage(
   725                 CPEPhoneModelIF::EPEMessageEndDTMF );
   630                 CPEPhoneModelIF::EPEMessageEndDTMF );
   735 // -----------------------------------------------------------------------------
   640 // -----------------------------------------------------------------------------
   736 //
   641 //
   737 void CPhoneEmergency::HandleAudioOutputChangedL()
   642 void CPhoneEmergency::HandleAudioOutputChangedL()
   738     {
   643     {
   739     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneEmergency::HandleAudioOutputChangedL( ) ");
   644     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneEmergency::HandleAudioOutputChangedL( ) ");
   740 
       
   741     // Audio Output
       
   742     TPhoneCmdParamAudioOutput outputParam;
       
   743 
       
   744     // Output
       
   745     const TPEAudioOutput audioOutput =
       
   746         iStateMachine->PhoneEngineInfo()->AudioOutput();
       
   747 
       
   748     UpdateSetupCbaL();
   645     UpdateSetupCbaL();
   749     SetTouchPaneButtons(0);
   646     SetTouchPaneButtons(0);
   750     
   647     TPhoneCmdParamAudioOutput outputParam;
   751     // view update
   648     outputParam.SetAudioOutput( 
   752     outputParam.SetAudioOutput( audioOutput );
   649             iStateMachine->PhoneEngineInfo()->AudioOutput() );
   753     iViewCommandHandle->ExecuteCommandL( EPhoneViewActivateAudioPathUIChanges,
   650     iViewCommandHandle->ExecuteCommandL( 
   754         &outputParam );
   651             EPhoneViewActivateAudioPathUIChanges,
   755 
   652             &outputParam );
   756     }
   653     }
   757 
   654 
   758 // -----------------------------------------------------------------------------
   655 // -----------------------------------------------------------------------------
   759 // CPhoneEmergency::SetStartupInterrupted
   656 // CPhoneEmergency::SetStartupInterrupted
   760 // -----------------------------------------------------------------------------
   657 // -----------------------------------------------------------------------------
   769 // -----------------------------------------------------------
   666 // -----------------------------------------------------------
   770 //
   667 //
   771 void CPhoneEmergency::UpdateSetupCbaL()
   668 void CPhoneEmergency::UpdateSetupCbaL()
   772     {
   669     {
   773     __LOGMETHODSTARTEND(EPhoneUIStates, "CPhoneEmergency::UpdateSetupCbaL() ");
   670     __LOGMETHODSTARTEND(EPhoneUIStates, "CPhoneEmergency::UpdateSetupCbaL() ");
   774    TInt resourceId = EPhoneCallHandlingEmergencyCBA;        
   671    iCbaManager->SetCbaL( EPhoneCallHandlingEmergencyCBA );
   775    iCbaManager->SetCbaL( resourceId );
   672     }
   776     }
       
   777 
       
   778 
   673 
   779 // -----------------------------------------------------------------------------
   674 // -----------------------------------------------------------------------------
   780 // CPhoneEmergency::HandleRemConCommandL
   675 // CPhoneEmergency::HandleRemConCommandL
   781 // -----------------------------------------------------------------------------
   676 // -----------------------------------------------------------------------------
   782 //
   677 //
   783 EXPORT_C TBool CPhoneEmergency::HandleRemConCommandL(
   678 EXPORT_C TBool CPhoneEmergency::HandleRemConCommandL(
   784     TRemConCoreApiOperationId aOperationId,
   679     TRemConCoreApiOperationId aOperationId,
   785     TRemConCoreApiButtonAction aButtonAct )
   680     TRemConCoreApiButtonAction aButtonAct )
   786     {
   681     {
       
   682     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneEmergency::MrccatoCommand() ");
   787     TBool handled = EFalse;
   683     TBool handled = EFalse;
   788 
       
   789     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneEmergency::MrccatoCommand() ");
       
   790     
       
   791     switch ( aOperationId )
   684     switch ( aOperationId )
   792         {
   685         {
   793          case ERemConCoreApiMute:
   686          case ERemConCoreApiMute:
   794              __PHONELOG( EBasic, EPhoneControl, "CPhoneEmergency::MrccatoCommand emerg. call no muting" );
   687              __PHONELOG( EBasic, EPhoneControl, "CPhoneEmergency::MrccatoCommand emerg. call no muting" );
   795              // Not Allowed
   688              // Not Allowed
   799              break;
   692              break;
   800         }
   693         }
   801     return handled;
   694     return handled;
   802     }
   695     }
   803 
   696 
   804 // --------------------------------------------------------------
       
   805 // CPhoneEmergency::TouchCallHandlingSupported
       
   806 // --------------------------------------------------------------
       
   807 //
       
   808 TBool CPhoneEmergency::TouchCallHandlingSupported () const
       
   809     {
       
   810     if ( FeatureManager::FeatureSupported ( KFeatureIdTouchCallHandling ) )
       
   811         {
       
   812         return ETrue;
       
   813         }
       
   814     else 
       
   815         {
       
   816         return EFalse;
       
   817         }
       
   818     }
       
   819 
       
   820 // --------------------------------------------------------------
       
   821 // CPhoneEmergency::UseEmergencyNoIhfCBA
       
   822 // --------------------------------------------------------------
       
   823 //
       
   824 TBool CPhoneEmergency::UseEmergencyNoIhfCBA( const TPEAudioOutput& aAudioOutput ) const
       
   825     {
       
   826     if ( !( TouchCallHandlingSupported() ) 
       
   827         && ( ( aAudioOutput == EPEWiredAudioAccessory ) || ( IsSwivelClosed() ) ) )
       
   828         {
       
   829         return ETrue;
       
   830         }
       
   831     else 
       
   832         {
       
   833         return EFalse;
       
   834         }
       
   835     }
       
   836 
       
   837 // --------------------------------------------------------------
       
   838 // CPhoneEmergency::UseHandsetEmergencyCBA
       
   839 // --------------------------------------------------------------
       
   840 //
       
   841 TBool CPhoneEmergency::UseHandsetEmergencyCBA( const TPEAudioOutput& aAudioOutput ) const
       
   842 {
       
   843     if ( !( TouchCallHandlingSupported() ) 
       
   844         && ( ( aAudioOutput == EPELoudspeaker ) || ( aAudioOutput == EPEBTAudioAccessory ) ) )
       
   845         {
       
   846         return ETrue;
       
   847         }
       
   848     else 
       
   849         {
       
   850         return EFalse;
       
   851         }
       
   852 }
       
   853 
       
   854 // End of File
   697 // End of File