phoneapp/phoneuicontrol/src/cphonestate.cpp
changeset 76 cfea66083b62
parent 74 d1c62c765e48
child 78 baacf668fe89
equal deleted inserted replaced
74:d1c62c765e48 76:cfea66083b62
    67 #include "tphonecmdparamglobalnote.h"
    67 #include "tphonecmdparamglobalnote.h"
    68 #include "tphonecmdparamquery.h"
    68 #include "tphonecmdparamquery.h"
    69 #include "tphonecmdparamstring.h"
    69 #include "tphonecmdparamstring.h"
    70 #include "tphonecmdparamcallstatedata.h"
    70 #include "tphonecmdparamcallstatedata.h"
    71 #include "tphonecmdparambitmap.h"
    71 #include "tphonecmdparambitmap.h"
    72 #include "tphonecmdparamaudiooutput.h"
       
    73 #include "tphonecmdparamaudioavailability.h"
       
    74 #include "tphonecmdparamappinfo.h"
    72 #include "tphonecmdparamappinfo.h"
    75 #include "tphonecmdparamtranseffect.h"
    73 #include "tphonecmdparamtranseffect.h"
    76 #include "tphonecmdparamringtone.h"
    74 #include "tphonecmdparamringtone.h"
    77 #include "tphonecmdparamcustomdialer.h"
    75 #include "tphonecmdparamcustomdialer.h"
    78 #include "cphonekeys.h"
    76 #include "cphonekeys.h"
    98 #include "cphonecontinueemergencycallcommand.h"
    96 #include "cphonecontinueemergencycallcommand.h"
    99 #include "tphonecmdparamsfidata.h" 
    97 #include "tphonecmdparamsfidata.h" 
   100 #include "mphonestorage.h"
    98 #include "mphonestorage.h"
   101 #include "phoneconstants.h"
    99 #include "phoneconstants.h"
   102 #include "cphoneclearblacklist.h"
   100 #include "cphoneclearblacklist.h"
       
   101 #include "phonenoteutil.h"
       
   102 #include "phoneaudioutil.h"
   103 
   103 
   104 // ================= MEMBER FUNCTIONS =======================
   104 // ================= MEMBER FUNCTIONS =======================
   105 
   105 
   106 EXPORT_C CPhoneState::CPhoneState(
   106 EXPORT_C CPhoneState::CPhoneState(
   107     MPhoneStateMachine* aStateMachine,
   107     MPhoneStateMachine* aStateMachine,
   210         case MEngineMonitor::EPEMessageChangedCallDuration:
   210         case MEngineMonitor::EPEMessageChangedCallDuration:
   211             HandleChangedCallDurationL( aCallId );
   211             HandleChangedCallDurationL( aCallId );
   212             break;
   212             break;
   213 
   213 
   214         case MEngineMonitor::EPEMessageRemoteBusy:
   214         case MEngineMonitor::EPEMessageRemoteBusy:
   215             HandleRemoteBusyL( aCallId );
   215             PhoneNoteUtil::HandleRemoteBusyNoteL( aCallId );
   216             break;
   216             break;
   217 
   217 
   218         case MEngineMonitor::EPEMessageCallWaiting:
   218         case MEngineMonitor::EPEMessageCallWaiting:
   219         case MEngineMonitor::EPEMessageProfileChanged:
   219         case MEngineMonitor::EPEMessageProfileChanged:
   220             break;
   220             break;
   263 
   263 
   264         // *#9990#
   264         // *#9990#
   265         case MEngineMonitor::EPEMessageShowBTLoopback:
   265         case MEngineMonitor::EPEMessageShowBTLoopback:
   266             iStateMachine->SendPhoneEngineMessage( MPEPhoneModel::EPEMessageEndDTMF );
   266             iStateMachine->SendPhoneEngineMessage( MPEPhoneModel::EPEMessageEndDTMF );
   267             accessoryBtHandler = CPhoneAccessoryBTHandler::NewLC(
   267             accessoryBtHandler = CPhoneAccessoryBTHandler::NewLC(
   268                 iViewCommandHandle, iStateMachine, this );
   268                 iViewCommandHandle, iStateMachine );
   269             accessoryBtHandler->ShowBTLoopbackL();
   269             accessoryBtHandler->ShowBTLoopbackL();
   270             CleanupStack::PopAndDestroy( accessoryBtHandler );
   270             CleanupStack::PopAndDestroy( accessoryBtHandler );
   271             break;
   271             break;
   272 
   272 
   273         // *#2820#
   273         // *#2820#
   274         case MEngineMonitor::EPEMessageShowBTDeviceAddress:
   274         case MEngineMonitor::EPEMessageShowBTDeviceAddress:
   275             iStateMachine->SendPhoneEngineMessage( MPEPhoneModel::EPEMessageEndDTMF );
   275             iStateMachine->SendPhoneEngineMessage( MPEPhoneModel::EPEMessageEndDTMF );
   276             accessoryBtHandler = CPhoneAccessoryBTHandler::NewLC(
   276             accessoryBtHandler = CPhoneAccessoryBTHandler::NewLC(
   277                 iViewCommandHandle, iStateMachine, this );
   277                 iViewCommandHandle, iStateMachine );
   278             accessoryBtHandler->ShowBTAddressL();
   278             accessoryBtHandler->ShowBTAddressL();
   279             CleanupStack::PopAndDestroy( accessoryBtHandler );
   279             CleanupStack::PopAndDestroy( accessoryBtHandler );
   280             break;
   280             break;
   281 
   281 
   282         // *#7370#
   282         // *#7370#
   296             iStateMachine->SendPhoneEngineMessage( MPEPhoneModel::EPEMessageEndDTMF );
   296             iStateMachine->SendPhoneEngineMessage( MPEPhoneModel::EPEMessageEndDTMF );
   297             ShowWlanMacAddressL();
   297             ShowWlanMacAddressL();
   298             break;
   298             break;
   299 
   299 
   300         case MEngineMonitor::EPEMessageThumbnailLoadingCompleted:
   300         case MEngineMonitor::EPEMessageThumbnailLoadingCompleted:
   301             UpdateRemoteInfoDataL( aCallId );
       
   302             break;
       
   303 
       
   304         case MEngineMonitor::EPEMessageRemotePartyInfoChanged:
   301         case MEngineMonitor::EPEMessageRemotePartyInfoChanged:
   305             UpdateRemoteInfoDataL ( aCallId );
   302             UpdateCallHeader( aCallId );
   306             break;
   303             break;
   307 
   304 
   308         case MEngineMonitor::EPEMessageSIMStateChanged:
   305         case MEngineMonitor::EPEMessageSIMStateChanged:
   309             __PHONELOG1( EBasic, EPhoneControl, "CPhoneState::HandlePhoneEngineMessageL - simStateChanged =%d", SimState()  );
   306             __PHONELOG1( EBasic, EPhoneControl, "CPhoneState::HandlePhoneEngineMessageL - simStateChanged =%d", SimState()  );
   310             HandleSimStateChangedL();
   307             HandleSimStateChangedL();
   345 EXPORT_C void CPhoneState::HandleAudioMuteChangedL()
   342 EXPORT_C void CPhoneState::HandleAudioMuteChangedL()
   346     {
   343     {
   347     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::HandleAudioMuteChangedL() ");
   344     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::HandleAudioMuteChangedL() ");
   348     __ASSERT_DEBUG( iStateMachine->PhoneEngineInfo(),
   345     __ASSERT_DEBUG( iStateMachine->PhoneEngineInfo(),
   349         Panic( EPhoneCtrlInvariant ) );
   346         Panic( EPhoneCtrlInvariant ) );
   350     TPhoneCmdParamBoolean booleanParam;
   347     PhoneAudioUtil::HandleAudioMuteChangedL();
   351     const TBool audioMute = iStateMachine->PhoneEngineInfo()->AudioMute();
       
   352     booleanParam.SetBoolean( audioMute );
       
   353     iViewCommandHandle->ExecuteCommandL( EPhoneViewActivateMuteUIChanges,
       
   354         &booleanParam );
       
   355     UpdateUiCommands();
   348     UpdateUiCommands();
   356     }
   349     }
   357 
   350 
   358 // -----------------------------------------------------------
   351 // -----------------------------------------------------------
   359 // CPhoneState::HandleAudioOutputChangedL
   352 // CPhoneState::HandleAudioOutputChangedL
   363 //
   356 //
   364 EXPORT_C void CPhoneState::HandleAudioOutputChangedL()
   357 EXPORT_C void CPhoneState::HandleAudioOutputChangedL()
   365     {
   358     {
   366     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::HandleAudioOutputChangedL() ");
   359     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::HandleAudioOutputChangedL() ");
   367     __ASSERT_DEBUG( iStateMachine->PhoneEngineInfo(), Panic( EPhoneCtrlInvariant ) );
   360     __ASSERT_DEBUG( iStateMachine->PhoneEngineInfo(), Panic( EPhoneCtrlInvariant ) );
   368     TPhoneCmdParamAudioOutput outputParam;
   361     PhoneAudioUtil::HandleAudioOutputChangedL();
   369     const TPEAudioOutput audioOutput =
       
   370         iStateMachine->PhoneEngineInfo()->AudioOutput();
       
   371     outputParam.SetAudioOutput( audioOutput );
       
   372 
       
   373     iViewCommandHandle->ExecuteCommandL( EPhoneViewActivateAudioPathUIChanges,
       
   374         &outputParam );
       
   375 
       
   376     // Previous Output
       
   377     TPEPhoneAudioRouteParameters RouteParameters = iStateMachine->
       
   378         PhoneEngineInfo()->RouteParameters();
       
   379     const TPEAudioOutput previousOutput =
       
   380         RouteParameters.iPreviousOutput;
       
   381 
       
   382     TBool btAvailable = iStateMachine->PhoneEngineInfo()->AudioOutputAvailable(
       
   383             EPEBTAudioAccessory );
       
   384     // Show note or BT disconnect handler
       
   385     if ( audioOutput != EPENotActive &&
       
   386          previousOutput == EPEBTAudioAccessory &&
       
   387          !btAvailable )
       
   388         {
       
   389         CPhoneBtaaDisconnectHandler::InstanceL()->HandleConnectionLostL();
       
   390         }
       
   391     else if ( audioOutput == EPEBTAudioAccessory && 
       
   392             previousOutput != EPEBTAudioAccessory &&
       
   393             btAvailable )
       
   394         {
       
   395         CPhoneAccessoryBTHandler* bt = CPhoneAccessoryBTHandler::NewLC(
       
   396             iViewCommandHandle, iStateMachine, this );
       
   397         bt->ShowBTActivatedL();
       
   398         CleanupStack::PopAndDestroy( bt );
       
   399         }
       
   400     else if ( audioOutput == EPENotActive &&
       
   401               CPhoneBtaaDisconnectHandler::InstanceL()->IsQuery() )
       
   402         {
       
   403         CPhoneBtaaDisconnectHandler::InstanceL()->Cancel();
       
   404         }
       
   405     else if ( RouteParameters.iShowNote && audioOutput == EPELoudspeaker )
       
   406         {
       
   407         // Avkon removal
       
   408         }
       
   409     }
   362     }
   410 
   363 
   411 // -----------------------------------------------------------
   364 // -----------------------------------------------------------
   412 // CPhoneState::HandleSimStateChangedL
   365 // CPhoneState::HandleSimStateChangedL
   413 // Handles changes in the SIM card state.
   366 // Handles changes in the SIM card state.
   501             aErrorInfo.iErrorCode );
   454             aErrorInfo.iErrorCode );
   502     __PHONELOG1( EBasic, EPhoneControl,
   455     __PHONELOG1( EBasic, EPhoneControl,
   503         "PhoneUIControl: CPhoneState::HandleErrorL - aErrorInfo.iCallId =%d ",
   456         "PhoneUIControl: CPhoneState::HandleErrorL - aErrorInfo.iCallId =%d ",
   504         aErrorInfo.iCallId );
   457         aErrorInfo.iCallId );
   505     // Do the common error handling (display proper notes etc)
   458     // Do the common error handling (display proper notes etc)
   506     CPhoneMainErrorMessagesHandler::Instance()->ShowErrorSpecificNoteL( aErrorInfo );
   459     PhoneNoteUtil::HandleErrorL( aErrorInfo );
   507     switch( aErrorInfo.iErrorCode )
       
   508         {
       
   509 
       
   510         case ECCPErrorNoService:
       
   511             // No network -> hide volume popup
       
   512             iViewCommandHandle->ExecuteCommandL( EPhoneViewHideNaviPaneAudioVolume );
       
   513             break;
       
   514 
       
   515         case ECCPErrorSatControl:
       
   516             iNumberEntryManager->NumberEntryClearL();
       
   517             break;
       
   518 
       
   519         default:
       
   520             break;
       
   521         }
       
   522     // clear call blacklist if call failure occurs
       
   523     CPhoneClearBlacklist::Instance()->ClearBlackListOnNextKey();
       
   524     }
   460     }
   525 
   461 
   526 // -----------------------------------------------------------
   462 // -----------------------------------------------------------
   527 // CPhoneState::HandleChangedCallDurationL
   463 // CPhoneState::HandleChangedCallDurationL
   528 // Default handling for EPEMessageChangedCallDuration message
   464 // Default handling for EPEMessageChangedCallDuration message
   545         time.SetInteger(seconds.Int());
   481         time.SetInteger(seconds.Int());
   546         iViewCommandHandle->ExecuteCommandL(EPhoneViewUpdateCallHeaderCallDuration, aCallId, &time);
   482         iViewCommandHandle->ExecuteCommandL(EPhoneViewUpdateCallHeaderCallDuration, aCallId, &time);
   547         }
   483         }
   548     }	
   484     }	
   549 
   485 
   550 // -----------------------------------------------------------------------------
       
   551 // CPhoneState::HandleRemoteBusyL
       
   552 // -----------------------------------------------------------------------------
       
   553 //
       
   554 void CPhoneState::HandleRemoteBusyL( TInt aCallId )
       
   555     {
       
   556     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::HandleRemoteBusyL( ) ");
       
   557     TPEErrorInfo info;
       
   558     info.iCallId = aCallId;
       
   559     info.iErrorCode = ECCPErrorBusy;
       
   560     info.iErrorType = EPECcp;
       
   561     CPhoneMainErrorMessagesHandler::Instance()->ShowErrorSpecificNoteL( info );
       
   562     }
       
   563 
       
   564 // -----------------------------------------------------------
   486 // -----------------------------------------------------------
   565 // CPhoneState::HandleDisconnectingL
   487 // CPhoneState::HandleDisconnectingL
   566 // -----------------------------------------------------------
   488 // -----------------------------------------------------------
   567 //
   489 //
   568 EXPORT_C void CPhoneState::HandleDisconnectingL( TInt aCallId )
   490 EXPORT_C void CPhoneState::HandleDisconnectingL( TInt aCallId )
   569     {
   491     {
   570     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::HandleDisconnectingL( ) ");
   492     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::HandleDisconnectingL( ) ");
   571 
   493 
   572     iViewCommandHandle->ExecuteCommandL( EPhoneViewStopRingTone );
   494     iViewCommandHandle->ExecuteCommandL( EPhoneViewStopRingTone );
   573     iViewCommandHandle->ExecuteCommandL( 
   495     UpdateCallHeader( aCallId );
   574             EPhoneViewUpdateBubble, 
       
   575             aCallId);
       
   576 
   496 
   577     CPhoneClearBlacklist::Instance()->ClearBlackListOnNextKey();
   497     CPhoneClearBlacklist::Instance()->ClearBlackListOnNextKey();
   578     }
   498     }
   579 
   499 
   580 // <------------------------------- KEY EVENTS ------------------------------->
   500 // <------------------------------- KEY EVENTS ------------------------------->
   784             iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveQuery );
   704             iViewCommandHandle->ExecuteCommandL( EPhoneViewRemoveQuery );
   785             break;
   705             break;
   786 
   706 
   787         case EPhoneInCallCmdDeactivateIhf: // fall through
   707         case EPhoneInCallCmdDeactivateIhf: // fall through
   788         case EPhoneInCallCmdActivateIhf:
   708         case EPhoneInCallCmdActivateIhf:
   789             SetHandsfreeModeL( aCommand == EPhoneInCallCmdActivateIhf );
   709              SetHandsfreeModeL( aCommand == EPhoneInCallCmdActivateIhf );
   790              break;
   710              break;
   791 
   711 
   792         case EPhoneInCallCmdHandset:    // fall through
   712         case EPhoneInCallCmdHandset:    // fall through
   793         case EPhoneInCallCmdBtHandsfree:
   713         case EPhoneInCallCmdBtHandsfree:
   794             CPhoneState::SetBTHandsfreeModeL(
   714             CPhoneState::SetBTHandsfreeModeL(
   804         
   724         
   805         case EPhoneInCallCmdSetVolumeLevel:
   725         case EPhoneInCallCmdSetVolumeLevel:
   806             {
   726             {
   807             // This command comes from ui control, no need to update
   727             // This command comes from ui control, no need to update
   808             // value to control (second parameter set false).
   728             // value to control (second parameter set false).
   809             ChangeAudioVolumeL( GetVolumeLevel(), EFalse );
   729             PhoneAudioUtil::ChangeAudioVolumeL( 
       
   730                     PhoneAudioUtil::GetVolumeLevel(), EFalse );
   810             }
   731             }
   811             break;
   732             break;
   812 
   733 
   813         case EPhoneCmdVideoCallOutOfMemory:
   734         case EPhoneCmdVideoCallOutOfMemory:
   814             ShowVideoCallOutOfMemoryNoteL();
   735             ShowVideoCallOutOfMemoryNoteL();
   874             handled = ETrue;
   795             handled = ETrue;
   875             break;
   796             break;
   876         case ERemConCoreApiMute:
   797         case ERemConCoreApiMute:
   877             {
   798             {
   878             __PHONELOG( EBasic, EPhoneControl, "CPhoneState::MrccatoCommand ERemConCoreApiMute" );
   799             __PHONELOG( EBasic, EPhoneControl, "CPhoneState::MrccatoCommand ERemConCoreApiMute" );
   879             iStateMachine->PhoneEngineInfo()->AudioMute() ?
   800             PhoneAudioUtil::ToggleMute();
   880                 iStateMachine->PhoneEngineInfo()->SetAudioMuteCommand( EFalse ):
       
   881                 iStateMachine->PhoneEngineInfo()->SetAudioMuteCommand( ETrue );
       
   882             iStateMachine->SendPhoneEngineMessage(
       
   883                 MPEPhoneModel::EPEMessageSetAudioMute );
       
   884             handled = ETrue;
   801             handled = ETrue;
   885             break;
   802             break;
   886             }
   803             }
   887 
   804 
   888          default:
   805          default:
   898 // -----------------------------------------------------------
   815 // -----------------------------------------------------------
   899 //
   816 //
   900 EXPORT_C void CPhoneState::DecreaseAudioVolumeL()
   817 EXPORT_C void CPhoneState::DecreaseAudioVolumeL()
   901     {
   818     {
   902     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::DecreaceAudioVolumeL( ) ");
   819     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::DecreaceAudioVolumeL( ) ");
   903     __ASSERT_DEBUG( iStateMachine->PhoneEngineInfo(), Panic( EPhoneCtrlInvariant ) );
   820     PhoneAudioUtil::DecreaseAudioVolumeL();
   904     TPEAudioOutput output( iStateMachine->PhoneEngineInfo()->AudioOutput() );
       
   905     __PHONELOG1( EBasic, EPhoneControl, "CPhoneState::DecreaseAudioVolumeL - audio output =%d", output );
       
   906     if( output == EPETTY )
       
   907         {
       
   908         SendGlobalInfoNoteL( EPhoneNoteTTYNoAudioControl, ETrue );
       
   909         }
       
   910     else
       
   911         {
       
   912         TInt audioVolume( iStateMachine->PhoneEngineInfo()->AudioVolume() );
       
   913         audioVolume--;
       
   914         ChangeAudioVolumeL( audioVolume, ETrue );
       
   915         }
       
   916     }
   821     }
   917 
   822 
   918 // -----------------------------------------------------------
   823 // -----------------------------------------------------------
   919 // CPhoneState::IncreaceAudioVolume()
   824 // CPhoneState::IncreaceAudioVolume()
   920 // -----------------------------------------------------------
   825 // -----------------------------------------------------------
   921 //
   826 //
   922 EXPORT_C void CPhoneState::IncreaseAudioVolumeL()
   827 EXPORT_C void CPhoneState::IncreaseAudioVolumeL()
   923     {
   828     {
   924      __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::IncreaceAudioVolumeL( ) ");
   829      __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::IncreaceAudioVolumeL( ) ");
   925     __ASSERT_DEBUG( iStateMachine->PhoneEngineInfo(), Panic( EPhoneCtrlInvariant ) );
   830     PhoneAudioUtil::IncreaseAudioVolumeL();
   926     TPEAudioOutput output( iStateMachine->PhoneEngineInfo()->AudioOutput() );
       
   927      __PHONELOG1( EBasic, EPhoneControl, "CPhoneState::IncreaseAudioVolumeL - audio output =%d", output );
       
   928     if( output == EPETTY )
       
   929         {
       
   930         SendGlobalInfoNoteL( EPhoneNoteTTYNoAudioControl, ETrue );
       
   931         }
       
   932     else
       
   933         {
       
   934         TInt audioVolume( iStateMachine->PhoneEngineInfo()->AudioVolume() );
       
   935         audioVolume++;
       
   936         ChangeAudioVolumeL( audioVolume, ETrue );
       
   937         }
       
   938     }
       
   939 
       
   940 // -----------------------------------------------------------
       
   941 // CPhoneState::ChangeAudioVolumeL()
       
   942 // -----------------------------------------------------------
       
   943 //
       
   944 void CPhoneState::ChangeAudioVolumeL( TInt aLevel, TBool aUpdateControl )
       
   945     {
       
   946      __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::ChangeAudioVolumeL( ) ");
       
   947      __PHONELOG1( EBasic, EPhoneControl, "CPhoneState::ChangeAudioVolumeL - set volume =%d", aLevel );
       
   948     TInt valueToControl = aLevel;
       
   949     // sets value between 1 -10
       
   950     if ( aLevel>=KPhoneVolumeMinValue && aLevel<=KPhoneVolumeMaxValue )
       
   951         {
       
   952         iStateMachine->PhoneEngineInfo()->SetAudioVolumeCommand( aLevel );
       
   953         // Syncronizes audio volume level between engine and ui
       
   954         // causes EPEMessageAudioVolumeChanged message to phoneUI
       
   955         iStateMachine->SendPhoneEngineMessage(
       
   956             MPEPhoneModel::EPEMessageSetAudioVolume );
       
   957         }
       
   958         
       
   959     if ( aUpdateControl )
       
   960         {
       
   961         // Update the volume display.
       
   962         // Upper max (11) and under min (-1)
       
   963         // values are also updated to volume popup.
       
   964         TPhoneCmdParamInteger volumeParam;
       
   965         volumeParam.SetInteger( valueToControl );
       
   966         iViewCommandHandle->ExecuteCommandL(
       
   967             EPhoneViewSetNaviPaneAudioVolume,
       
   968             &volumeParam );
       
   969         }
       
   970     }
   831     }
   971 
   832 
   972 // <-------------------------- COMMON STATE FUNCTIONS ------------------------>
   833 // <-------------------------- COMMON STATE FUNCTIONS ------------------------>
   973 // -----------------------------------------------------------
   834 // -----------------------------------------------------------
   974 // CPhoneState::DialMultimediaCallL
   835 // CPhoneState::DialMultimediaCallL
   993     __ASSERT_DEBUG( iStateMachine->PhoneEngineInfo(), Panic( EPhoneCtrlInvariant ) );
   854     __ASSERT_DEBUG( iStateMachine->PhoneEngineInfo(), Panic( EPhoneCtrlInvariant ) );
   994     TPhoneCmdParamBoolean globalNotifierParam;
   855     TPhoneCmdParamBoolean globalNotifierParam;
   995     globalNotifierParam.SetBoolean( ETrue );
   856     globalNotifierParam.SetBoolean( ETrue );
   996     iViewCommandHandle->ExecuteCommandL( EPhoneViewSetGlobalNotifiersDisabled,
   857     iViewCommandHandle->ExecuteCommandL( EPhoneViewSetGlobalNotifiersDisabled,
   997             &globalNotifierParam );
   858             &globalNotifierParam );
   998    iStateMachine->PhoneEngineInfo()->SetCallTypeCommand( EPECallTypeCSVoice );
   859     iStateMachine->PhoneEngineInfo()->SetCallTypeCommand( EPECallTypeCSVoice );
   999     iStateMachine->SendPhoneEngineMessage( MPEPhoneModel::EPEMessageDial );
   860     iStateMachine->SendPhoneEngineMessage( MPEPhoneModel::EPEMessageDial );
  1000     }
   861     }
  1001 
   862 
  1002 // -----------------------------------------------------------
   863 // -----------------------------------------------------------
  1003 // CPhoneState::DisconnectCallL
   864 // CPhoneState::DisconnectCallL
  1060 EXPORT_C void CPhoneState::UpdateSingleActiveCallL( TInt aCallId )
   921 EXPORT_C void CPhoneState::UpdateSingleActiveCallL( TInt aCallId )
  1061     {
   922     {
  1062     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::UpdateSingleActiveCallL( ) ");
   923     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::UpdateSingleActiveCallL( ) ");
  1063     BeginUiUpdateLC();
   924     BeginUiUpdateLC();
  1064 
   925 
  1065     iViewCommandHandle->ExecuteCommandL( EPhoneViewUpdateBubble, aCallId);
   926     UpdateCallHeaderAndUiCommandsL( aCallId );
  1066     
       
  1067     UpdateRemoteInfoDataL( aCallId );
       
  1068 
   927 
  1069     // Create call duration label if enabled
   928     // Create call duration label if enabled
  1070     // This key will be moved to some other area, but since key
   929     // This key will be moved to some other area, but since key
  1071     // is supported we can still use it.
   930     // is supported we can still use it.
  1072     TBool callDuration( EFalse );
   931     TBool callDuration( EFalse );
  1075 
   934 
  1076     if ( callDuration )
   935     if ( callDuration )
  1077         {
   936         {
  1078         HandleChangedCallDurationL( aCallId );
   937         HandleChangedCallDurationL( aCallId );
  1079         }
   938         }
  1080     UpdateUiCommands();
   939 
  1081     EndUiUpdate();
   940     EndUiUpdate();
  1082     
   941     
  1083     // If there is no need to send back ground and number entry is used then
   942     // If there is no need to send back ground and number entry is used then
  1084     // we must show number entry.
   943     // we must show number entry.
  1085     if ( iNumberEntryManager->IsNumberEntryUsedL() && !IsAutoLockOn() )
   944     if ( iNumberEntryManager->IsNumberEntryUsedL() && !IsAutoLockOn() )
  1111     
   970     
  1112     return waiting;
   971     return waiting;
  1113     }
   972     }
  1114 
   973 
  1115 // -----------------------------------------------------------
   974 // -----------------------------------------------------------
  1116 // CPhoneState::UpdateRemoteInfoDataL
   975 // CPhoneState::UpdateCallHeader
  1117 // -----------------------------------------------------------
   976 // -----------------------------------------------------------
  1118 //
   977 //
  1119 EXPORT_C void CPhoneState::UpdateRemoteInfoDataL( TInt aCallId )
   978 EXPORT_C void CPhoneState::UpdateCallHeader( TInt aCallId )
  1120     {
   979     {
  1121     __LOGMETHODSTARTEND( EPhoneControl, "CPhoneState::UpdateRemoteInfoDataL() ");
   980     __LOGMETHODSTARTEND( EPhoneControl, "CPhoneState::UpdateCallHeader() ");
  1122     /*TPhoneCmdParamCallHeaderData callHeaderParam = UpdateCallHeaderInfoL( aCallId );
       
  1123     if( iCustomization )
       
  1124         {
       
  1125         TBuf<KCntMaxTextFieldLength> inCallNumberText( KNullDesC );
       
  1126         // to check if we have VoIP call in question and fix
       
  1127         // parameters if needed
       
  1128         iCustomization->ModifyCallHeaderTexts( aCallId, &callHeaderParam,
       
  1129             inCallNumberText );
       
  1130         }*/
       
  1131     //TODO
       
  1132     // Update the remote info data in the call header
       
  1133     iViewCommandHandle->ExecuteCommandL(
   981     iViewCommandHandle->ExecuteCommandL(
  1134         EPhoneViewUpdateCallHeaderRemoteInfoData,
   982         EPhoneViewUpdateBubble,
  1135         aCallId );
   983         aCallId );
  1136     
   984     
  1137     }
   985     }
  1138 
   986 
       
   987 // -----------------------------------------------------------
       
   988 // CPhoneState::UpdateCallHeaderAndUiCommandsL
       
   989 // -----------------------------------------------------------
       
   990 //
       
   991 EXPORT_C void CPhoneState::UpdateCallHeaderAndUiCommandsL( TInt aCallId )
       
   992     {
       
   993     __LOGMETHODSTARTEND( EPhoneControl, 
       
   994             "CPhoneState::UpdateCallHeaderAndUiCommandsL() ");
       
   995     BeginUiUpdateLC();
       
   996     UpdateCallHeader( aCallId );
       
   997     UpdateUiCommands();
       
   998     EndUiUpdate();
       
   999     }
       
  1000 
  1139 // <-------------------------- CONTEXT MENU ------------------------->
  1001 // <-------------------------- CONTEXT MENU ------------------------->
  1140 
  1002 
  1141 // -----------------------------------------------------------
  1003 // -----------------------------------------------------------
  1142 // CPhoneState::ShowNoteL
  1004 // CPhoneState::ShowNoteL
  1143 // -----------------------------------------------------------
  1005 // -----------------------------------------------------------
  1144 //
  1006 //
  1145 EXPORT_C void CPhoneState::ShowNoteL( TInt aResourceId )
  1007 EXPORT_C void CPhoneState::ShowNoteL( TInt aResourceId )
  1146     {
  1008     {
  1147     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::ShowNoteL( ) ");
  1009     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::ShowNoteL( ) ");
  1148     __ASSERT_DEBUG( aResourceId, Panic( EPhoneCtrlParameterNotInitialized ) );
  1010     __ASSERT_DEBUG( aResourceId, Panic( EPhoneCtrlParameterNotInitialized ) );
  1149     TPhoneCmdParamNote noteParam;
  1011     PhoneNoteUtil::ShowNoteL( aResourceId );
  1150     noteParam.SetType( EPhoneNotePermanent );
       
  1151     noteParam.SetResourceId( CPhoneMainResourceResolver::Instance()->
       
  1152         ResolveResourceID( aResourceId ) );
       
  1153     iViewCommandHandle->ExecuteCommandL( EPhoneViewShowNote, &noteParam );
       
  1154     }
  1012     }
  1155 
  1013 
  1156 // -----------------------------------------------------------
  1014 // -----------------------------------------------------------
  1157 // CPhoneState::ShowQueryL
  1015 // CPhoneState::ShowQueryL
  1158 // -----------------------------------------------------------
  1016 // -----------------------------------------------------------
  1159 //
  1017 //
  1160 EXPORT_C void CPhoneState::ShowQueryL( TInt aResourceId )
  1018 EXPORT_C void CPhoneState::ShowQueryL( TInt aResourceId )
  1161     {
  1019     {
  1162     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::ShowQueryL( ) ");
  1020     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::ShowQueryL( ) ");
  1163     __ASSERT_DEBUG( aResourceId, Panic( EPhoneCtrlParameterNotInitialized ) );
  1021     __ASSERT_DEBUG( aResourceId, Panic( EPhoneCtrlParameterNotInitialized ) );
  1164     TPhoneCmdParamQuery queryParam;
  1022     PhoneNoteUtil::ShowQueryL( aResourceId );
  1165     queryParam.SetQueryType( EPhoneQueryDialog );
       
  1166     queryParam.SetQueryResourceId( CPhoneMainResourceResolver::Instance()->
       
  1167         ResolveResourceID( aResourceId ) );
       
  1168     iViewCommandHandle->ExecuteCommandL( EPhoneViewShowQuery, &queryParam );
       
  1169     }
  1023     }
  1170 
  1024 
  1171 // -----------------------------------------------------------
  1025 // -----------------------------------------------------------
  1172 // CPhoneState::ShowTextQueryL
  1026 // CPhoneState::ShowTextQueryL
  1173 // -----------------------------------------------------------
  1027 // -----------------------------------------------------------
  1182     __ASSERT_DEBUG( aDialogResourceId &&
  1036     __ASSERT_DEBUG( aDialogResourceId &&
  1183         aDefaultCbaResourceId &&
  1037         aDefaultCbaResourceId &&
  1184         aContentCbaResourceId &&
  1038         aContentCbaResourceId &&
  1185         aDataText,
  1039         aDataText,
  1186         Panic( EPhoneCtrlParameterNotInitialized ) );
  1040         Panic( EPhoneCtrlParameterNotInitialized ) );
  1187     TPhoneCmdParamQuery queryDialogParam;
  1041     
  1188     queryDialogParam.SetQueryType( EPhoneTextQueryDialog );
  1042     PhoneNoteUtil::ShowTextQueryL(
  1189     queryDialogParam.SetQueryResourceId( aDialogResourceId );
  1043             aDialogResourceId,
  1190     queryDialogParam.SetDefaultCba( aDefaultCbaResourceId );
  1044             aDefaultCbaResourceId,
  1191     queryDialogParam.SetContentCba( aContentCbaResourceId );
  1045             aContentCbaResourceId,
  1192     queryDialogParam.SetDataText( aDataText );
  1046             aDataText,
  1193     queryDialogParam.SetSendKeyEnabled( aSendKeyEnabled );
  1047             aSendKeyEnabled );
  1194     iViewCommandHandle->ExecuteCommandL( EPhoneViewShowQuery,
  1048 
  1195         &queryDialogParam );
       
  1196     }
  1049     }
  1197 
  1050 
  1198 // -----------------------------------------------------------
  1051 // -----------------------------------------------------------
  1199 // CPhoneState::DisplayCallTerminationNoteL
  1052 // CPhoneState::DisplayCallTerminationNoteL
  1200 // -----------------------------------------------------------
  1053 // -----------------------------------------------------------
  1233         TBuf<KPhoneMaxTimeDisplayTextLength> timeString( KNullDesC );
  1086         TBuf<KPhoneMaxTimeDisplayTextLength> timeString( KNullDesC );
  1234         time.FormatL( timeString, durationFormat );
  1087         time.FormatL( timeString, durationFormat );
  1235 
  1088 
  1236         noteText.Append( timeString );
  1089         noteText.Append( timeString );
  1237 
  1090 
  1238         TPhoneCmdParamGlobalNote globalNoteParam;
  1091         PhoneNoteUtil::SendGlobalNoteL(
  1239         globalNoteParam.SetType( EPhoneMessageBoxInformation );
  1092                 EPhoneMessageBoxInformation, noteText);
  1240         globalNoteParam.SetText( noteText );
       
  1241 
       
  1242         iViewCommandHandle->ExecuteCommandL(
       
  1243             EPhoneViewShowGlobalNote, &globalNoteParam );
       
  1244         }
  1093         }
  1245     }
  1094     }
  1246 
  1095 
  1247 // ---------------------------------------------------------
  1096 // ---------------------------------------------------------
  1248 // CPhoneState::SendGlobalInfoNoteL
  1097 // CPhoneState::SendGlobalInfoNoteL
  1251 EXPORT_C void CPhoneState::SendGlobalInfoNoteL( 
  1100 EXPORT_C void CPhoneState::SendGlobalInfoNoteL( 
  1252         TInt aResourceId, TBool aNotificationDialog )
  1101         TInt aResourceId, TBool aNotificationDialog )
  1253     {
  1102     {
  1254     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::SendGlobalInfoNoteL( ) ");
  1103     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::SendGlobalInfoNoteL( ) ");
  1255     __ASSERT_DEBUG( aResourceId, Panic( EPhoneCtrlParameterNotInitialized ) );
  1104     __ASSERT_DEBUG( aResourceId, Panic( EPhoneCtrlParameterNotInitialized ) );
  1256     
  1105     PhoneNoteUtil::SendGlobalInfoNoteL( aResourceId, aNotificationDialog );
  1257     // Avkon removal
       
  1258     TPhoneCmdParamBoolean globalNotifierParam;
       
  1259     globalNotifierParam.SetBoolean( EFalse );
       
  1260     iViewCommandHandle->ExecuteCommandL( EPhoneViewSetGlobalNotifiersDisabled,
       
  1261         &globalNotifierParam );
       
  1262 
       
  1263     TPhoneCmdParamGlobalNote globalNoteParam;
       
  1264     PhoneNotificationType type = aNotificationDialog ? 
       
  1265         EPhoneNotificationDialog : EPhoneMessageBoxInformation;
       
  1266     globalNoteParam.SetType( type );
       
  1267     globalNoteParam.SetTextResourceId(
       
  1268         CPhoneMainResourceResolver::Instance()->
       
  1269         ResolveResourceID( aResourceId ) );
       
  1270     globalNoteParam.SetNotificationDialog( aNotificationDialog );
       
  1271     
       
  1272     iViewCommandHandle->ExecuteCommandL(
       
  1273         EPhoneViewShowGlobalNote, &globalNoteParam );
       
  1274         
       
  1275     }
  1106     }
  1276 
  1107 
  1277 // ---------------------------------------------------------
  1108 // ---------------------------------------------------------
  1278 //  CPhoneUIController::SendGlobalWarningNoteL
  1109 //  CPhoneUIController::SendGlobalWarningNoteL
  1279 // ---------------------------------------------------------
  1110 // ---------------------------------------------------------
  1281 EXPORT_C void CPhoneState::SendGlobalWarningNoteL( 
  1112 EXPORT_C void CPhoneState::SendGlobalWarningNoteL( 
  1282         TInt aResourceId, TBool aNotificationDialog )
  1113         TInt aResourceId, TBool aNotificationDialog )
  1283     {
  1114     {
  1284     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::SendGlobalWarningNoteL( ) ");
  1115     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::SendGlobalWarningNoteL( ) ");
  1285     __ASSERT_DEBUG( aResourceId, Panic( EPhoneCtrlParameterNotInitialized ) );
  1116     __ASSERT_DEBUG( aResourceId, Panic( EPhoneCtrlParameterNotInitialized ) );
  1286     if ( SimState() == EPESimReadable )
  1117     PhoneNoteUtil::SendGlobalWarningNoteL( aResourceId, aNotificationDialog );
  1287         {
       
  1288         TPhoneCmdParamBoolean globalNotifierParam;
       
  1289         globalNotifierParam.SetBoolean( EFalse );
       
  1290         iViewCommandHandle->ExecuteCommandL( EPhoneViewSetGlobalNotifiersDisabled,
       
  1291             &globalNotifierParam );
       
  1292 
       
  1293         TPhoneCmdParamGlobalNote globalNoteParam;
       
  1294         PhoneNotificationType type = aNotificationDialog ? 
       
  1295                     EPhoneNotificationDialog : EPhoneMessageBoxWarning;
       
  1296         globalNoteParam.SetType( type );
       
  1297         globalNoteParam.SetTextResourceId(
       
  1298             CPhoneMainResourceResolver::Instance()->
       
  1299             ResolveResourceID( aResourceId ) );
       
  1300         globalNoteParam.SetNotificationDialog( aNotificationDialog );
       
  1301         
       
  1302         iViewCommandHandle->ExecuteCommandL(
       
  1303             EPhoneViewShowGlobalNote, &globalNoteParam );
       
  1304         }
       
  1305     }
  1118     }
  1306 
  1119 
  1307 // ---------------------------------------------------------
  1120 // ---------------------------------------------------------
  1308 //  CPhoneUIController::SendGlobalErrorNoteL
  1121 //  CPhoneUIController::SendGlobalErrorNoteL
  1309 // ---------------------------------------------------------
  1122 // ---------------------------------------------------------
  1311 EXPORT_C void CPhoneState::SendGlobalErrorNoteL( 
  1124 EXPORT_C void CPhoneState::SendGlobalErrorNoteL( 
  1312         TInt aResourceId, TBool aNotificationDialog )
  1125         TInt aResourceId, TBool aNotificationDialog )
  1313     {
  1126     {
  1314     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::SendGlobalErrorNoteL( ) ");
  1127     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::SendGlobalErrorNoteL( ) ");
  1315     __ASSERT_DEBUG( aResourceId, Panic( EPhoneCtrlParameterNotInitialized ) );
  1128     __ASSERT_DEBUG( aResourceId, Panic( EPhoneCtrlParameterNotInitialized ) );
  1316 
  1129     PhoneNoteUtil::SendGlobalErrorNoteL( aResourceId, aNotificationDialog );
  1317     TPhoneCmdParamBoolean globalNotifierParam;
       
  1318     globalNotifierParam.SetBoolean( EFalse );
       
  1319     iViewCommandHandle->ExecuteCommandL( EPhoneViewSetGlobalNotifiersDisabled,
       
  1320         &globalNotifierParam );
       
  1321 
       
  1322     TPhoneCmdParamGlobalNote globalNoteParam;
       
  1323     PhoneNotificationType type = aNotificationDialog ? 
       
  1324                 EPhoneNotificationDialog : EPhoneMessageBoxInformation;
       
  1325     globalNoteParam.SetType( type );
       
  1326     
       
  1327     globalNoteParam.SetTextResourceId(
       
  1328         CPhoneMainResourceResolver::Instance()->
       
  1329         ResolveResourceID( aResourceId ) );
       
  1330     globalNoteParam.SetNotificationDialog( aNotificationDialog );
       
  1331 
       
  1332     iViewCommandHandle->ExecuteCommandL(
       
  1333         EPhoneViewShowGlobalNote, &globalNoteParam );
       
  1334 
       
  1335     }
  1130     }
  1336 
  1131 
  1337 // ---------------------------------------------------------
  1132 // ---------------------------------------------------------
  1338 // CPhoneState::SetHandsfreeModeL
  1133 // CPhoneState::SetHandsfreeModeL
  1339 // ---------------------------------------------------------
  1134 // ---------------------------------------------------------
  1340 //
  1135 //
  1341 EXPORT_C void CPhoneState::SetHandsfreeModeL( TBool aHandsfreeMode )
  1136 EXPORT_C void CPhoneState::SetHandsfreeModeL( TBool aHandsfreeMode )
  1342     {
  1137     {
  1343     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::SetHandsfreeModeL( ) ");
  1138     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::SetHandsfreeModeL( ) ");
  1344     CPhoneAccessoryBTHandler* bt = CPhoneAccessoryBTHandler::NewLC(
  1139     PhoneAudioUtil::SetHandsfreeModeL( aHandsfreeMode );
  1345         iViewCommandHandle, iStateMachine, this );
       
  1346     if ( !bt->SetHandsfreeModeL( aHandsfreeMode ))
       
  1347         {
       
  1348         SendGlobalErrorNoteL( EPhoneNoteTextNotAllowed, ETrue );
       
  1349         }
       
  1350     CleanupStack::PopAndDestroy( bt );
       
  1351     }
  1140     }
  1352 
  1141 
  1353 // ---------------------------------------------------------
  1142 // ---------------------------------------------------------
  1354 // CPhoneState::SetBTHandsfreeModeL
  1143 // CPhoneState::SetBTHandsfreeModeL
  1355 // ---------------------------------------------------------
  1144 // ---------------------------------------------------------
  1356 //
  1145 //
  1357 EXPORT_C void CPhoneState::SetBTHandsfreeModeL( TBool aHandsfreeMode )
  1146 EXPORT_C void CPhoneState::SetBTHandsfreeModeL( TBool aHandsfreeMode )
  1358     {
  1147     {
  1359     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::SetBTHandsfreeModeL( ) ");
  1148     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::SetBTHandsfreeModeL( ) ");
  1360     CPhoneAccessoryBTHandler* bt = CPhoneAccessoryBTHandler::NewLC(
  1149     PhoneAudioUtil::SetBtHandsfreeModeL( aHandsfreeMode );
  1361         iViewCommandHandle, iStateMachine, this );
       
  1362     if ( !bt->SetBTHandsfreeModeL( aHandsfreeMode ))
       
  1363         {
       
  1364         SendGlobalErrorNoteL( EPhoneNoteTextNotAllowed, ETrue );
       
  1365         }
       
  1366     CleanupStack::PopAndDestroy( bt );
       
  1367     }
  1150     }
  1368 
  1151 
  1369 // <-------------------------- INTERNAL FUNCTIONS ------------------------>
  1152 // <-------------------------- INTERNAL FUNCTIONS ------------------------>
  1370 // -----------------------------------------------------------
  1153 // -----------------------------------------------------------
  1371 // CPhoneState::HandleInitiatedEmergencyCallL
  1154 // CPhoneState::HandleInitiatedEmergencyCallL
  1425         {
  1208         {
  1426         return EFalse;
  1209         return EFalse;
  1427         }
  1210         }
  1428 
  1211 
  1429     return EPECallTypeVideo == iStateMachine->PhoneEngineInfo()->CallType( aCallId );
  1212     return EPECallTypeVideo == iStateMachine->PhoneEngineInfo()->CallType( aCallId );
  1430     }
       
  1431 
       
  1432 // ---------------------------------------------------------
       
  1433 // CPhoneState::GetActiveCallIdL()
       
  1434 // ---------------------------------------------------------
       
  1435 //
       
  1436 TInt CPhoneState::GetActiveCallIdL()
       
  1437     {
       
  1438     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::GetActiveCallId()( ) ");
       
  1439     // Fetch active call's id from view
       
  1440     TPhoneViewResponseId response;
       
  1441     TPhoneCmdParamCallStateData callStateData;
       
  1442     callStateData.SetCallState( EPEStateConnected );
       
  1443     response = iViewCommandHandle->HandleCommandL(
       
  1444         EPhoneViewGetCallIdByState, &callStateData );
       
  1445 
       
  1446     if ( response == EPhoneViewResponseSuccess &&
       
  1447          callStateData.CallId() < 0 )  // no connected calls
       
  1448         {
       
  1449         // check for held call
       
  1450         callStateData.SetCallState( EPEStateHeld );
       
  1451         response = iViewCommandHandle->HandleCommandL(
       
  1452             EPhoneViewGetCallIdByState, &callStateData );
       
  1453         }
       
  1454     return callStateData.CallId();
       
  1455     }
  1213     }
  1456 
  1214 
  1457 // ---------------------------------------------------------
  1215 // ---------------------------------------------------------
  1458 // CPhoneState::SimState()
  1216 // CPhoneState::SimState()
  1459 // ---------------------------------------------------------
  1217 // ---------------------------------------------------------
  1648 //
  1406 //
  1649 void CPhoneState::HandleAudioAvailableOutputChangedL()
  1407 void CPhoneState::HandleAudioAvailableOutputChangedL()
  1650     {
  1408     {
  1651     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::HandleAudioAvailableOutputChangedL() ");
  1409     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::HandleAudioAvailableOutputChangedL() ");
  1652     __ASSERT_DEBUG( iStateMachine->PhoneEngineInfo(), Panic( EPhoneCtrlInvariant ) );
  1410     __ASSERT_DEBUG( iStateMachine->PhoneEngineInfo(), Panic( EPhoneCtrlInvariant ) );
  1653     TPhoneCmdParamAudioAvailability outputParam;
  1411     PhoneAudioUtil::HandleAudioAvailableOutputChangedL();
  1654     // Output
       
  1655     const TPEAudioOutput audioOutput =
       
  1656         iStateMachine->PhoneEngineInfo()->AudioOutput();
       
  1657     // BT availability
       
  1658     TBool btAvailable = iStateMachine->PhoneEngineInfo()->AudioOutputAvailable(
       
  1659             EPEBTAudioAccessory );
       
  1660     outputParam.SetBTAccAvailable( btAvailable );
       
  1661     // Wired availability
       
  1662     TBool wiredAvailable = iStateMachine->PhoneEngineInfo()->AudioOutputAvailable(
       
  1663             EPEWiredAudioAccessory );
       
  1664     outputParam.SetWiredAccAvailable( wiredAvailable );
       
  1665     // BTA disconnect handler check
       
  1666     if( btAvailable )
       
  1667         {
       
  1668         CPhoneBtaaDisconnectHandler::InstanceL()->Cancel();
       
  1669         }
       
  1670     iViewCommandHandle->ExecuteCommandL( 
       
  1671             EPhoneViewActivateAudioAvailabilityUIChanges,
       
  1672             &outputParam );
       
  1673     }
  1412     }
  1674 
  1413 
  1675 // ---------------------------------------------------------
  1414 // ---------------------------------------------------------
  1676 // CPhoneState::ShowNumberBusyNoteL
  1415 // CPhoneState::ShowNumberBusyNoteL
  1677 // ---------------------------------------------------------
  1416 // ---------------------------------------------------------
  1678 //
  1417 //
  1679 EXPORT_C void CPhoneState::ShowNumberBusyNoteL()
  1418 EXPORT_C void CPhoneState::ShowNumberBusyNoteL()
  1680     {
  1419     {
  1681     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::ShowNumberBusyNoteL( ) ");
  1420     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::ShowNumberBusyNoteL( ) ");
  1682     TPhoneCmdParamBoolean globalNotifierParam;
       
  1683     globalNotifierParam.SetBoolean( EFalse );
       
  1684     iViewCommandHandle->ExecuteCommandL( EPhoneViewSetGlobalNotifiersDisabled,
       
  1685         &globalNotifierParam );
       
  1686 
  1421 
  1687     TInt resource( EPhoneNumberBusy );
  1422     TInt resource( EPhoneNumberBusy );
  1688     if( iCustomization )
  1423     if( iCustomization )
  1689         {
  1424         {
  1690         // Get customized text resource for busy note
  1425         // Get customized text resource for busy note
  1691         resource = iCustomization->CustomizeBusyNoteText();
  1426         resource = iCustomization->CustomizeBusyNoteText();
  1692         }
  1427         }
  1693 
       
  1694     // Show number busy notification
       
  1695     TPhoneCmdParamGlobalNote globalNoteParam;
       
  1696     globalNoteParam.SetType( EPhoneNotificationDialog );
       
  1697     globalNoteParam.SetTextResourceId(
       
  1698         CPhoneMainResourceResolver::Instance()->
       
  1699         ResolveResourceID( resource ) );
       
  1700     
  1428     
  1701     globalNoteParam.SetNotificationDialog( ETrue );
  1429     PhoneNoteUtil::SendGlobalNoteL( resource, ETrue );
  1702     iViewCommandHandle->ExecuteCommandL( EPhoneViewShowGlobalNote,
       
  1703         &globalNoteParam );
       
  1704     }
  1430     }
  1705 
  1431 
  1706 // ---------------------------------------------------------
  1432 // ---------------------------------------------------------
  1707 // CPhoneState::IsAutoLockOn
  1433 // CPhoneState::IsAutoLockOn
  1708 // ---------------------------------------------------------
  1434 // ---------------------------------------------------------
  1808     
  1534     
  1809     TPhoneCmdParamBoolean globalNotifierParam;
  1535     TPhoneCmdParamBoolean globalNotifierParam;
  1810     globalNotifierParam.SetBoolean( EFalse );
  1536     globalNotifierParam.SetBoolean( EFalse );
  1811     iViewCommandHandle->ExecuteCommandL( EPhoneViewSetGlobalNotifiersDisabled,
  1537     iViewCommandHandle->ExecuteCommandL( EPhoneViewSetGlobalNotifiersDisabled,
  1812         &globalNotifierParam );
  1538         &globalNotifierParam );
  1813     iViewCommandHandle->ExecuteCommandL( EPhoneViewSetEikonNotifiersDisabled,
       
  1814         &globalNotifierParam );
       
  1815     
  1539     
  1816     // Restore keylock if phone has been locked before call.
  1540     // Restore keylock if phone has been locked before call.
  1817     if ( iStateMachine->PhoneStorage()->NeedToEnableKeylock() )
  1541     if ( iStateMachine->PhoneStorage()->NeedToEnableKeylock() )
  1818         {
  1542         {
  1819         iViewCommandHandle->ExecuteCommandL( EPhoneViewEnableKeyLock );
  1543         iViewCommandHandle->ExecuteCommandL( EPhoneViewEnableKeyLock );
  1820         iStateMachine->PhoneStorage()->SetNeedToEnableKeylock( EFalse );
  1544         iStateMachine->PhoneStorage()->SetNeedToEnableKeylock( EFalse );
  1821         }
  1545         }
  1822     }
       
  1823 
       
  1824 // -----------------------------------------------------------
       
  1825 // CPhoneState::GetVolumeLevel
       
  1826 // -----------------------------------------------------------
       
  1827 //
       
  1828 TInt CPhoneState::GetVolumeLevel()
       
  1829     {
       
  1830     TPhoneCmdParamInteger integerParam;
       
  1831     iViewCommandHandle->ExecuteCommand( EPhoneViewGetAudioVolumeLevel,
       
  1832                                         &integerParam );
       
  1833     return integerParam.Integer();
       
  1834     }
  1546     }
  1835 
  1547 
  1836 // -----------------------------------------------------------
  1548 // -----------------------------------------------------------
  1837 // CPhoneState::ShowVideoCallOutOfMemoryNoteL
  1549 // CPhoneState::ShowVideoCallOutOfMemoryNoteL
  1838 // -----------------------------------------------------------
  1550 // -----------------------------------------------------------
  1847         &globalNotifierParam );
  1559         &globalNotifierParam );
  1848     
  1560     
  1849     iViewCommandHandle->ExecuteCommandL( EPhoneViewBringPhoneAppToForeground );
  1561     iViewCommandHandle->ExecuteCommandL( EPhoneViewBringPhoneAppToForeground );
  1850     
  1562     
  1851     // Display error note
  1563     // Display error note
  1852     SExtendedError ext;
  1564     /*SExtendedError ext;
  1853     ext.iComponent = KUidPhoneApplication;
  1565     ext.iComponent = KUidPhoneApplication;
  1854     ext.iErrorNumber = KErrNoMemory;
  1566     ext.iErrorNumber = KErrNoMemory;
  1855     ext.iInformation = EFalse;
  1567     ext.iInformation = EFalse;
  1856     TBuf<1> ignore;
  1568     TBuf<1> ignore;
  1857     iAvkonAppUi->HandleError( KErrNoMemory, ext, ignore, ignore );
  1569     iAvkonAppUi->HandleError( KErrNoMemory, ext, ignore, ignore );*/
       
  1570     //TODO show note
  1858     }
  1571     }
  1859 
  1572 
  1860 // -----------------------------------------------------------------------------
  1573 // -----------------------------------------------------------------------------
  1861 // CPhoneState::SimSecurityStatus
  1574 // CPhoneState::SimSecurityStatus
  1862 // -----------------------------------------------------------------------------
  1575 // -----------------------------------------------------------------------------
  1987         // Add it to the resource string
  1700         // Add it to the resource string
  1988         HBufC* buf = StringLoader::LoadLC(
  1701         HBufC* buf = StringLoader::LoadLC(
  1989             CPhoneMainResourceResolver::Instance()->
  1702             CPhoneMainResourceResolver::Instance()->
  1990             ResolveResourceID(
  1703             ResolveResourceID(
  1991             EPhoneInfoCugInUse ), cugIndex );
  1704             EPhoneInfoCugInUse ), cugIndex );
  1992         TPhoneCmdParamGlobalNote globalNoteParam;
  1705         
  1993         globalNoteParam.SetText( *buf );
  1706         PhoneNoteUtil::SendGlobalNoteL(
  1994         globalNoteParam.SetType( EPhoneMessageBoxInformation );
  1707                 EPhoneMessageBoxInformation, *buf );
  1995         iViewCommandHandle->ExecuteCommandL(
  1708 
  1996                 EPhoneViewShowGlobalNote, &globalNoteParam );
       
  1997         CleanupStack::PopAndDestroy( buf );
  1709         CleanupStack::PopAndDestroy( buf );
  1998         }
  1710         }
  1999     }
  1711     }
  2000 
  1712 
  2001 // ---------------------------------------------------------------------------
  1713 // ---------------------------------------------------------------------------