phoneapp/phoneuicontrol/src/cphonestate.cpp
branchGCC_SURGE
changeset 51 f39ed5e045e0
parent 30 ebdbd102c78a
parent 46 bc5a64e5bc3c
equal deleted inserted replaced
40:bab96b7ed1a4 51:f39ed5e045e0
    50 #include <MediatorDomainUIDs.h>
    50 #include <MediatorDomainUIDs.h>
    51 #include <videotelcontrolmediatorapi.h>
    51 #include <videotelcontrolmediatorapi.h>
    52 #include <textresolver.h>
    52 #include <textresolver.h>
    53 #include <phoneappvoipcommands.hrh>
    53 #include <phoneappvoipcommands.hrh>
    54 #include <hwrmdomainpskeys.h>
    54 #include <hwrmdomainpskeys.h>
       
    55 #include <hal.h>
    55 
    56 
    56 #include "phoneui.pan"
    57 #include "phoneui.pan"
    57 #include "cphonestate.h"
    58 #include "cphonestate.h"
    58 #include "mphonestatemachine.h"
    59 #include "mphonestatemachine.h"
    59 #include "mphoneviewcommandhandle.h"
    60 #include "mphoneviewcommandhandle.h"
   186 
   187 
   187         case MEngineMonitor::EPEMessageAudioOutputChanged:
   188         case MEngineMonitor::EPEMessageAudioOutputChanged:
   188             HandleAudioOutputChangedL();
   189             HandleAudioOutputChangedL();
   189             // Go to current state implementation
   190             // Go to current state implementation
   190             iCbaManager->UpdateInCallCbaL();
   191             iCbaManager->UpdateInCallCbaL();
       
   192             SetTouchPaneButtons(0);
   191             break;
   193             break;
   192 
   194 
   193         case MEngineMonitor::EPEMessageAvailableAudioOutputsChanged:
   195         case MEngineMonitor::EPEMessageAvailableAudioOutputsChanged:
   194             HandleAudioAvailableOutputChangedL();
   196             HandleAudioAvailableOutputChangedL();
   195             if ( iStateMachine->PhoneEngineInfo()->AudioOutput() != EPENotActive )
   197             if ( iStateMachine->PhoneEngineInfo()->AudioOutput() != EPENotActive )
   196                 {
   198                 {
   197                 // Go to current state implementation
   199                 // Go to current state implementation
   198                 iCbaManager->UpdateInCallCbaL();
   200                 iCbaManager->UpdateInCallCbaL();
       
   201                 SetTouchPaneButtons(0);
   199                 }
   202                 }
   200             break;
   203             break;
   201 
   204 
   202         case MEngineMonitor::EPEMessageChangedCallDuration:
   205         case MEngineMonitor::EPEMessageChangedCallDuration:
   203             HandleChangedCallDurationL( aCallId );
   206             HandleChangedCallDurationL( aCallId );
   206         case MEngineMonitor::EPEMessageRemoteBusy:
   209         case MEngineMonitor::EPEMessageRemoteBusy:
   207             HandleRemoteBusyL( aCallId );
   210             HandleRemoteBusyL( aCallId );
   208             break;
   211             break;
   209 
   212 
   210         case MEngineMonitor::EPEMessageCallWaiting:
   213         case MEngineMonitor::EPEMessageCallWaiting:
   211             SendGlobalInfoNoteL( EPhoneWaitingText );
   214             // No need to send waiting notification for user.
       
   215             //SendGlobalInfoNoteL( EPhoneWaitingText, ETrue );
   212             break;
   216             break;
   213 
   217 
   214         case MEngineMonitor::EPEMessageProfileChanged:
   218         case MEngineMonitor::EPEMessageProfileChanged:
   215             {
   219             {
   216             TPhoneCmdParamBoolean keypadVolumeParam;
   220             TPhoneCmdParamBoolean keypadVolumeParam;
   233         case MEngineMonitor::EPEMessageDisconnecting:
   237         case MEngineMonitor::EPEMessageDisconnecting:
   234             HandleDisconnectingL( aCallId );
   238             HandleDisconnectingL( aCallId );
   235             break;
   239             break;
   236 
   240 
   237         case MEngineMonitor::EPEMessageTransferDone:
   241         case MEngineMonitor::EPEMessageTransferDone:
   238             SendGlobalInfoNoteL( EPhoneInCallTransferred );
   242             SendGlobalInfoNoteL( EPhoneInCallTransferred, ETrue );
   239             break;
   243             break;
   240 
   244 
   241        case MEngineMonitor::EPEMessageInitiatedEmergencyCall:
   245        case MEngineMonitor::EPEMessageInitiatedEmergencyCall:
   242             HandleInitiatedEmergencyCallL( aCallId );
   246             HandleInitiatedEmergencyCallL( aCallId );
   243             break;
   247             break;
   244 
   248 
   245        case MEngineMonitor::EPEMessageInitiatedEmergencyWhileActiveVideo:
   249        case MEngineMonitor::EPEMessageInitiatedEmergencyWhileActiveVideo:
   246            HandleInitiatedEmergencyWhileActiveVideoL();
   250            HandleInitiatedEmergencyWhileActiveVideoL();
   247            break;
   251            break;
   248 
   252 
   249         case MEngineMonitor::EPEMessageShowIMEI:
   253        case MEngineMonitor::EPEMessageCallSecureStatusChanged:
   250             // Stop playing DTMF tone
   254            HandleCallSecureStatusChangeL( aCallId );
   251             iStateMachine->SendPhoneEngineMessage( MPEPhoneModel::EPEMessageEndDTMF );
   255 
   252             HandleShowImeiL();
   256            if ( iCustomization )
   253             break;
   257                {
   254 
   258                iCustomization->HandlePhoneEngineMessageL( aMessage,
   255         case MEngineMonitor::EPEMessageCallSecureStatusChanged:
   259                    aCallId );
   256             HandleCallSecureStatusChangeL( aCallId );
   260                }
   257 
   261            break;
   258             if ( iCustomization )
       
   259                 {
       
   260                 iCustomization->HandlePhoneEngineMessageL( aMessage,
       
   261                     aCallId );
       
   262                 }
       
   263             break;
       
   264 
       
   265         case MEngineMonitor::EPEMessageActivateWarrantyMode:
       
   266             // Stop playing DTMF tone
       
   267             iStateMachine->SendPhoneEngineMessage( MPEPhoneModel::EPEMessageEndDTMF );
       
   268             HandleShowLifeTimerL();
       
   269             break;
       
   270 
   262 
   271         case MEngineMonitor::EPEMessageIssuingUSSDRequest:
   263         case MEngineMonitor::EPEMessageIssuingUSSDRequest:
   272             {
   264             {
   273              // Enable global notes
   265              // Enable global notes
   274             TPhoneCmdParamBoolean globalNotifierParam;
   266             TPhoneCmdParamBoolean globalNotifierParam;
   363 
   355 
   364         case MEngineMonitor::EPEMessageShowIncCallGroupIndex:
   356         case MEngineMonitor::EPEMessageShowIncCallGroupIndex:
   365             HandleCugInUseNoteL();
   357             HandleCugInUseNoteL();
   366             break;
   358             break;
   367 
   359 
   368         // *#2873#
       
   369         case MEngineMonitor::EPEMessageBTDebugMode:
       
   370             accessoryBtHandler = CPhoneAccessoryBTHandler::NewLC(
       
   371                 iViewCommandHandle, iStateMachine, this );
       
   372             accessoryBtHandler->SetBTDebugModeL();
       
   373             CleanupStack::PopAndDestroy( accessoryBtHandler );
       
   374             break;
       
   375 
       
   376         default:
   360         default:
   377 
   361 
   378             TBool handled( EFalse );
   362             TBool handled( EFalse );
   379 
   363 
   380             if ( iCustomization )
   364             if ( iCustomization )
   413     TPhoneCmdParamBoolean booleanParam;
   397     TPhoneCmdParamBoolean booleanParam;
   414     const TBool audioMute = iStateMachine->PhoneEngineInfo()->AudioMute();
   398     const TBool audioMute = iStateMachine->PhoneEngineInfo()->AudioMute();
   415     booleanParam.SetBoolean( audioMute );
   399     booleanParam.SetBoolean( audioMute );
   416     iViewCommandHandle->ExecuteCommandL( EPhoneViewActivateMuteUIChanges,
   400     iViewCommandHandle->ExecuteCommandL( EPhoneViewActivateMuteUIChanges,
   417         &booleanParam );
   401         &booleanParam );
       
   402     
       
   403     SetTouchPaneButtons(0);
   418     }
   404     }
   419 
   405 
   420 // -----------------------------------------------------------
   406 // -----------------------------------------------------------
   421 // CPhoneState::HandleAudioOutputChangedL
   407 // CPhoneState::HandleAudioOutputChangedL
   422 // Default handling for EPEMessageAudioOutputChanged message
   408 // Default handling for EPEMessageAudioOutputChanged message
   823 // (other items were commented in a header).
   809 // (other items were commented in a header).
   824 // -----------------------------------------------------------
   810 // -----------------------------------------------------------
   825 void CPhoneState::HandleChangedCallDurationL( TInt aCallId )
   811 void CPhoneState::HandleChangedCallDurationL( TInt aCallId )
   826     {
   812     {
   827      __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::HandleChangedCallDurationL() ");
   813      __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::HandleChangedCallDurationL() ");
   828     // Get the call duration
   814     
   829     TTimeIntervalSeconds seconds =
   815     TInt ret = KErrNone;
   830         iStateMachine->PhoneEngineInfo()->CallDuration( aCallId );
   816     TInt isDisplayOn;
   831 
   817     
   832     TPhoneCmdParamInteger time;
   818     ret = HAL::Get( HALData::EDisplayState, isDisplayOn );
   833     time.SetInteger(seconds.Int());
   819     
   834     iViewCommandHandle->ExecuteCommandL(EPhoneViewUpdateCallHeaderCallDuration, aCallId, &time);
   820     // Update only if the display is on or if HAL::Get returns an error, 
   835     }
   821     // in which case display value cannot be trusted.
       
   822     if ( ret || isDisplayOn )
       
   823         {
       
   824         // Get the call duration
       
   825         TTimeIntervalSeconds seconds =
       
   826             iStateMachine->PhoneEngineInfo()->CallDuration( aCallId );
       
   827 
       
   828         TPhoneCmdParamInteger time;
       
   829         time.SetInteger(seconds.Int());
       
   830         iViewCommandHandle->ExecuteCommandL(EPhoneViewUpdateCallHeaderCallDuration, aCallId, &time);
       
   831         }
       
   832     }	
   836 
   833 
   837 // -----------------------------------------------------------------------------
   834 // -----------------------------------------------------------------------------
   838 // CPhoneState::HandleRemoteBusyL
   835 // CPhoneState::HandleRemoteBusyL
   839 // -----------------------------------------------------------------------------
   836 // -----------------------------------------------------------------------------
   840 //
   837 //
   841 void CPhoneState::HandleRemoteBusyL( TInt aCallId )
   838 void CPhoneState::HandleRemoteBusyL( TInt aCallId )
   842     {
   839     {
   843     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::HandleRemoteBusyL( ) ");
   840     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::HandleRemoteBusyL( ) ");
   844     ShowNumberBusyNoteL();
   841 
   845 
   842     TPEErrorInfo info;
       
   843     info.iCallId = aCallId;
       
   844     info.iErrorCode = ECCPErrorBusy;
       
   845     info.iErrorType = EPECcp;
       
   846     CPhoneMainErrorMessagesHandler::Instance()->ShowErrorSpecificNoteL( info );
       
   847     
   846     const TPECallType callType =
   848     const TPECallType callType =
   847         iStateMachine->PhoneEngineInfo()->CallTypeCommand();
   849         iStateMachine->PhoneEngineInfo()->CallTypeCommand();
   848 
   850 
   849     if( callType == EPECallTypeVideo )
   851     if( callType == EPECallTypeVideo )
   850         {
   852         {
  1771 
  1773 
  1772     TPEAudioOutput output( iStateMachine->PhoneEngineInfo()->AudioOutput() );
  1774     TPEAudioOutput output( iStateMachine->PhoneEngineInfo()->AudioOutput() );
  1773      __PHONELOG1( EBasic, EPhoneControl, "CPhoneState::DecreaseAudioVolumeL - audio output =%d", output );
  1775      __PHONELOG1( EBasic, EPhoneControl, "CPhoneState::DecreaseAudioVolumeL - audio output =%d", output );
  1774     if( output == EPETTY )
  1776     if( output == EPETTY )
  1775         {
  1777         {
  1776         SendGlobalInfoNoteL( EPhoneNoteTTYNoAudioControl );
  1778         SendGlobalInfoNoteL( EPhoneNoteTTYNoAudioControl, ETrue );
  1777         }
  1779         }
  1778     else
  1780     else
  1779         {
  1781         {
  1780         TInt audioVolume( iStateMachine->PhoneEngineInfo()->AudioVolume() );
  1782         TInt audioVolume( iStateMachine->PhoneEngineInfo()->AudioVolume() );
  1781         audioVolume--;
  1783         audioVolume--;
  1795 
  1797 
  1796     TPEAudioOutput output( iStateMachine->PhoneEngineInfo()->AudioOutput() );
  1798     TPEAudioOutput output( iStateMachine->PhoneEngineInfo()->AudioOutput() );
  1797      __PHONELOG1( EBasic, EPhoneControl, "CPhoneState::IncreaseAudioVolumeL - audio output =%d", output );
  1799      __PHONELOG1( EBasic, EPhoneControl, "CPhoneState::IncreaseAudioVolumeL - audio output =%d", output );
  1798     if( output == EPETTY )
  1800     if( output == EPETTY )
  1799         {
  1801         {
  1800         SendGlobalInfoNoteL( EPhoneNoteTTYNoAudioControl );
  1802         SendGlobalInfoNoteL( EPhoneNoteTTYNoAudioControl, ETrue );
  1801         }
  1803         }
  1802     else
  1804     else
  1803         {
  1805         {
  1804         TInt audioVolume( iStateMachine->PhoneEngineInfo()->AudioVolume() );
  1806         TInt audioVolume( iStateMachine->PhoneEngineInfo()->AudioVolume() );
  1805         audioVolume++;
  1807         audioVolume++;
  2150 // -----------------------------------------------------------
  2152 // -----------------------------------------------------------
  2151 // CPhoneState::CaptureKeysDuringCallNotificationL
  2153 // CPhoneState::CaptureKeysDuringCallNotificationL
  2152 // -----------------------------------------------------------
  2154 // -----------------------------------------------------------
  2153 //
  2155 //
  2154 EXPORT_C void CPhoneState::CaptureKeysDuringCallNotificationL(
  2156 EXPORT_C void CPhoneState::CaptureKeysDuringCallNotificationL(
  2155     TBool aCaptured )
  2157     TBool /*aCaptured*/ )
  2156     {
  2158     {
  2157     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::CaptureKeysDuringCallNotificationL( ) ");
  2159     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::CaptureKeysDuringCallNotificationL( ) ");
  2158     // Determine which view command to execute based on the capture status
  2160     // Determine which view command to execute based on the capture status
  2159     const TInt viewCommandId = aCaptured ?
  2161     /*const TInt viewCommandId = aCaptured ?
  2160         EPhoneViewStartCapturingKey :
  2162         EPhoneViewStartCapturingKey :
  2161         EPhoneViewStopCapturingKey;
  2163         EPhoneViewStopCapturingKey;
  2162 
  2164 
  2163     // Capture the App key
  2165     // Capture the App key
  2164     TPhoneCmdParamKeyCapture appKeyCaptureParam;
  2166     TPhoneCmdParamKeyCapture appKeyCaptureParam;
  2174         cameraKeyCaptureParam.SetKey( EStdKeyDevice7 );
  2176         cameraKeyCaptureParam.SetKey( EStdKeyDevice7 );
  2175         cameraKeyCaptureParam.SetKeyCode( EKeyDevice7 );
  2177         cameraKeyCaptureParam.SetKeyCode( EKeyDevice7 );
  2176         cameraKeyCaptureParam.SetCaptureType( EPhoneKeyAllEvents );
  2178         cameraKeyCaptureParam.SetCaptureType( EPhoneKeyAllEvents );
  2177         iViewCommandHandle->ExecuteCommandL( viewCommandId,
  2179         iViewCommandHandle->ExecuteCommandL( viewCommandId,
  2178             &cameraKeyCaptureParam );
  2180             &cameraKeyCaptureParam );
  2179         }
  2181         }*/
  2180     }
  2182     }
  2181 
  2183 
  2182 // -----------------------------------------------------------
  2184 // -----------------------------------------------------------
  2183 // CPhoneState::IsWaitingCallL
  2185 // CPhoneState::IsWaitingCallL
  2184 // -----------------------------------------------------------
  2186 // -----------------------------------------------------------
  2209     TPhoneCmdParamCallHeaderData callHeaderParam = UpdateCallHeaderInfoL( aCallId );
  2211     TPhoneCmdParamCallHeaderData callHeaderParam = UpdateCallHeaderInfoL( aCallId );
  2210 
  2212 
  2211     if( iCustomization )
  2213     if( iCustomization )
  2212         {
  2214         {
  2213         TBuf<KCntMaxTextFieldLength> inCallNumberText( KNullDesC );
  2215         TBuf<KCntMaxTextFieldLength> inCallNumberText( KNullDesC );
  2214         // incall number text could be 'Call 1', 'Call 2', ...
  2216 
  2215         CallheaderManagerL()->GetInCallNumberTextL( aCallId, inCallNumberText );
       
  2216         // to check if we have VoIP call in question and fix
  2217         // to check if we have VoIP call in question and fix
  2217         // parameters if needed
  2218         // parameters if needed
  2218         iCustomization->ModifyCallHeaderTexts( aCallId, &callHeaderParam,
  2219         iCustomization->ModifyCallHeaderTexts( aCallId, &callHeaderParam,
  2219             inCallNumberText );
  2220             inCallNumberText );
  2220         }
  2221         }
  2472 
  2473 
  2473 // ---------------------------------------------------------
  2474 // ---------------------------------------------------------
  2474 // CPhoneState::SendGlobalInfoNoteL
  2475 // CPhoneState::SendGlobalInfoNoteL
  2475 // ---------------------------------------------------------
  2476 // ---------------------------------------------------------
  2476 //
  2477 //
  2477 EXPORT_C void CPhoneState::SendGlobalInfoNoteL( TInt aResourceId )
  2478 EXPORT_C void CPhoneState::SendGlobalInfoNoteL( 
       
  2479         TInt aResourceId, TBool aNotificationDialog )
  2478     {
  2480     {
  2479     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::SendGlobalInfoNoteL( ) ");
  2481     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::SendGlobalInfoNoteL( ) ");
  2480     __ASSERT_DEBUG( aResourceId, Panic( EPhoneCtrlParameterNotInitialized ) );
  2482     __ASSERT_DEBUG( aResourceId, Panic( EPhoneCtrlParameterNotInitialized ) );
  2481     if ( CPhonePubSubProxy::Instance()->Value(
  2483     if ( CPhonePubSubProxy::Instance()->Value(
  2482             KPSUidUikon, KUikGlobalNotesAllowed ) == 1 )
  2484             KPSUidUikon, KUikGlobalNotesAllowed ) == 1 )
  2492         globalNoteParam.SetType( EAknGlobalInformationNote );
  2494         globalNoteParam.SetType( EAknGlobalInformationNote );
  2493         globalNoteParam.SetTextResourceId(
  2495         globalNoteParam.SetTextResourceId(
  2494             CPhoneMainResourceResolver::Instance()->
  2496             CPhoneMainResourceResolver::Instance()->
  2495             ResolveResourceID( aResourceId ) );
  2497             ResolveResourceID( aResourceId ) );
  2496         globalNoteParam.SetTone( EAvkonSIDInformationTone );
  2498         globalNoteParam.SetTone( EAvkonSIDInformationTone );
  2497 
  2499         globalNoteParam.SetNotificationDialog( aNotificationDialog );
       
  2500         
  2498         iViewCommandHandle->ExecuteCommandL(
  2501         iViewCommandHandle->ExecuteCommandL(
  2499             EPhoneViewShowGlobalNote, &globalNoteParam );
  2502             EPhoneViewShowGlobalNote, &globalNoteParam );
  2500         }
  2503         }
  2501     }
  2504     }
  2502 
  2505 
  2503 // ---------------------------------------------------------
  2506 // ---------------------------------------------------------
  2504 //  CPhoneUIController::SendGlobalWarningNoteL
  2507 //  CPhoneUIController::SendGlobalWarningNoteL
  2505 // ---------------------------------------------------------
  2508 // ---------------------------------------------------------
  2506 //
  2509 //
  2507 EXPORT_C void CPhoneState::SendGlobalWarningNoteL( TInt aResourceId )
  2510 EXPORT_C void CPhoneState::SendGlobalWarningNoteL( 
       
  2511         TInt aResourceId, TBool aNotificationDialog )
  2508     {
  2512     {
  2509     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::SendGlobalWarningNoteL( ) ");
  2513     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::SendGlobalWarningNoteL( ) ");
  2510     __ASSERT_DEBUG( aResourceId, Panic( EPhoneCtrlParameterNotInitialized ) );
  2514     __ASSERT_DEBUG( aResourceId, Panic( EPhoneCtrlParameterNotInitialized ) );
  2511     if ( CPhonePubSubProxy::Instance()->Value(
  2515     if ( CPhonePubSubProxy::Instance()->Value(
  2512             KPSUidUikon, KUikGlobalNotesAllowed ) == 1 ||
  2516             KPSUidUikon, KUikGlobalNotesAllowed ) == 1 ||
  2522         globalNoteParam.SetType( EAknGlobalWarningNote );
  2526         globalNoteParam.SetType( EAknGlobalWarningNote );
  2523         globalNoteParam.SetTextResourceId(
  2527         globalNoteParam.SetTextResourceId(
  2524             CPhoneMainResourceResolver::Instance()->
  2528             CPhoneMainResourceResolver::Instance()->
  2525             ResolveResourceID( aResourceId ) );
  2529             ResolveResourceID( aResourceId ) );
  2526         globalNoteParam.SetTone( EAvkonSIDWarningTone );
  2530         globalNoteParam.SetTone( EAvkonSIDWarningTone );
  2527 
  2531         globalNoteParam.SetNotificationDialog( aNotificationDialog );
       
  2532         
  2528         iViewCommandHandle->ExecuteCommandL(
  2533         iViewCommandHandle->ExecuteCommandL(
  2529             EPhoneViewShowGlobalNote, &globalNoteParam );
  2534             EPhoneViewShowGlobalNote, &globalNoteParam );
  2530         }
  2535         }
  2531     }
  2536     }
  2532 
  2537 
  2533 // ---------------------------------------------------------
  2538 // ---------------------------------------------------------
  2534 //  CPhoneUIController::SendGlobalErrorNoteL
  2539 //  CPhoneUIController::SendGlobalErrorNoteL
  2535 // ---------------------------------------------------------
  2540 // ---------------------------------------------------------
  2536 //
  2541 //
  2537 EXPORT_C void CPhoneState::SendGlobalErrorNoteL( TInt aResourceId )
  2542 EXPORT_C void CPhoneState::SendGlobalErrorNoteL( 
       
  2543         TInt aResourceId, TBool aNotificationDialog )
  2538     {
  2544     {
  2539     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::SendGlobalErrorNoteL( ) ");
  2545     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::SendGlobalErrorNoteL( ) ");
  2540     __ASSERT_DEBUG( aResourceId, Panic( EPhoneCtrlParameterNotInitialized ) );
  2546     __ASSERT_DEBUG( aResourceId, Panic( EPhoneCtrlParameterNotInitialized ) );
  2541     if ( CPhonePubSubProxy::Instance()->Value(
  2547     if ( CPhonePubSubProxy::Instance()->Value(
  2542             KPSUidUikon, KUikGlobalNotesAllowed ) == 1 )
  2548             KPSUidUikon, KUikGlobalNotesAllowed ) == 1 )
  2551         globalNoteParam.SetType( EAknGlobalErrorNote );
  2557         globalNoteParam.SetType( EAknGlobalErrorNote );
  2552         globalNoteParam.SetTextResourceId(
  2558         globalNoteParam.SetTextResourceId(
  2553             CPhoneMainResourceResolver::Instance()->
  2559             CPhoneMainResourceResolver::Instance()->
  2554             ResolveResourceID( aResourceId ) );
  2560             ResolveResourceID( aResourceId ) );
  2555         globalNoteParam.SetTone( CAknNoteDialog::EErrorTone );
  2561         globalNoteParam.SetTone( CAknNoteDialog::EErrorTone );
       
  2562         globalNoteParam.SetNotificationDialog( aNotificationDialog );
  2556 
  2563 
  2557         iViewCommandHandle->ExecuteCommandL(
  2564         iViewCommandHandle->ExecuteCommandL(
  2558             EPhoneViewShowGlobalNote, &globalNoteParam );
  2565             EPhoneViewShowGlobalNote, &globalNoteParam );
  2559         }
  2566         }
  2560     }
  2567     }
  2568     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::SetHandsfreeModeL( ) ");
  2575     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::SetHandsfreeModeL( ) ");
  2569     CPhoneAccessoryBTHandler* bt = CPhoneAccessoryBTHandler::NewLC(
  2576     CPhoneAccessoryBTHandler* bt = CPhoneAccessoryBTHandler::NewLC(
  2570         iViewCommandHandle, iStateMachine, this );
  2577         iViewCommandHandle, iStateMachine, this );
  2571     if ( !bt->SetHandsfreeModeL( aHandsfreeMode ))
  2578     if ( !bt->SetHandsfreeModeL( aHandsfreeMode ))
  2572         {
  2579         {
  2573         SendGlobalErrorNoteL( EPhoneNoteTextNotAllowed );
  2580         SendGlobalErrorNoteL( EPhoneNoteTextNotAllowed, ETrue );
  2574         }
  2581         }
  2575     CleanupStack::PopAndDestroy( bt );
  2582     CleanupStack::PopAndDestroy( bt );
  2576     }
  2583     }
  2577 
  2584 
  2578 // ---------------------------------------------------------
  2585 // ---------------------------------------------------------
  2584     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::SetBTHandsfreeModeL( ) ");
  2591     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::SetBTHandsfreeModeL( ) ");
  2585     CPhoneAccessoryBTHandler* bt = CPhoneAccessoryBTHandler::NewLC(
  2592     CPhoneAccessoryBTHandler* bt = CPhoneAccessoryBTHandler::NewLC(
  2586         iViewCommandHandle, iStateMachine, this );
  2593         iViewCommandHandle, iStateMachine, this );
  2587     if ( !bt->SetBTHandsfreeModeL( aHandsfreeMode ))
  2594     if ( !bt->SetBTHandsfreeModeL( aHandsfreeMode ))
  2588         {
  2595         {
  2589         SendGlobalErrorNoteL( EPhoneNoteTextNotAllowed );
  2596         SendGlobalErrorNoteL( EPhoneNoteTextNotAllowed, ETrue );
  2590         }
  2597         }
  2591     CleanupStack::PopAndDestroy( bt );
  2598     CleanupStack::PopAndDestroy( bt );
  2592     }
  2599     }
  2593 
  2600 
  2594 // <-------------------------- INTERNAL FUNCTIONS ------------------------>
  2601 // <-------------------------- INTERNAL FUNCTIONS ------------------------>
  2847                                                                KNullDesC8,
  2854                                                                KNullDesC8,
  2848                                                                CPhoneContinueEmergencyCallCommand::NewL( *iStateMachine ) );
  2855                                                                CPhoneContinueEmergencyCallCommand::NewL( *iStateMachine ) );
  2849     }
  2856     }
  2850 
  2857 
  2851 // -----------------------------------------------------------
  2858 // -----------------------------------------------------------
  2852 // CPhoneState::HandleShowImeiL
       
  2853 // -----------------------------------------------------------
       
  2854 //
       
  2855 void CPhoneState::HandleShowImeiL()
       
  2856     {
       
  2857     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::HandleShowImeiL( ) ");
       
  2858     
       
  2859     // Fetch IMEI
       
  2860     TBuf<RMobilePhone::KPhoneSerialNumberSize> serialNumber;
       
  2861     TPEPhoneIdentityParameters phoneIdentityParameters = 
       
  2862         iStateMachine->PhoneEngineInfo()->PhoneIdentityParameters();
       
  2863     serialNumber = phoneIdentityParameters.iSerialNumber;
       
  2864     
       
  2865     HBufC* imeiNoteText = StringLoader::LoadLC(
       
  2866         CPhoneMainResourceResolver::Instance()->
       
  2867         ResolveResourceID(
       
  2868         EPhonePhoneImeiString ), serialNumber );
       
  2869     
       
  2870     TPhoneCmdParamGlobalNote noteParam;
       
  2871     noteParam.SetType( EAknGlobalInformationNote );
       
  2872     noteParam.SetTone( EAvkonSIDInformationTone );
       
  2873     noteParam.SetText( *imeiNoteText );
       
  2874     noteParam.SetTimeout( KPhoneNoteNoTimeout );
       
  2875     
       
  2876     iViewCommandHandle->ExecuteCommandL( 
       
  2877         EPhoneViewShowGlobalNote, 
       
  2878         &noteParam );
       
  2879     
       
  2880     CleanupStack::PopAndDestroy( imeiNoteText );
       
  2881     }
       
  2882 
       
  2883 // -----------------------------------------------------------
       
  2884 // CPhoneState::HandleCallSecureStatusChangeL
  2859 // CPhoneState::HandleCallSecureStatusChangeL
  2885 // -----------------------------------------------------------
  2860 // -----------------------------------------------------------
  2886 //
  2861 //
  2887 void CPhoneState::HandleCallSecureStatusChangeL( TInt aCallId )
  2862 void CPhoneState::HandleCallSecureStatusChangeL( TInt aCallId )
  2888     {
  2863     {
  2904 
  2879 
  2905     iViewCommandHandle->ExecuteCommandL(
  2880     iViewCommandHandle->ExecuteCommandL(
  2906         EPhoneViewCipheringInfoChange,
  2881         EPhoneViewCipheringInfoChange,
  2907         aCallId,
  2882         aCallId,
  2908         &callHeaderParam );
  2883         &callHeaderParam );
  2909     }
       
  2910 
       
  2911 // -----------------------------------------------------------
       
  2912 // CPhoneState::HandleShowLifeTimerL
       
  2913 // -----------------------------------------------------------
       
  2914 //
       
  2915 void CPhoneState::HandleShowLifeTimerL()
       
  2916    {
       
  2917     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::HandleShowLifeTimerL( ) ");
       
  2918     
       
  2919     // Fetch LifeTime
       
  2920     TPELifeTimeData lifeTimeData = 
       
  2921         iStateMachine->PhoneEngineInfo()->LifeTimerData();
       
  2922     
       
  2923     TLocale locale;
       
  2924     TBuf<KTimerTextLength> lifetimerText;
       
  2925     lifetimerText.NumFixedWidth(
       
  2926         lifeTimeData.iHours,
       
  2927         EDecimal,
       
  2928         KPhoneLifeTimerHoursLength );
       
  2929     
       
  2930     lifetimerText.Append(locale.TimeSeparator( KTimerMinuteSeparator ) );
       
  2931     
       
  2932     TBuf<KPhoneLifeTimerMinutesLength> mins;
       
  2933     mins.NumFixedWidth(
       
  2934         lifeTimeData.iMinutes,
       
  2935         EDecimal,
       
  2936         KPhoneLifeTimerMinutesLength );
       
  2937     
       
  2938     lifetimerText.Append(mins);
       
  2939     
       
  2940     HBufC* buf = StringLoader::LoadLC(
       
  2941         CPhoneMainResourceResolver::Instance()->
       
  2942         ResolveResourceID(
       
  2943         EPhoneLifeTimeFormat ), lifetimerText );
       
  2944     
       
  2945     TPhoneCmdParamGlobalNote noteParam;
       
  2946     noteParam.SetType( EAknGlobalInformationNote );
       
  2947     noteParam.SetTone( EAvkonSIDInformationTone );
       
  2948     noteParam.SetText( *buf );
       
  2949     noteParam.SetTimeout( KPhoneNoteNoTimeout );
       
  2950     
       
  2951     iViewCommandHandle->ExecuteCommandL( 
       
  2952         EPhoneViewShowGlobalNote, 
       
  2953         &noteParam );
       
  2954     
       
  2955     CleanupStack::PopAndDestroy( buf );
       
  2956     }
  2884     }
  2957 
  2885 
  2958 // ---------------------------------------------------------
  2886 // ---------------------------------------------------------
  2959 // CPhoneState::IsVideoCall
  2887 // CPhoneState::IsVideoCall
  2960 // ---------------------------------------------------------
  2888 // ---------------------------------------------------------
  3438     globalNoteParam.SetType( EAknGlobalInformationNote );
  3366     globalNoteParam.SetType( EAknGlobalInformationNote );
  3439     globalNoteParam.SetTextResourceId(
  3367     globalNoteParam.SetTextResourceId(
  3440         CPhoneMainResourceResolver::Instance()->
  3368         CPhoneMainResourceResolver::Instance()->
  3441         ResolveResourceID( resource ) );
  3369         ResolveResourceID( resource ) );
  3442     globalNoteParam.SetTone( EAvkonSIDInformationTone );
  3370     globalNoteParam.SetTone( EAvkonSIDInformationTone );
       
  3371     globalNoteParam.SetNotificationDialog( ETrue );
  3443     iViewCommandHandle->ExecuteCommandL( EPhoneViewShowGlobalNote,
  3372     iViewCommandHandle->ExecuteCommandL( EPhoneViewShowGlobalNote,
  3444         &globalNoteParam );
  3373         &globalNoteParam );
  3445     }
  3374     }
  3446 
  3375 
  3447 // ---------------------------------------------------------
  3376 // ---------------------------------------------------------
  3454     const TBool phoneIsLocked =
  3383     const TBool phoneIsLocked =
  3455                 CPhonePubSubProxy::Instance()->Value(
  3384                 CPhonePubSubProxy::Instance()->Value(
  3456                 KPSUidCoreApplicationUIs,
  3385                 KPSUidCoreApplicationUIs,
  3457                 KCoreAppUIsAutolockStatus ) > EAutolockOff;
  3386                 KCoreAppUIsAutolockStatus ) > EAutolockOff;
  3458 
  3387 
       
  3388     __PHONELOG1( EBasic,
       
  3389             EPhoneControl,
       
  3390             "CPhoneState::IsAutoLockOn() Status: %d",
       
  3391             phoneIsLocked );
       
  3392     
  3459     return phoneIsLocked;
  3393     return phoneIsLocked;
  3460     }
  3394     }
  3461 
  3395 
  3462 // ---------------------------------------------------------
  3396 // ---------------------------------------------------------
  3463 // CPhoneState::IsKeyLockOn
  3397 // CPhoneState::IsKeyLockOn
  3498 //
  3432 //
  3499 EXPORT_C void CPhoneState::SetTouchPaneButtons( TInt /*aResourceId*/ )
  3433 EXPORT_C void CPhoneState::SetTouchPaneButtons( TInt /*aResourceId*/ )
  3500     {
  3434     {
  3501     if ( FeatureManager::FeatureSupported( KFeatureIdTouchCallHandling ) )
  3435     if ( FeatureManager::FeatureSupported( KFeatureIdTouchCallHandling ) )
  3502         {
  3436         {
       
  3437         TPhoneCmdParamBoolean muteParam;
       
  3438         muteParam.SetBoolean( iStateMachine->PhoneEngineInfo()->AudioMute() );
       
  3439         iViewCommandHandle->ExecuteCommand(EPhoneViewSetMuteFlag,&muteParam);
       
  3440         
       
  3441         const TPEAudioOutput audioOutput =
       
  3442             iStateMachine->PhoneEngineInfo()->AudioOutput();
       
  3443 
       
  3444         TBool btAvailable = iStateMachine->PhoneEngineInfo()->AudioOutputAvailable(
       
  3445             EPEBTAudioAccessory );
       
  3446         
       
  3447         TPhoneCmdParamBoolean btParam;
       
  3448         btParam.SetBoolean( audioOutput == EPEBTAudioAccessory );        
       
  3449         iViewCommandHandle->ExecuteCommand(EPhoneViewSetBlueToothFlag,&btParam);
       
  3450 
       
  3451         TPhoneCmdParamBoolean btAvailableParam;
       
  3452         btAvailableParam.SetBoolean( btAvailable );        
       
  3453         iViewCommandHandle->ExecuteCommand(
       
  3454                 EPhoneViewSetBluetoothAvailableFlag,&btAvailableParam);
       
  3455                
  3503         TBool emergency( EPEStateIdle != 
  3456         TBool emergency( EPEStateIdle != 
  3504             iStateMachine->PhoneEngineInfo()->CallState( KPEEmergencyCallId ) );
  3457             iStateMachine->PhoneEngineInfo()->CallState( KPEEmergencyCallId ) );
  3505         TPhoneCmdParamBoolean booleanParam;
  3458         TPhoneCmdParamBoolean booleanParam;
  3506         booleanParam.SetBoolean( emergency );
  3459         booleanParam.SetBoolean( emergency );
  3507 
  3460 
  3942         globalNoteParam.SetType( EAknGlobalInformationNote );
  3895         globalNoteParam.SetType( EAknGlobalInformationNote );
  3943         globalNoteParam.SetTone( EAvkonSIDInformationTone );
  3896         globalNoteParam.SetTone( EAvkonSIDInformationTone );
  3944         globalNoteParam.SetTextResourceId(
  3897         globalNoteParam.SetTextResourceId(
  3945             CPhoneMainResourceResolver::Instance()->
  3898             CPhoneMainResourceResolver::Instance()->
  3946             ResolveResourceID( EPhoneCallWaitingWithLabel ) );
  3899             ResolveResourceID( EPhoneCallWaitingWithLabel ) );
  3947 
  3900         globalNoteParam.SetNotificationDialog( ETrue );
       
  3901         
  3948         iViewCommandHandle->ExecuteCommandL(
  3902         iViewCommandHandle->ExecuteCommandL(
  3949                 EPhoneViewShowGlobalNote, &globalNoteParam );
  3903                 EPhoneViewShowGlobalNote, &globalNoteParam );
  3950         }
  3904         }
  3951     else
  3905     else
  3952         {
  3906         {
  3953         SendGlobalInfoNoteL( EPhoneCallWaitingWithoutLabel );
  3907         SendGlobalInfoNoteL( EPhoneCallWaitingWithoutLabel, ETrue );
  3954         }
  3908         }
  3955     }
  3909     }
  3956 
  3910 
  3957 // ----------------------------------------------------------------------------
  3911 // ----------------------------------------------------------------------------
  3958 // CPhoneState::SetRingingTonePlaybackL()
  3912 // CPhoneState::SetRingingTonePlaybackL()
  4707 // CPhoneState::SetToolbarDimming
  4661 // CPhoneState::SetToolbarDimming
  4708 // ---------------------------------------------------------
  4662 // ---------------------------------------------------------
  4709 //
  4663 //
  4710 EXPORT_C void CPhoneState::SetBackButtonActive( TBool aActive )
  4664 EXPORT_C void CPhoneState::SetBackButtonActive( TBool aActive )
  4711     {
  4665     {
       
  4666     if(IsAutoLockOn() && aActive) {
       
  4667         // keep back button dimmed device lock case
       
  4668         return;
       
  4669     }
       
  4670     
  4712     if ( FeatureManager::FeatureSupported( KFeatureIdTouchCallHandling ) )
  4671     if ( FeatureManager::FeatureSupported( KFeatureIdTouchCallHandling ) )
  4713         {
  4672         {
  4714         TPhoneCmdParamBoolean booleanParam;
  4673         TPhoneCmdParamBoolean booleanParam;
  4715         booleanParam.SetBoolean( aActive );
  4674         booleanParam.SetBoolean( aActive );
  4716         iViewCommandHandle->ExecuteCommand(
  4675         iViewCommandHandle->ExecuteCommand(