diff -r 66ecddbca914 -r 4a5c47a50617 accessoryservices/pluggeddisplay/pluggeddisplayengine/src/hdmicablestateconnected.cpp --- a/accessoryservices/pluggeddisplay/pluggeddisplayengine/src/hdmicablestateconnected.cpp Tue May 11 17:23:24 2010 +0300 +++ b/accessoryservices/pluggeddisplay/pluggeddisplayengine/src/hdmicablestateconnected.cpp Tue May 25 14:04:18 2010 +0300 @@ -28,6 +28,9 @@ #include "tvoutconfigforhdmi.h" #include "edidhandler.h" #include "trace.h" +#include +#include +#include @@ -77,8 +80,67 @@ iTVOutConfigForSettingChanges->Cancel(); delete iTVOutConfigForSettingChanges; } + if ( iCRWatchForVOverScan ) + { + iCRWatchForVOverScan->Cancel(); + delete iCRWatchForVOverScan; + } } +// --------------------------------------------------------------------------- +// From MCentralRepositoryObserver. +// --------------------------------------------------------------------------- +// +void CHDMICableStateConnected::CentRepKeyChanged( + TUid aRepositoryId, + TUint32 aId ) + { + FUNC_LOG; + if ( KCRUidTvoutSettings == aRepositoryId ) + { + if ( KSettingsTvoutVerticalOverscan == aId ) + { + Input( EPDEIfCentralRepositoryWatch, EPDEIfCentralRepositoryWatchEventKeyChanged ); + } + else + { + INFO_1("Unexpected CR key ID, aId 0x%x", aId ); + } + } + else + { + INFO_1("Unexpected Central Repository ID, aRepositoryId 0x%x", aRepositoryId); + } + } + +// --------------------------------------------------------------------------- +// From MCentralRepositoryObserver. +// --------------------------------------------------------------------------- +// +void CHDMICableStateConnected::CentRepGetKeyValueFailed( + TUid aRepositoryId, + TUint32 aId, + TInt aError ) + { + FUNC_LOG; + // Make use of aError argument top get rid of compiler warning. + TInt error( aError ); + if ( ( KCRUidTvoutSettings == aRepositoryId ) && ( KErrNone != error ) ) + { + if ( KSettingsTvoutVerticalOverscan == aId ) + { + INFO_1(" Getting KSettingsTvoutVerticalOverscan from CR failed, aError %d", error ); + } + else + { + INFO_1("Unexpected CR key ID, aId 0x%x", aId ); + } + } + else + { + INFO_1("Unexpected Central Repository ID, aRepositoryId 0x%x", aRepositoryId); + } + } // --------------------------------------------------------------------------- // From MFSMState. @@ -88,6 +150,7 @@ { FUNC_LOG; TInt retVal( KErrNone ); + iOverScanSettingsChanged = EFalse; iCopyProtectListenFailCounter.iCount = 0; iTVOutConfigForCopyProtect->ResetLatestRecordedCopyProtectionStatus(); retVal = iEDIDHandler.FetchEDIDData(); @@ -451,13 +514,22 @@ else { iSubState = ESubStateConnected; - TRAPD( err, iHDMICableStatusFSM.SettingsChangedL() ); - if ( KErrNone != err ) - { - INFO_1( "iHDMICableStatusFSM.SettingsChangedL() failed, error code %i", err ); - } + + if( !iOverScanSettingsChanged ) + { + TRAPD( err, iHDMICableStatusFSM.SettingsChangedL() ); + if ( KErrNone != err ) + { + INFO_1( "iHDMICableStatusFSM.SettingsChangedL() failed, error code %i", err ); + } + } + else + { + iOverScanSettingsChanged = EFalse; + } ListenCopyProtectionStatusChanges(); iTVOutConfigForSettingChanges->ListenSettingsChanges(); + iCRWatchForVOverScan->Watch(); } } else if ( EIfTVOutConfigEventEnableFailed == aEvent ) @@ -632,6 +704,7 @@ iSubState = ESubStateConnected; ListenCopyProtectionStatusChanges(); iTVOutConfigForSettingChanges->ListenSettingsChanges(); + iCRWatchForVOverScan->Watch(); } } else if ( EPDEIfAccessoryControlEventConnectFailed == aEvent ) @@ -780,6 +853,7 @@ iTVOutConfigForCopyProtect->Cancel(); // Stop listen setting changes iTVOutConfigForSettingChanges->Cancel(); + iCRWatchForVOverScan->Cancel(); iSubState = ESubStateIdlingDisable; iTVOutConfigForHDMI.Disable(); } @@ -792,6 +866,7 @@ iTVOutConfigForCopyProtect->Cancel(); // Stop listen setting changes iTVOutConfigForSettingChanges->Cancel(); + iCRWatchForVOverScan->Cancel(); // Disable tv out iTVOutConfigForHDMI.Disable(); } @@ -808,6 +883,7 @@ iTVOutConfigForCopyProtect->Cancel(); // Stop listen setting changes iTVOutConfigForSettingChanges->Cancel(); + iCRWatchForVOverScan->Cancel(); iTVOutConfigForHDMI.Disable(); } else @@ -821,6 +897,7 @@ iTVOutConfigForCopyProtect->Cancel(); // Stop listen setting changes iTVOutConfigForSettingChanges->Cancel(); + iCRWatchForVOverScan->Cancel(); iSubState = ESubStateIdlingDisable; iTVOutConfigForHDMI.Disable(); } @@ -851,6 +928,7 @@ iTVOutConfigForHDMI.Cancel(); // Stop listening Copy Protection status iTVOutConfigForCopyProtect->Cancel(); + iCRWatchForVOverScan->Cancel(); iSubState = ESubStateRejectingDisable; iTVOutConfigForHDMI.Disable(); } @@ -862,6 +940,7 @@ iTVOutConfigForHDMI.Cancel(); // Stop listening Copy Protection status iTVOutConfigForCopyProtect->Cancel(); + iCRWatchForVOverScan->Cancel(); if ( iTVOutConfigForHDMI.GetTvOutConfig()->Enabled() ) { iSubState = ESubStateResettingDisable; @@ -887,6 +966,7 @@ iTVOutConfigForHDMI.Cancel(); // Stop listening Copy Protection status iTVOutConfigForCopyProtect->Cancel(); + iCRWatchForVOverScan->Cancel(); iTVOutConfigForHDMI.Disable(); } else @@ -895,6 +975,55 @@ } break; } + case EPDEIfCentralRepositoryWatch: + { + INFO( "Interface: EPDEIfCentralRepositoryWatch" ); + if ( EPDEIfCentralRepositoryWatchEventKeyChanged == aEvent ) + { + INFO( "Event: EPDEIfCentralRepositoryWatchEventKeyChanged" ); + + // Get the available config + THdmiDviTimings curConfig; + + iTVOutConfigForHDMI.GetTvOutConfig()->GetConfig( curConfig ); + + if( (TTvSettings::EHDMI == curConfig.iConnector) && (!curConfig.iUnderscanEnabled) ) + { + // Clear the available config + ClearAvailableTvOutConfig(); + + TInt retVal = iEDIDHandler.SetVideoParameters(); + if ( KErrNone != retVal ) + { + INFO( "Going to state since video parameter setting failed!" ); + iTVOutConfigForSettingChanges->Cancel(); + iCRWatchForVOverScan->Cancel(); + iHDMICableStatusFSM.Transit( EHDMICableStateRejected ); + } + else + { + TFSMEventId event = iTVOutConfigForHDMI.ListenHDMICableStatusIfNoMissedEvents(); + if ( EIfTVOutConfigEventCableDisconnected == event ) + { + INFO( "Retreating back to since cable was disconnected while not listening!" ); + iTVOutConfigForSettingChanges->Cancel(); + iCRWatchForVOverScan->Cancel(); + iHDMICableStatusFSM.Transit( EHDMICableStateIdle ); + } + else + { + iOverScanSettingsChanged = ETrue; + iSubState = ESubStateWaitForSettingsChanged; + } + } + } + } + else + { + INFO_1( "Unknown Event Id: %i", aEvent ); + } + break; + } default: { INFO_1( "Event received from unknown/unexpected interface Id: %i", aInterfaceId ); @@ -938,8 +1067,24 @@ else if ( EIfTVOutConfigEventSettingsChanged == aEvent ) { INFO( "Event: EIfTVOutConfigEventSettingsChanged" ); - iSubState = ESubStateEnable; - iTVOutConfigForHDMI.Enable(); + if( iOverScanSettingsChanged ) + { + if ( iTVOutConfigForHDMI.GetTvOutConfig()->Enabled() ) + { + iSubState = ESubStateResettingDisable; + iTVOutConfigForHDMI.Disable(); + } + else + { + iSubState = ESubStateResettingEnable; + iTVOutConfigForHDMI.Enable(); + } + } + else + { + iSubState = ESubStateEnable; + iTVOutConfigForHDMI.Enable(); + } } else if ( EIfTVOutConfigEventSettingsChangesListenFailed == aEvent ) { @@ -962,14 +1107,38 @@ } // --------------------------------------------------------------------------- +// ClearAvailableConfig +// --------------------------------------------------------------------------- +// +void CHDMICableStateConnected::ClearAvailableTvOutConfig() + { + FUNC_LOG; + + if( iTVOutConfigForHDMI.GetTvOutConfig() ) + { + RArray HdmiSettingsArray; + RArray TvSettingsArray; + + TInt err = iTVOutConfigForHDMI.GetTvOutConfig()->SetAvailableTvConfigList( TvSettingsArray, HdmiSettingsArray ); + + HdmiSettingsArray.Close(); + TvSettingsArray.Close(); + } + } + + +// --------------------------------------------------------------------------- // ConstructL // --------------------------------------------------------------------------- // void CHDMICableStateConnected::ConstructL() { FUNC_LOG; + // Create Central Repository Watchers + iCRWatchForVOverScan = CCentralRepositoryWatch::NewL(*this, KCRUidTvoutSettings, KSettingsTvoutVerticalOverscan ); + iTVOutConfigForCopyProtect = CTVOutConfigForHDMI::NewL( iHDMICableStatusFSM ); - iTVOutConfigForSettingChanges = CTVOutConfigForHDMI::NewL( iHDMICableStatusFSM ); + iTVOutConfigForSettingChanges = CTVOutConfigForHDMI::NewL( iHDMICableStatusFSM ); }