phoneapp/phoneuicontrol/src/cphonestate.cpp
branchRCL_3
changeset 20 3c221667e687
parent 14 b8d67d6176f5
child 23 40a3f856b14d
equal deleted inserted replaced
14:b8d67d6176f5 20:3c221667e687
   369             accessoryBtHandler = CPhoneAccessoryBTHandler::NewLC(
   369             accessoryBtHandler = CPhoneAccessoryBTHandler::NewLC(
   370                 iViewCommandHandle, iStateMachine, this );
   370                 iViewCommandHandle, iStateMachine, this );
   371             accessoryBtHandler->SetBTDebugModeL();
   371             accessoryBtHandler->SetBTDebugModeL();
   372             CleanupStack::PopAndDestroy( accessoryBtHandler );
   372             CleanupStack::PopAndDestroy( accessoryBtHandler );
   373             break;
   373             break;
       
   374         
       
   375         case MEngineMonitor::EPEMessageInitiatedMoCall:
       
   376             // Message should be only handled by CPhoneStateIdle, 
       
   377             // if state is something else than idle then do nothing.
       
   378             break;
   374 
   379 
   375         default:
   380         default:
   376 
   381 
   377             TBool handled( EFalse );
   382             TBool handled( EFalse );
   378 
   383 
   736                     }
   741                     }
   737                 }
   742                 }
   738             }
   743             }
   739             break;
   744             break;
   740 
   745 
   741             case ECCPErrorCCServiceNotAvailable:
   746         case ECCPErrorCCServiceNotAvailable:
       
   747             {
       
   748             if( IsVideoCall( aErrorInfo.iCallId ) )
   742                 {
   749                 {
   743                 if( IsVideoCall( aErrorInfo.iCallId ) )
   750                 CPhoneReconnectQuery::InstanceL()->ShowReconnectQueryL( EFalse );
   744     				{
       
   745     			    CPhoneReconnectQuery::InstanceL()->ShowReconnectQueryL( EFalse );
       
   746     				}
       
   747                 }
   751                 }
   748                 break;
   752             }
   749 
   753             break;
   750             case ECCPErrorBadRequest:
   754 
       
   755         case ECCPErrorBadRequest:
       
   756             {
       
   757             TPECallType callType =
       
   758                 iStateMachine->PhoneEngineInfo()->CallTypeCommand();
       
   759 
       
   760             if( callType == EPECallTypeVideo )
   751                 {
   761                 {
   752                 TPECallType callType =
   762                     // Dialling MO video call cannot reach 3G network.
   753                     iStateMachine->PhoneEngineInfo()->CallTypeCommand();
   763                     __PHONELOG1( EBasic, EPhoneControl,
   754 
   764                         "PhoneUIControl: CPhoneState::HandleErrorL - ShowReconnectQueryL vid 2, callid%d ",
   755                 if( callType == EPECallTypeVideo )
   765                         aErrorInfo.iCallId );
   756                     {
   766                     CPhoneReconnectQuery::InstanceL()->ShowReconnectQueryL( ETrue );
   757                         // Dialling MO video call cannot reach 3G network.
       
   758                         __PHONELOG1( EBasic, EPhoneControl,
       
   759                             "PhoneUIControl: CPhoneState::HandleErrorL - ShowReconnectQueryL vid 2, callid%d ",
       
   760                             aErrorInfo.iCallId );
       
   761                         CPhoneReconnectQuery::InstanceL()->ShowReconnectQueryL( ETrue );
       
   762                     }
       
   763                 }
   767                 }
   764                 break;
   768             }
   765 
   769             break;
   766         case ECCPErrorVideoCallNotSupportedByNetwork:
   770 
       
   771         case ECCPErrorVideoCallNotSupportedByNetwork: // Flow trough
   767         case ECCPErrorVideoCallSetupFailed:
   772         case ECCPErrorVideoCallSetupFailed:
   768         case ECCPErrorNotReached:
   773         case ECCPErrorNotReached:
   769            // If call id found and seems to be Video Call
   774         case ECCPErrorCCBearerCapabilityNotCurrentlyAvailable:
       
   775         case ECCPErrorCCBearerCapabilityNotAuthorised:
       
   776         case ECCPErrorServiceSettingError:
       
   777         case ECCPErrorNoAnswerForVideo:
       
   778             {
       
   779             // If call id found and seems to be Video Call
   770             if ( IsVideoCall( aErrorInfo.iCallId ) )
   780             if ( IsVideoCall( aErrorInfo.iCallId ) )
   771                 {
   781                 {
   772                 // Get active call count
   782                 // Get active call count
   773                 TPhoneCmdParamInteger activeCallCount;
   783                 TPhoneCmdParamInteger activeCallCount;
   774                 iViewCommandHandle->ExecuteCommandL(
   784                 iViewCommandHandle->ExecuteCommandL(
   786                     aErrorInfo.iCallId );
   796                     aErrorInfo.iCallId );
   787                     CPhoneReconnectQuery::InstanceL()->ShowReconnectQueryL(
   797                     CPhoneReconnectQuery::InstanceL()->ShowReconnectQueryL(
   788                               ECCPErrorNotReached == aErrorInfo.iErrorCode );
   798                               ECCPErrorNotReached == aErrorInfo.iErrorCode );
   789                     }
   799                     }
   790                 }
   800                 }
       
   801             }
   791             break;
   802             break;
   792 
   803 
   793         case ECCPErrorNoService:
   804         case ECCPErrorNoService:
   794             // No network -> hide volume popup
   805             // No network -> hide volume popup
   795             iViewCommandHandle->ExecuteCommandL( EPhoneViewHideNaviPaneAudioVolume );
   806             iViewCommandHandle->ExecuteCommandL( EPhoneViewHideNaviPaneAudioVolume );
  1770 // CPhoneState::ProcessCommandL
  1781 // CPhoneState::ProcessCommandL
  1771 // -----------------------------------------------------------------------------
  1782 // -----------------------------------------------------------------------------
  1772 //
  1783 //
  1773 EXPORT_C TBool CPhoneState::ProcessCommandL( TInt /*aCommand*/ )
  1784 EXPORT_C TBool CPhoneState::ProcessCommandL( TInt /*aCommand*/ )
  1774     {
  1785     {
  1775     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneStateIdle::ProcessCommandL() ");
  1786     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::ProcessCommandL() ");
  1776     // no implementation.
  1787     // no implementation.
  1777     return EFalse;
  1788     return EFalse;
  1778     }
  1789     }
  1779 
  1790 
  1780 // <-------------------------- REMOTE CONTROL EVENTS ------------------------->
  1791 // <-------------------------- REMOTE CONTROL EVENTS ------------------------->
  2197     {
  2208     {
  2198     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::DisplayHeaderForOutgoingCallL( ) ");
  2209     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::DisplayHeaderForOutgoingCallL( ) ");
  2199     CallheaderManagerL()->DisplayHeaderForOutgoingCallL(aCallId);
  2210     CallheaderManagerL()->DisplayHeaderForOutgoingCallL(aCallId);
  2200     }
  2211     }
  2201 
  2212 
       
  2213 
       
  2214 // -----------------------------------------------------------
       
  2215 // CPhoneState::DisplayHeaderForInitializingCallL
       
  2216 // -----------------------------------------------------------
       
  2217 //
       
  2218 EXPORT_C void CPhoneState::DisplayHeaderForInitializingCallL( TInt aCallId )
       
  2219     {
       
  2220     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::DisplayHeaderForInitializingCallL( ) ");
       
  2221     CallheaderManagerL()->DisplayHeaderForInitializingCallL( aCallId );
       
  2222     }
       
  2223 	
  2202 // -----------------------------------------------------------
  2224 // -----------------------------------------------------------
  2203 // CPhoneState::UpdateSingleActiveCallL
  2225 // CPhoneState::UpdateSingleActiveCallL
  2204 // -----------------------------------------------------------
  2226 // -----------------------------------------------------------
  2205 //
  2227 //
  2206 EXPORT_C void CPhoneState::UpdateSingleActiveCallL( TInt aCallId )
  2228 EXPORT_C void CPhoneState::UpdateSingleActiveCallL( TInt aCallId )
  2209 
  2231 
  2210     // Stop capturing keys
  2232     // Stop capturing keys
  2211     CaptureKeysDuringCallNotificationL( EFalse );
  2233     CaptureKeysDuringCallNotificationL( EFalse );
  2212 
  2234 
  2213     BeginUiUpdateLC();
  2235     BeginUiUpdateLC();
       
  2236 
       
  2237     SetTouchPaneButtonEnabled( EPhoneInCallCmdHold );
  2214 
  2238 
  2215     // Update call state
  2239     // Update call state
  2216     TPhoneCmdParamCallHeaderData callHeaderParam;
  2240     TPhoneCmdParamCallHeaderData callHeaderParam;
  2217     callHeaderParam.SetCallState( EPEStateConnected );
  2241     callHeaderParam.SetCallState( EPEStateConnected );
  2218     iViewCommandHandle->ExecuteCommandL( EPhoneViewUpdateBubble, aCallId,
  2242     iViewCommandHandle->ExecuteCommandL( EPhoneViewUpdateBubble, aCallId,
  2725 //
  2749 //
  2726 void CPhoneState::UpdateIncallIndicatorL( TInt aCallState )
  2750 void CPhoneState::UpdateIncallIndicatorL( TInt aCallState )
  2727     {
  2751     {
  2728     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::UpdateIncallIndicatorL( ) ");
  2752     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::UpdateIncallIndicatorL( ) ");
  2729     TPhoneCmdParamIncallIndicatorData incallIndicatorParam;
  2753     TPhoneCmdParamIncallIndicatorData incallIndicatorParam;
  2730 
  2754     // Set the state.
  2731     // Set the state
       
  2732     incallIndicatorParam.SetCallState( aCallState );
  2755     incallIndicatorParam.SetCallState( aCallState );
  2733 
  2756 
       
  2757     if((aCallState == EPSCTsyCallStateUninitialized) || 
       
  2758        (aCallState == EPSCTsyCallStateNone))
       
  2759         {
       
  2760         incallIndicatorParam.SetLittleBubbleVisible( EFalse );
       
  2761         }
       
  2762     else
       
  2763         {
       
  2764         SetLittleBubbleVisibilityL(&incallIndicatorParam);
       
  2765         }
       
  2766     
  2734     // Set mode
  2767     // Set mode
  2735     incallIndicatorParam.SetMode(
  2768     incallIndicatorParam.SetMode(
  2736        CPhonePubSubProxy::Instance()->Value(
  2769        CPhonePubSubProxy::Instance()->Value(
  2737             KPSUidCtsyCallInformation,
  2770             KPSUidCtsyCallInformation,
  2738             KCTsyCallType ) );
  2771             KCTsyCallType ) );
  2739 
  2772             
  2740     TInt activeCallId = GetActiveCallIdL();
  2773     TInt activeCallId = GetActiveCallIdL();
  2741     if ( activeCallId > KErrNone )
  2774     if ( activeCallId > KErrNone )
  2742         {
  2775         {
  2743         if ( iStateMachine->PhoneEngineInfo()->CallALSLine( activeCallId )
  2776         if ( iStateMachine->PhoneEngineInfo()->CallALSLine( activeCallId )
  2744              == CCCECallParameters::ECCELineTypeAux )
  2777              == CCCECallParameters::ECCELineTypeAux )
  2750     // Set the mute status
  2783     // Set the mute status
  2751     const TBool audioMute = iStateMachine->PhoneEngineInfo()->AudioMute();
  2784     const TBool audioMute = iStateMachine->PhoneEngineInfo()->AudioMute();
  2752     incallIndicatorParam.SetMute( audioMute );
  2785     incallIndicatorParam.SetMute( audioMute );
  2753 
  2786 
  2754     // Set the voice privacy status
  2787     // Set the voice privacy status
  2755     if ( activeCallId > KErrNotFound &&
  2788     if ( activeCallId > KErrNotFound && activeCallId != KConferenceCallId  )
  2756          activeCallId != KConferenceCallId  )
       
  2757         {
  2789         {
  2758         incallIndicatorParam.SetCiphering(
  2790         incallIndicatorParam.SetCiphering(
  2759             iStateMachine->PhoneEngineInfo()->IsSecureCall( activeCallId ) );
  2791             iStateMachine->PhoneEngineInfo()->IsSecureCall( activeCallId ) );
  2760         }
  2792         }
  2761     else
  2793     else
  2769     // Set the emergency status
  2801     // Set the emergency status
  2770     if( EPEStateIdle != iStateMachine->PhoneEngineInfo()->CallState( KPEEmergencyCallId ) )
  2802     if( EPEStateIdle != iStateMachine->PhoneEngineInfo()->CallState( KPEEmergencyCallId ) )
  2771         {
  2803         {
  2772         incallIndicatorParam.SetEmergency( ETrue );
  2804         incallIndicatorParam.SetEmergency( ETrue );
  2773         }
  2805         }
  2774 
  2806     
  2775     if( aCallState == EPSCTsyCallStateDisconnecting )
       
  2776         {
       
  2777         if ( TopAppIsDisplayedL() )
       
  2778             {
       
  2779             if ( ( !IsOnScreenDialerSupported() ) ||
       
  2780                  ( IsOnScreenDialerSupported() && !IsNumberEntryVisibleL() ) )
       
  2781                 {
       
  2782                 // Phone application is in the foreground so we don't need to
       
  2783                 // display the little bubble. If we don't hide it here then
       
  2784                 // it will appear for a short time. We don't want that.
       
  2785                 incallIndicatorParam.SetLittleBubbleVisible( EFalse );
       
  2786                 }
       
  2787             }
       
  2788         }
       
  2789     // TODO: Refactor -> this looks really dubious.
       
  2790     else
       
  2791         {
       
  2792         incallIndicatorParam.SetLittleBubbleVisible( ETrue );
       
  2793         }
       
  2794 
       
  2795     // Update the in-call indicator
  2807     // Update the in-call indicator
  2796     iViewCommandHandle->ExecuteCommandL( EPhoneViewUpdateIncallIndicator,
  2808     iViewCommandHandle->ExecuteCommandL( EPhoneViewUpdateIncallIndicator,
  2797         &incallIndicatorParam );
  2809         &incallIndicatorParam );
  2798     }
  2810     }
  2799 
  2811 
  3061     {
  3073     {
  3062     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::HandleInitiatedEmergencyWhileActiveVideoL( ) ");
  3074     __LOGMETHODSTARTEND(EPhoneControl, "CPhoneState::HandleInitiatedEmergencyWhileActiveVideoL( ) ");
  3063 
  3075 
  3064     // We have existing video call so need to release dataport before continuing
  3076     // We have existing video call so need to release dataport before continuing
  3065     // emergency call. Otherwise we will face problems with dataport use later.
  3077     // emergency call. Otherwise we will face problems with dataport use later.
  3066     CPhoneMediatorFactory::Instance()->Sender()->IssueCommand( KMediatorVideoTelephonyDomain,
  3078     CPhoneMediatorFactory::Instance()->Sender()->IssueCommand( 
  3067                                                                      KCatPhoneToVideotelCommands,
  3079             KMediatorVideoTelephonyDomain,
  3068                                                                      EVtCmdReleaseDataport,
  3080             KCatPhoneToVideotelCommands,
  3069                                                                TVersion( KPhoneToVideotelCmdVersionMajor,
  3081             EVtCmdReleaseDataport,
  3070                                                                          KPhoneToVideotelCmdVersionMinor,
  3082             TVersion( KPhoneToVideotelCmdVersionMajor,
  3071                                                                          KPhoneToVideotelCmdVersionBuild ),
  3083                     KPhoneToVideotelCmdVersionMinor,
  3072                                                                KNullDesC8,
  3084                     KPhoneToVideotelCmdVersionBuild ),
  3073                                                                CPhoneContinueEmergencyCallCommand::NewL( *iStateMachine ) );
  3085             KNullDesC8,
       
  3086             CPhoneContinueEmergencyCallCommand::NewL( *iStateMachine ) );
  3074     }
  3087     }
  3075 
  3088 
  3076 // -----------------------------------------------------------
  3089 // -----------------------------------------------------------
  3077 // CPhoneState::HandleShowImeiL
  3090 // CPhoneState::HandleShowImeiL
  3078 // -----------------------------------------------------------
  3091 // -----------------------------------------------------------
  3752 //
  3765 //
  3753 EXPORT_C void CPhoneState::SetTouchPaneButtons( TInt aResourceId )
  3766 EXPORT_C void CPhoneState::SetTouchPaneButtons( TInt aResourceId )
  3754     {
  3767     {
  3755     if ( FeatureManager::FeatureSupported( KFeatureIdTouchCallHandling ) )
  3768     if ( FeatureManager::FeatureSupported( KFeatureIdTouchCallHandling ) )
  3756         {
  3769         {
       
  3770         // Display Video Share button instead of Hold Button if
       
  3771         // the feature is enabled and video sharing is currently available.
       
  3772         if ( aResourceId == EPhoneIncallButtons &&
       
  3773              FeatureManager::FeatureSupported( KFeatureIdFfEntryPointForVideoShare ) &&
       
  3774              CPhonePubSubProxy::Instance()->Value
       
  3775                 ( KPSUidCoreApplicationUIs, KCoreAppUIsVideoSharingIndicator ) )
       
  3776             {
       
  3777             aResourceId = EPhoneIncallVideoShareButtons;
       
  3778             }
  3757         TPhoneCmdParamInteger integerParam;
  3779         TPhoneCmdParamInteger integerParam;
  3758         integerParam.SetInteger( CPhoneMainResourceResolver::Instance()->
  3780         integerParam.SetInteger( CPhoneMainResourceResolver::Instance()->
  3759                                  ResolveResourceID( aResourceId ) );
  3781                                  ResolveResourceID( aResourceId ) );
  3760         TRAP_IGNORE( iViewCommandHandle->ExecuteCommandL(
  3782         TRAP_IGNORE( iViewCommandHandle->ExecuteCommandL(
  3761                      EPhoneViewSetTouchPaneButtons,
  3783                      EPhoneViewSetTouchPaneButtons,
  4402     // Set dialer to DTMF mode.
  4424     // Set dialer to DTMF mode.
  4403     TPhoneCmdParamBoolean booleanParam;
  4425     TPhoneCmdParamBoolean booleanParam;
  4404     booleanParam.SetBoolean( ETrue );
  4426     booleanParam.SetBoolean( ETrue );
  4405     iViewCommandHandle->ExecuteCommandL( EPhoneViewSetDtmfDialerViewVisible,
  4427     iViewCommandHandle->ExecuteCommandL( EPhoneViewSetDtmfDialerViewVisible,
  4406                                          &booleanParam );
  4428                                          &booleanParam );
  4407 
       
  4408     if ( IsNumberEntryUsedL() )
  4429     if ( IsNumberEntryUsedL() )
  4409         {
  4430         {
  4410         // Store the number entry content to cache
  4431         // Store the number entry content to cache
  4411         if ( !IsNumberEntryContentStored() )
  4432         if ( !IsNumberEntryContentStored() )
  4412             {
  4433             {
  4422         NumberEntryManagerL()->CreateNumberEntryL();
  4443         NumberEntryManagerL()->CreateNumberEntryL();
  4423         }
  4444         }
  4424 
  4445 
  4425     // Update CBA
  4446     // Update CBA
  4426     iCbaManager->UpdateInCallCbaL();
  4447     iCbaManager->UpdateInCallCbaL();
       
  4448     
       
  4449     if( EPSCTsyCallStateDialling == 
       
  4450         CPhonePubSubProxy::Instance()->Value(KPSUidCtsyCallInformation, KCTsyCallState ) )
       
  4451         {
       
  4452         // Call indicator update to ensure that small call 
       
  4453         // bubble is shown in dtmf dialer during dialing
       
  4454         // call this needs to be done because when call is 
       
  4455         // initialized small call bubble visibility is set to false.
       
  4456         UpdateIncallIndicatorL(EPSCTsyCallStateDialling);
       
  4457         }
  4427     }
  4458     }
  4428 
  4459 
  4429 // -----------------------------------------------------------
  4460 // -----------------------------------------------------------
  4430 // CPhoneState::CheckIfRestoreNEContentAfterDtmfDialer
  4461 // CPhoneState::CheckIfRestoreNEContentAfterDtmfDialer
  4431 // -----------------------------------------------------------
  4462 // -----------------------------------------------------------
  4741             EPhoneViewEnableToolbarButton, &integerParam );
  4772             EPhoneViewEnableToolbarButton, &integerParam );
  4742         }
  4773         }
  4743     }
  4774     }
  4744 
  4775 
  4745 // ---------------------------------------------------------
  4776 // ---------------------------------------------------------
       
  4777 // CPhoneState::SetToolbarButtonHandsetEnabled
       
  4778 // ---------------------------------------------------------
       
  4779 //
       
  4780 EXPORT_C void CPhoneState::SetToolbarButtonHandsetEnabled()
       
  4781     {
       
  4782     if ( FeatureManager::FeatureSupported( KFeatureIdTouchCallHandling ) )
       
  4783         {
       
  4784         TPhoneCmdParamInteger integerParam;
       
  4785         integerParam.SetInteger( EPhoneInCallCmdHandset );
       
  4786         iViewCommandHandle->ExecuteCommand(
       
  4787             EPhoneViewEnableToolbarButton, &integerParam );
       
  4788         }
       
  4789     }
       
  4790 
       
  4791 // ---------------------------------------------------------
  4746 // CPhoneState::HandleEasyDialingCommandsL
  4792 // CPhoneState::HandleEasyDialingCommandsL
  4747 // ---------------------------------------------------------
  4793 // ---------------------------------------------------------
  4748 //
  4794 //
  4749 void CPhoneState::HandleEasyDialingCommandsL( TInt aCommandId )
  4795 void CPhoneState::HandleEasyDialingCommandsL( TInt aCommandId )
  4750     {
  4796     {
  4809        handled = iCustomization->HandlePhoneEngineMessageL( aMessage, aCallId );
  4855        handled = iCustomization->HandlePhoneEngineMessageL( aMessage, aCallId );
  4810        }
  4856        }
  4811     return handled;
  4857     return handled;
  4812     }
  4858     }
  4813 
  4859 
       
  4860 // -----------------------------------------------------------
       
  4861 // CPhoneState::SetLittleBubbleVisibilityL
       
  4862 // -----------------------------------------------------------
       
  4863 //
       
  4864 void CPhoneState::SetLittleBubbleVisibilityL(
       
  4865         TPhoneCommandParam* aCommandParam)
       
  4866     {
       
  4867     __LOGMETHODSTARTEND( EPhoneControl, "CPhoneState::SetLittleBubbleVisibilityL() " );
       
  4868     // If user has opened dtmfeditor(dtmfdialer) then do not make any changes 
       
  4869     // to SetLittleBubbleVisible value. SetLittleBubbleVisible value is true by default.
       
  4870     if( !IsDTMFEditorVisibleL() )
       
  4871         {
       
  4872         TPhoneCmdParamIncallIndicatorData* incallIndicatorParam =
       
  4873                    static_cast<TPhoneCmdParamIncallIndicatorData*>( aCommandParam );
       
  4874         TInt activeCallId = GetActiveCallIdL();
       
  4875         switch( incallIndicatorParam->CallState() )
       
  4876            {
       
  4877            case EPSCTsyCallStateRinging:
       
  4878            case EPSCTsyCallStateDialling:
       
  4879                {
       
  4880                // If we have single ringing or dialling call then it is ok
       
  4881                // to set visibility to false.
       
  4882                if ( activeCallId < KErrNone )
       
  4883                    {
       
  4884                    incallIndicatorParam->SetLittleBubbleVisible( EFalse );
       
  4885                    }
       
  4886                }
       
  4887                break;
       
  4888            default:
       
  4889                incallIndicatorParam->SetLittleBubbleVisible( ETrue );
       
  4890                break;
       
  4891            }
       
  4892         } 
       
  4893     }
       
  4894 
  4814 //  End of File
  4895 //  End of File
  4815 
  4896