accessoryservices/pluggeddisplay/pluggeddisplayengine/src/hdmicablestateconnected.cpp
branchRCL_3
changeset 17 0b0048910c20
parent 12 4a5c47a50617
child 19 94cb00198351
equal deleted inserted replaced
15:b2f9f823b5fb 17:0b0048910c20
    97     {
    97     {
    98     FUNC_LOG;
    98     FUNC_LOG;
    99     if ( KCRUidTvoutSettings == aRepositoryId )
    99     if ( KCRUidTvoutSettings == aRepositoryId )
   100         {
   100         {
   101         if ( KSettingsTvoutVerticalOverscan == aId  )
   101         if ( KSettingsTvoutVerticalOverscan == aId  )
   102             {
   102             {            
       
   103 			INFO("Cenrep Value Changed");
       
   104 			iEDIDHandler.UpdateOverscanValues();
   103             Input( EPDEIfCentralRepositoryWatch, EPDEIfCentralRepositoryWatchEventKeyChanged );
   105             Input( EPDEIfCentralRepositoryWatch, EPDEIfCentralRepositoryWatchEventKeyChanged );
   104             }
   106             }
   105         else
   107         else
   106             {
   108             {
   107             INFO_1("Unexpected CR key ID, aId 0x%x", aId );            
   109             INFO_1("Unexpected CR key ID, aId 0x%x", aId );            
   109         }
   111         }
   110     else
   112     else
   111         {
   113         {
   112         INFO_1("Unexpected Central Repository ID, aRepositoryId 0x%x", aRepositoryId);
   114         INFO_1("Unexpected Central Repository ID, aRepositoryId 0x%x", aRepositoryId);
   113         }
   115         }
       
   116 
   114     }
   117     }
   115 
   118 
   116 // ---------------------------------------------------------------------------
   119 // ---------------------------------------------------------------------------
   117 // From MCentralRepositoryObserver.
   120 // From MCentralRepositoryObserver.
   118 // ---------------------------------------------------------------------------
   121 // ---------------------------------------------------------------------------
   149 void CHDMICableStateConnected::Enter( )
   152 void CHDMICableStateConnected::Enter( )
   150     {
   153     {
   151     FUNC_LOG;
   154     FUNC_LOG;
   152     TInt retVal( KErrNone );
   155     TInt retVal( KErrNone );
   153 	iOverScanSettingsChanged = EFalse;
   156 	iOverScanSettingsChanged = EFalse;
       
   157 
       
   158 	// Get the current overscan value
       
   159 	iEDIDHandler.UpdateOverscanValues();
       
   160 	iEDIDHandler.GetCurrentOverscanValue( iHOverscanValue, iVOverscanValue );
       
   161 	
   154     iCopyProtectListenFailCounter.iCount = 0;
   162     iCopyProtectListenFailCounter.iCount = 0;
   155     iTVOutConfigForCopyProtect->ResetLatestRecordedCopyProtectionStatus();
   163     iTVOutConfigForCopyProtect->ResetLatestRecordedCopyProtectionStatus();
   156     retVal = iEDIDHandler.FetchEDIDData();
   164     retVal = iEDIDHandler.FetchEDIDData();
   157     if ( KErrNone != retVal )
   165     if ( KErrNone != retVal )
   158         {
   166         {
   391                         iTVOutConfigForSettingChanges->Cancel();
   399                         iTVOutConfigForSettingChanges->Cancel();
   392                         iHDMICableStatusFSM.Transit( EHDMICableStateRejected );         
   400                         iHDMICableStatusFSM.Transit( EHDMICableStateRejected );         
   393                         }
   401                         }
   394                     else
   402                     else
   395                         {
   403                         {
       
   404 						// Update the current overscan value
       
   405 						iEDIDHandler.GetCurrentOverscanValue( iHOverscanValue, iVOverscanValue );
       
   406 						
   396                         TFSMEventId event = iTVOutConfigForHDMI.ListenHDMICableStatusIfNoMissedEvents();
   407                         TFSMEventId event = iTVOutConfigForHDMI.ListenHDMICableStatusIfNoMissedEvents();
   397                         if ( EIfTVOutConfigEventCableDisconnected == event )
   408                         if ( EIfTVOutConfigEventCableDisconnected == event )
   398                             {
   409                             {
   399                             INFO( "Retreating back to <Idle> since cable was disconnected while not listening!" );        
   410                             INFO( "Retreating back to <Idle> since cable was disconnected while not listening!" );        
   400                             iTVOutConfigForSettingChanges->Cancel();
   411                             iTVOutConfigForSettingChanges->Cancel();
   702             else
   713             else
   703                 {
   714                 {
   704                 iSubState = ESubStateConnected;
   715                 iSubState = ESubStateConnected;
   705                 ListenCopyProtectionStatusChanges();
   716                 ListenCopyProtectionStatusChanges();
   706                 iTVOutConfigForSettingChanges->ListenSettingsChanges();
   717                 iTVOutConfigForSettingChanges->ListenSettingsChanges();
   707 				iCRWatchForVOverScan->Watch();
   718 				iCRWatchForVOverScan->Watch();				
   708                 }
   719                 }
   709             }
   720             }
   710         else if ( EPDEIfAccessoryControlEventConnectFailed == aEvent )
   721         else if ( EPDEIfAccessoryControlEventConnectFailed == aEvent )
   711             {
   722             {
   712             INFO( "Event: EPDEIfAccessoryControlEventConnectFailed" ); 
   723             INFO( "Event: EPDEIfAccessoryControlEventConnectFailed" ); 
   954             }
   965             }
   955         else if ( EIfTVOutConfigEventSettingsChangesListenStarted )
   966         else if ( EIfTVOutConfigEventSettingsChangesListenStarted )
   956             {
   967             {
   957             INFO( "Event: EIfTVOutConfigEventSettingsChangesListenStarted" );
   968             INFO( "Event: EIfTVOutConfigEventSettingsChangesListenStarted" );
   958             // Everything is OK. Stay in the same state.
   969             // Everything is OK. Stay in the same state.
       
   970 			// Should not miss the cenrep value change
       
   971 			TInt newOverScanValue = 0;
       
   972 			iCRWatchForVOverScan->GetCurrentValue(newOverScanValue);
       
   973 			if( iVOverscanValue != newOverScanValue )
       
   974 				{
       
   975 				Input( EPDEIfCentralRepositoryWatch, EPDEIfCentralRepositoryWatchEventKeyChanged );
       
   976 				}
   959             }
   977             }
   960         else if ( EIfTVOutConfigEventSettingsChangesListenFailed == aEvent )
   978         else if ( EIfTVOutConfigEventSettingsChangesListenFailed == aEvent )
   961             {
   979             {
   962             INFO( "Event: EIfTVOutConfigEventSettingsChangesListenFailed" );
   980             INFO( "Event: EIfTVOutConfigEventSettingsChangesListenFailed" );
   963             INFO( "Going to state <Rejected> since setting changes listening failed!" );        
   981             INFO( "Going to state <Rejected> since setting changes listening failed!" );        
   979         {       
   997         {       
   980         INFO( "Interface: EPDEIfCentralRepositoryWatch" );
   998         INFO( "Interface: EPDEIfCentralRepositoryWatch" );
   981         if ( EPDEIfCentralRepositoryWatchEventKeyChanged == aEvent )
   999         if ( EPDEIfCentralRepositoryWatchEventKeyChanged == aEvent )
   982             {
  1000             {
   983             INFO( "Event: EPDEIfCentralRepositoryWatchEventKeyChanged" );
  1001             INFO( "Event: EPDEIfCentralRepositoryWatchEventKeyChanged" );
   984 
  1002 			
   985 			// Get the available config
  1003 			// Get the available config
   986 			THdmiDviTimings curConfig;
  1004 			THdmiDviTimings curConfig;
   987 			
  1005 			
   988 			iTVOutConfigForHDMI.GetTvOutConfig()->GetConfig( curConfig );
  1006 			iTVOutConfigForHDMI.GetTvOutConfig()->GetConfig( curConfig );
   989 
  1007 
   990 			if( (TTvSettings::EHDMI == curConfig.iConnector) && (!curConfig.iUnderscanEnabled) )
  1008 			if( (TTvSettings::EHDMI == curConfig.iConnector) && (!curConfig.iUnderscanEnabled) )
   991 				{					
  1009 				{									
   992 				// Clear the available config				
  1010 				// Clear the available config				
   993 				ClearAvailableTvOutConfig();
  1011 				ClearAvailableTvOutConfig();
   994 
  1012 				iCRWatchForVOverScan->Cancel();
       
  1013 				
   995 				TInt retVal = iEDIDHandler.SetVideoParameters();
  1014 				TInt retVal = iEDIDHandler.SetVideoParameters();
   996 				if ( KErrNone != retVal )
  1015 				if ( KErrNone != retVal )
   997 					{
  1016 					{
   998 					INFO( "Going to state <Rejected> since video parameter setting failed!" );		  
  1017 					INFO( "Going to state <Rejected> since video parameter setting failed!" );		  
   999 					iTVOutConfigForSettingChanges->Cancel();
  1018 					iTVOutConfigForSettingChanges->Cancel();
  1000 					iCRWatchForVOverScan->Cancel();
  1019 					iCRWatchForVOverScan->Cancel();
  1001 					iHDMICableStatusFSM.Transit( EHDMICableStateRejected ); 		
  1020 					iHDMICableStatusFSM.Transit( EHDMICableStateRejected ); 		
  1002 					}
  1021 					}
  1003 				else
  1022 				else
  1004 					{
  1023 					{
       
  1024 					// Update the current overscan value
       
  1025 					iEDIDHandler.GetCurrentOverscanValue( iHOverscanValue, iVOverscanValue );
       
  1026 					
  1005 					TFSMEventId event = iTVOutConfigForHDMI.ListenHDMICableStatusIfNoMissedEvents();
  1027 					TFSMEventId event = iTVOutConfigForHDMI.ListenHDMICableStatusIfNoMissedEvents();
  1006 					if ( EIfTVOutConfigEventCableDisconnected == event )
  1028 					if ( EIfTVOutConfigEventCableDisconnected == event )
  1007 						{
  1029 						{
  1008 						INFO( "Retreating back to <Idle> since cable was disconnected while not listening!" );		  
  1030 						INFO( "Retreating back to <Idle> since cable was disconnected while not listening!" );		  
  1009 						iTVOutConfigForSettingChanges->Cancel();
  1031 						iTVOutConfigForSettingChanges->Cancel();
  1014 						{
  1036 						{
  1015 						iOverScanSettingsChanged = ETrue;
  1037 						iOverScanSettingsChanged = ETrue;
  1016 						iSubState = ESubStateWaitForSettingsChanged;
  1038 						iSubState = ESubStateWaitForSettingsChanged;
  1017 						}
  1039 						}
  1018 					}				
  1040 					}				
  1019 				}
  1041 				}			
  1020             }
  1042             }
  1021         else
  1043         else
  1022             {
  1044             {
  1023             INFO_1( "Unknown Event Id: %i", aEvent );        
  1045             INFO_1( "Unknown Event Id: %i", aEvent );        
  1024             }
  1046             }
  1051             INFO( "Event: EIfTVOutConfigEventCableConnected" );        
  1073             INFO( "Event: EIfTVOutConfigEventCableConnected" );        
  1052             TFSMEventId event = iTVOutConfigForHDMI.ListenHDMICableStatusIfNoMissedEvents();
  1074             TFSMEventId event = iTVOutConfigForHDMI.ListenHDMICableStatusIfNoMissedEvents();
  1053             if ( EIfTVOutConfigEventCableDisconnected == event )
  1075             if ( EIfTVOutConfigEventCableDisconnected == event )
  1054                 {
  1076                 {
  1055                 INFO( "Retreating back to <Idle> since cable was disconnected while WF setting changes!" );        
  1077                 INFO( "Retreating back to <Idle> since cable was disconnected while WF setting changes!" );        
       
  1078 				
       
  1079                 // Stop listening Copy Protection status
       
  1080                 iTVOutConfigForCopyProtect->Cancel();
       
  1081                 // Stop listen setting changes
  1056                 iTVOutConfigForSettingChanges->Cancel();
  1082                 iTVOutConfigForSettingChanges->Cancel();
  1057                 iHDMICableStatusFSM.Transit( EHDMICableStateIdle );         
  1083 				iCRWatchForVOverScan->Cancel();
       
  1084 
       
  1085 				if( iTVOutConfigForHDMI.GetTvOutConfig()->Enabled() )
       
  1086 					{
       
  1087 					iSubState = ESubStateIdlingDisable;
       
  1088 					iTVOutConfigForHDMI.Disable();			  
       
  1089 					}
       
  1090 				else
       
  1091 					{
       
  1092 					iHDMICableStatusFSM.Transit( EHDMICableStateIdle ); 		
       
  1093 					}
  1058                 }            
  1094                 }            
  1059              }
  1095              }
  1060         else if ( EIfTVOutConfigEventCableDisconnected == aEvent )
  1096         else if ( EIfTVOutConfigEventCableDisconnected == aEvent )
  1061             {
  1097             {
  1062             INFO( "Event: EIfTVOutConfigEventCableDisconnected" );
  1098             INFO( "Event: EIfTVOutConfigEventCableDisconnected" );
  1063             INFO( "Retreating back to <Idle> since cable was disconnected while WF setting changes!" );
  1099             INFO( "Retreating back to <Idle> since cable was disconnected while WF setting changes!" );
  1064             iTVOutConfigForSettingChanges->Cancel();
  1100 			// Stop listening Copy Protection status
  1065             iHDMICableStatusFSM.Transit( EHDMICableStateIdle );         
  1101 			iTVOutConfigForCopyProtect->Cancel();
       
  1102 			// Stop listen setting changes
       
  1103 			iTVOutConfigForSettingChanges->Cancel();
       
  1104 			iCRWatchForVOverScan->Cancel();
       
  1105 			
       
  1106 			if( iTVOutConfigForHDMI.GetTvOutConfig()->Enabled() )
       
  1107 				{
       
  1108 				iSubState = ESubStateIdlingDisable;
       
  1109 				iTVOutConfigForHDMI.Disable();			  
       
  1110 				}
       
  1111 			else
       
  1112 				{
       
  1113 				iHDMICableStatusFSM.Transit( EHDMICableStateIdle ); 		
       
  1114 				}
  1066             }
  1115             }
  1067         else if ( EIfTVOutConfigEventSettingsChanged == aEvent )
  1116         else if ( EIfTVOutConfigEventSettingsChanged == aEvent )
  1068             {
  1117             {
  1069             INFO( "Event: EIfTVOutConfigEventSettingsChanged" );
  1118             INFO( "Event: EIfTVOutConfigEventSettingsChanged" );
  1070 			if( iOverScanSettingsChanged )
  1119 			if( iOverScanSettingsChanged )
  1088             }
  1137             }
  1089         else if ( EIfTVOutConfigEventSettingsChangesListenFailed == aEvent )
  1138         else if ( EIfTVOutConfigEventSettingsChangesListenFailed == aEvent )
  1090             {
  1139             {
  1091             INFO( "Event: EIfTVOutConfigEventSettingsChangesListenFailed" );
  1140             INFO( "Event: EIfTVOutConfigEventSettingsChangesListenFailed" );
  1092             INFO( "Going to state <Rejected> since setting changes listening failed!" );        
  1141             INFO( "Going to state <Rejected> since setting changes listening failed!" );        
  1093             iHDMICableStatusFSM.Transit( EHDMICableStateRejected );         
  1142 			// Stop listening Copy Protection status
       
  1143 			iTVOutConfigForCopyProtect->Cancel();
       
  1144 			// Stop listen setting changes
       
  1145 			iCRWatchForVOverScan->Cancel();
       
  1146 			
       
  1147 			if( iTVOutConfigForHDMI.GetTvOutConfig()->Enabled() )
       
  1148 				{
       
  1149 				iSubState = ESubStateIdlingDisable;
       
  1150 				iTVOutConfigForHDMI.Disable();			  
       
  1151 				}
       
  1152 			else
       
  1153 				{
       
  1154 				iHDMICableStatusFSM.Transit( EHDMICableStateRejected ); 		
       
  1155 				}
  1094             }
  1156             }
  1095         else
  1157         else
  1096             {
  1158             {
  1097             INFO_1( "Unknown/unexpected Event Id: %i", aEvent );        
  1159             INFO_1( "Unknown/unexpected Event Id: %i", aEvent );        
  1098             }
  1160             }