Revision: 201025 RCL_3
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Thu, 15 Jul 2010 20:05:35 +0300
branchRCL_3
changeset 19 94cb00198351
parent 17 0b0048910c20
child 20 1ddbe54d0645
Revision: 201025 Kit: 2010127
accessoryservices/pluggeddisplay/pluggeddisplayengine/inc/edidhandler.h
accessoryservices/pluggeddisplay/pluggeddisplayengine/inc/hdmicablestateconnected.h
accessoryservices/pluggeddisplay/pluggeddisplayengine/inc/pdeconstants.h
accessoryservices/pluggeddisplay/pluggeddisplayengine/inc/tvoutconfigforcomposite.h
accessoryservices/pluggeddisplay/pluggeddisplayengine/src/compositecablestateconnected.cpp
accessoryservices/pluggeddisplay/pluggeddisplayengine/src/edidhandler.cpp
accessoryservices/pluggeddisplay/pluggeddisplayengine/src/hdmicablestateconnected.cpp
accessoryservices/pluggeddisplay/pluggeddisplayengine/src/tvoutconfigforcomposite.cpp
--- a/accessoryservices/pluggeddisplay/pluggeddisplayengine/inc/edidhandler.h	Mon Jun 21 17:06:14 2010 +0300
+++ b/accessoryservices/pluggeddisplay/pluggeddisplayengine/inc/edidhandler.h	Thu Jul 15 20:05:35 2010 +0300
@@ -179,7 +179,7 @@
      * @param None.
      * @return None.
      */
-    void UpdateOverscanValues();
+    TBool UpdateOverscanValues();
     
 	void GetCurrentOverscanValue( TInt& aHOverscan, TInt& aVOverscan );
 
--- a/accessoryservices/pluggeddisplay/pluggeddisplayengine/inc/hdmicablestateconnected.h	Mon Jun 21 17:06:14 2010 +0300
+++ b/accessoryservices/pluggeddisplay/pluggeddisplayengine/inc/hdmicablestateconnected.h	Thu Jul 15 20:05:35 2010 +0300
@@ -442,9 +442,6 @@
     //CCentralRepositoryWatch* iCRWatchForHOverScan;
     CCentralRepositoryWatch* iCRWatchForVOverScan;
 
-	// Flag to indicate the change of overscan
-	TBool iOverScanSettingsChanged;
-
     // Current overscan value
 	TInt iHOverscanValue;
 	TInt iVOverscanValue;
--- a/accessoryservices/pluggeddisplay/pluggeddisplayengine/inc/pdeconstants.h	Mon Jun 21 17:06:14 2010 +0300
+++ b/accessoryservices/pluggeddisplay/pluggeddisplayengine/inc/pdeconstants.h	Thu Jul 15 20:05:35 2010 +0300
@@ -92,6 +92,7 @@
     // Central Repository interface's event ids    
     EPDEIfCentralRepositoryWatchEventUndefined = 0x50,
     EPDEIfCentralRepositoryWatchEventKeyChanged,
+	EPDEIfCentralRepositoryWatchEventOverscanKeyChanged,
     
     // ASY command Handler interface's event ids
     EPDEIfAsyCommandHandlerEventUndefined = 0x60,
--- a/accessoryservices/pluggeddisplay/pluggeddisplayengine/inc/tvoutconfigforcomposite.h	Mon Jun 21 17:06:14 2010 +0300
+++ b/accessoryservices/pluggeddisplay/pluggeddisplayengine/inc/tvoutconfigforcomposite.h	Thu Jul 15 20:05:35 2010 +0300
@@ -123,6 +123,8 @@
      */
     void Disable();
 
+	TBool UpdateOverscanValues();
+	
 private:
 
     /**
@@ -262,6 +264,12 @@
     // Time out reason and next opt after timer has 
     // elapsed
     TOpt iTimeOutReason;
+	
+    // Horizontal overscan in pixels (1% == 100)
+    TInt iHOverscan;
+
+    // Vertical overscan in pixels (1% == 100)
+    TInt iVOverscan;
     };
 
 #endif // TVOUTCONFIGFORCOMPOSITE_H
--- a/accessoryservices/pluggeddisplay/pluggeddisplayengine/src/compositecablestateconnected.cpp	Mon Jun 21 17:06:14 2010 +0300
+++ b/accessoryservices/pluggeddisplay/pluggeddisplayengine/src/compositecablestateconnected.cpp	Thu Jul 15 20:05:35 2010 +0300
@@ -100,7 +100,8 @@
 void CCompositeCableStateConnected::Enter( )
     {
     FUNC_LOG;    
-    
+
+	iTVOutConfigForComposite.UpdateOverscanValues();
     ClearAvailableTvOutConfig();
     
     iTVOutConfigForSettingChanges->ListenSettingsChanges();
@@ -192,16 +193,24 @@
         TUint32 aId )
     {
     FUNC_LOG;
+	INFO("Cenrep Value Changed");
     if ( KCRUidTvoutSettings == aRepositoryId )
         {
         if (    ( KSettingsTvAspectRatio == aId ) ||
                 ( KSettingsTvoutFlickerFilter == aId  ) ||
-                ( KSettingsTvSystemInfo == aId ) ||
-                ( KSettingsTvoutVerticalOverscan == aId) )
+                ( KSettingsTvSystemInfo == aId ) )
             {
             Input( EPDEIfCentralRepositoryWatch, EPDEIfCentralRepositoryWatchEventKeyChanged );
             }
-        else
+        else if( KSettingsTvoutVerticalOverscan == aId )
+			{
+			if( iTVOutConfigForComposite.UpdateOverscanValues() )
+				{
+				INFO( "There is a real overscan change" );
+				Input( EPDEIfCentralRepositoryWatch, EPDEIfCentralRepositoryWatchEventOverscanKeyChanged );
+				}
+			}
+		else
             {
             INFO_1("Unexpected CR key ID, aId 0x%x", aId );            
             }       
@@ -375,12 +384,38 @@
 			iResettingInput = ETrue;
             Enter();
             }
+		else if ( EPDEIfCentralRepositoryWatchEventOverscanKeyChanged == aEvent )
+			{
+			INFO( "Event: EPDEIfCentralRepositoryWatchEventOverscanKeyChanged" );
+			iTVOutConfigForComposite.SetConfig( ETrue );
+			}
         else
             {
             INFO_1( "Unknown Event Id: %i", aEvent );        
             }
         break;
         }       
+    case EPDEIfTVOutConfig:
+        {       
+        INFO( "Interface: EPDEIfTVOutConfig" );       
+		if ( EIfTVOutConfigEventSet == aEvent )
+			{
+			INFO( "Event: EIfTVOutConfigEventSet" );
+			// Stay on the same state
+			}
+		else if ( EIfTVOutConfigEventSetFailed == aEvent )
+			{
+			INFO( "Event: EIfTVOutConfigEventSetFailed" );
+            iCRWatchForFlickerFilter->Cancel();
+            iCRWatchForAspectRatio->Cancel();
+            iCRWatchForTvSystem->Cancel();
+			iCRWatchForVOverScan->Cancel();
+            ClearAvailableTvOutConfig();
+            iTVOutConfigForComposite.Disable();
+            iSubState = ESubStateDisabling;
+			}
+		break;
+		}
     default:
         {
         INFO_2( "Event from unexpected interface. if Id, event id: %i", aInterfaceId, aEvent );        
--- a/accessoryservices/pluggeddisplay/pluggeddisplayengine/src/edidhandler.cpp	Mon Jun 21 17:06:14 2010 +0300
+++ b/accessoryservices/pluggeddisplay/pluggeddisplayengine/src/edidhandler.cpp	Thu Jul 15 20:05:35 2010 +0300
@@ -1414,7 +1414,7 @@
 // CalculateOverscan
 //------------------------------------------------------------------------------
 //
-void CEDIDHandler::UpdateOverscanValues()
+TBool CEDIDHandler::UpdateOverscanValues()
     {
     FUNC_LOG;
 
@@ -1423,6 +1423,7 @@
     TInt vOverscan = 0;
     CRepository* cenRep = NULL;
     TInt err = KErrNone;
+	TBool valChanged = EFalse;
     
     TRAP( err, cenRep = CRepository::NewL( KCRUidTvoutSettings ) );
     if( err == KErrNone )
@@ -1445,12 +1446,19 @@
         // Cleanup
         delete cenRep;
         }
+
+	if( (iHOverscan != hOverscan) || (iVOverscan != vOverscan) )
+		{
+		valChanged = ETrue;
+		}
     
     // Update overscan values
     iHOverscan = hOverscan;
     iVOverscan = vOverscan;
 
-	INFO_2( "Overscan Values: %d,%d", iHOverscan, iVOverscan );
+	INFO_3( "Overscan Values: %d,%d Changed:%d", iHOverscan, iVOverscan, valChanged );
+
+	return valChanged;
     }
 
 // ----------------------------------------------------------------------------
--- a/accessoryservices/pluggeddisplay/pluggeddisplayengine/src/hdmicablestateconnected.cpp	Mon Jun 21 17:06:14 2010 +0300
+++ b/accessoryservices/pluggeddisplay/pluggeddisplayengine/src/hdmicablestateconnected.cpp	Thu Jul 15 20:05:35 2010 +0300
@@ -101,8 +101,11 @@
         if ( KSettingsTvoutVerticalOverscan == aId  )
             {            
 			INFO("Cenrep Value Changed");
-			iEDIDHandler.UpdateOverscanValues();
-            Input( EPDEIfCentralRepositoryWatch, EPDEIfCentralRepositoryWatchEventKeyChanged );
+			if( iEDIDHandler.UpdateOverscanValues() )
+				{
+				INFO( "There is a real change" );
+            	Input( EPDEIfCentralRepositoryWatch, EPDEIfCentralRepositoryWatchEventKeyChanged );
+				}
             }
         else
             {
@@ -153,8 +156,7 @@
     {
     FUNC_LOG;
     TInt retVal( KErrNone );
-	iOverScanSettingsChanged = EFalse;
-
+	
 	// Get the current overscan value
 	iEDIDHandler.UpdateOverscanValues();
 	iEDIDHandler.GetCurrentOverscanValue( iHOverscanValue, iVOverscanValue );
@@ -526,18 +528,11 @@
                 {
                 iSubState = ESubStateConnected;
 
-				if( !iOverScanSettingsChanged )
-					{
-	                TRAPD( err, iHDMICableStatusFSM.SettingsChangedL() );
-	                if ( KErrNone != err )
-	                    {
-	                    INFO_1( "iHDMICableStatusFSM.SettingsChangedL() failed, error code %i", err ); 
-	                    }
-					}
-				else
-					{
-					iOverScanSettingsChanged = EFalse;
-					}
+                TRAPD( err, iHDMICableStatusFSM.SettingsChangedL() );
+                if ( KErrNone != err )
+                    {
+                    INFO_1( "iHDMICableStatusFSM.SettingsChangedL() failed, error code %i", err ); 
+                    }
                 ListenCopyProtectionStatusChanges();
                 iTVOutConfigForSettingChanges->ListenSettingsChanges();
 				iCRWatchForVOverScan->Watch();
@@ -583,12 +578,14 @@
             INFO( "Event: EIfTVOutConfigEventDisabled" );
             iSubState = ESubStateIdlingDisconnectAccessory;
             iAccessoryControlIf.DisconnectAccessory();                    
+			ClearAvailableTvOutConfig();
             }
         else if ( EIfTVOutConfigEventDisableFailed == aEvent )
             {
             INFO( "Event: EIfTVOutConfigEventDisableFailed" );        
             iSubState = ESubStateIdlingDisconnectAccessory;
             iAccessoryControlIf.DisconnectAccessory();                    
+			ClearAvailableTvOutConfig();
             }
         else
             {
@@ -963,7 +960,7 @@
                 iTVOutConfigForHDMI.Enable();                
                 }
             }
-        else if ( EIfTVOutConfigEventSettingsChangesListenStarted )
+        else if ( EIfTVOutConfigEventSettingsChangesListenStarted == aEvent )
             {
             INFO( "Event: EIfTVOutConfigEventSettingsChangesListenStarted" );
             // Everything is OK. Stay in the same state.
@@ -1007,9 +1004,6 @@
 
 			if( (TTvSettings::EHDMI == curConfig.iConnector) && (!curConfig.iUnderscanEnabled) )
 				{									
-				// Clear the available config				
-				ClearAvailableTvOutConfig();
-				iCRWatchForVOverScan->Cancel();
 				
 				TInt retVal = iEDIDHandler.SetVideoParameters();
 				if ( KErrNone != retVal )
@@ -1017,7 +1011,8 @@
 					INFO( "Going to state <Rejected> since video parameter setting failed!" );		  
 					iTVOutConfigForSettingChanges->Cancel();
 					iCRWatchForVOverScan->Cancel();
-					iHDMICableStatusFSM.Transit( EHDMICableStateRejected ); 		
+					iSubState = ESubStateIdlingDisable;
+					iTVOutConfigForHDMI.Disable();			  
 					}
 				else
 					{
@@ -1030,12 +1025,8 @@
 						INFO( "Retreating back to <Idle> since cable was disconnected while not listening!" );		  
 						iTVOutConfigForSettingChanges->Cancel();
 						iCRWatchForVOverScan->Cancel();
-						iHDMICableStatusFSM.Transit( EHDMICableStateIdle ); 		
-						}
-					else
-						{
-						iOverScanSettingsChanged = ETrue;
-						iSubState = ESubStateWaitForSettingsChanged;
+						iSubState = ESubStateIdlingDisable;
+						iTVOutConfigForHDMI.Disable();			  
 						}
 					}				
 				}			
@@ -1116,24 +1107,8 @@
         else if ( EIfTVOutConfigEventSettingsChanged == aEvent )
             {
             INFO( "Event: EIfTVOutConfigEventSettingsChanged" );
-			if( iOverScanSettingsChanged )
-				{
-	            if ( iTVOutConfigForHDMI.GetTvOutConfig()->Enabled() )
-	                {
-	                iSubState = ESubStateResettingDisable;
-	                iTVOutConfigForHDMI.Disable();
-	                }
-	            else
-	                {
-	                iSubState = ESubStateResettingEnable;
-	                iTVOutConfigForHDMI.Enable();                
-	                }
-				}
-			else
-				{
-	            iSubState = ESubStateEnable;
-	            iTVOutConfigForHDMI.Enable();
-				}
+            iSubState = ESubStateEnable;
+            iTVOutConfigForHDMI.Enable();
             }
         else if ( EIfTVOutConfigEventSettingsChangesListenFailed == aEvent )
             {
--- a/accessoryservices/pluggeddisplay/pluggeddisplayengine/src/tvoutconfigforcomposite.cpp	Mon Jun 21 17:06:14 2010 +0300
+++ b/accessoryservices/pluggeddisplay/pluggeddisplayengine/src/tvoutconfigforcomposite.cpp	Thu Jul 15 20:05:35 2010 +0300
@@ -189,6 +189,48 @@
     }
 
 // -----------------------------------------------------------------------------
+// CTVOutConfigForComposite::UpdateOverscanValues
+// -----------------------------------------------------------------------------
+//
+TBool CTVOutConfigForComposite::UpdateOverscanValues()
+    {
+    FUNC_LOG;
+
+    // Overscan from cenrep
+    TInt hOverscan = 0;
+    TInt vOverscan = 0;
+    TInt err = KErrNone;
+	TBool valChanged = EFalse;
+    
+    // Horizontal
+    err = iRepository->Get( KSettingsTvoutHorizontalOverscan, hOverscan );
+    if( err != KErrNone )
+        {
+        hOverscan = 0;
+        }
+    
+    // Vertical
+    err = iRepository->Get( KSettingsTvoutVerticalOverscan, vOverscan );
+    if( err != KErrNone )
+        {
+        vOverscan = 0;
+        }
+
+	if( (iHOverscan != hOverscan) || (iVOverscan != vOverscan) )
+		{
+		valChanged = ETrue;
+		}
+    
+    // Update overscan values
+    iHOverscan = hOverscan;
+    iVOverscan = vOverscan;
+
+	INFO_3( "Overscan Values: %d,%d Changed:%d", iHOverscan, iVOverscan, valChanged );
+
+	return valChanged;
+    }
+
+// -----------------------------------------------------------------------------
 // CTVOutConfigForComposite::InitializeDriverL
 // -----------------------------------------------------------------------------
 //
@@ -216,20 +258,9 @@
     ConvertFlickerFilter( value );
     settings.iFlickerFilter = ( TTvSettings::TFlickerFilterType ) value;
 
-    TInt hOverscan = 0;
-    TInt vOverscan = 0;
-    err = iRepository->Get( KSettingsTvoutHorizontalOverscan, hOverscan );
-    if( err != KErrNone )
-        {
-        hOverscan = 0;
-        }
-    err = iRepository->Get( KSettingsTvoutVerticalOverscan, vOverscan );
-    if( err != KErrNone )
-        {
-        vOverscan = 0;
-        }
-    settings.iHorizontalOverScan = hOverscan;
-    settings.iVerticalOverScan = vOverscan;
+	// Update overscan
+    settings.iHorizontalOverScan = iHOverscan;
+    settings.iVerticalOverScan = iVOverscan;
     
     // Update the PAR
     UpdatePixelAspectRatio( settings );