accessoryservices/pluggeddisplay/pluggeddisplayengine/src/edidhandler.cpp
changeset 50 48a00b70dc49
parent 48 86cf7a1b7eb9
child 59 0f7422b6b602
equal deleted inserted replaced
48:86cf7a1b7eb9 50:48a00b70dc49
    23 #include <accpolhdmispeakerallocation.h>
    23 #include <accpolhdmispeakerallocation.h>
    24 #include <e32cmn.h>
    24 #include <e32cmn.h>
    25 #include <e32math.h>
    25 #include <e32math.h>
    26 #include <accessoriescrkeys.h>
    26 #include <accessoriescrkeys.h>
    27 #include <centralrepository.h>
    27 #include <centralrepository.h>
       
    28 #include <sysutil.h>
    28 
    29 
    29 #include "pdeconstants.h"
    30 #include "pdeconstants.h"
    30 #include "tvoutconfigforhdmi.h"
    31 #include "tvoutconfigforhdmi.h"
    31 #include "edidhandler.h"
    32 #include "edidhandler.h"
    32 #include "edidparserbase.h"
    33 #include "edidparserbase.h"
   768 	    aTimings.iTvHdmiVersion = iEdidParserPtr->GetVersion();
   769 	    aTimings.iTvHdmiVersion = iEdidParserPtr->GetVersion();
   769 	    aTimings.iTvHdmiRevision = iEdidParserPtr->GetRevision();
   770 	    aTimings.iTvHdmiRevision = iEdidParserPtr->GetRevision();
   770 		}
   771 		}
   771     Mem::FillZ( ( TAny* )&aTimings.iProductName, ( sizeof( TChar ) * KProductNameChars ) );
   772     Mem::FillZ( ( TAny* )&aTimings.iProductName, ( sizeof( TChar ) * KProductNameChars ) );
   772     Mem::FillZ( ( TAny* )&aTimings.iProductDescription, ( sizeof( TChar ) * KProductDescriptorsChars ) );
   773     Mem::FillZ( ( TAny* )&aTimings.iProductDescription, ( sizeof( TChar ) * KProductDescriptorsChars ) );
   773     aTimings.iSourceType = THdmiDviTimings::ESourceTypeUnknown;
   774     	
       
   775     TInt err = KErrNone;
       
   776     CDeviceTypeInformation* deviceTypeInfo = NULL;
       
   777     TRAP(err, deviceTypeInfo = SysUtil::GetDeviceTypeInfoL());
       
   778     
       
   779     if(KErrNone == err)
       
   780         {
       
   781         #define MAX(a, b) (((a)>(b)) ? (a) : (b))
       
   782         #define MIN(a, b) (((a)<(b)) ? (a) : (b))
       
   783         
       
   784         TPtrC16 bufPtrModelCode;
       
   785         TPtrC16 bufPtrManufacturerName;
       
   786         TUint loopCount;
       
   787         TUint maxLen;
       
   788         TUint maxCharsLen;
       
   789         TUint minNameCharsLen;
       
   790         TUint minDescritopCharsLen;
       
   791         
       
   792         deviceTypeInfo->GetManufacturerName(bufPtrManufacturerName);
       
   793         deviceTypeInfo->GetModelCode(bufPtrModelCode);
       
   794         maxLen = MAX(bufPtrModelCode.Length(),bufPtrManufacturerName.Length());
       
   795         maxCharsLen = MAX(KProductNameChars,KProductDescriptorsChars);
       
   796         minNameCharsLen = MIN(KProductNameChars, bufPtrModelCode.Length());
       
   797         minDescritopCharsLen = MIN(KProductDescriptorsChars, bufPtrManufacturerName.Length());
       
   798         
       
   799         INFO_1( "maxLen : %d", maxLen);
       
   800         INFO_1( "maxCharsLen : %d", maxCharsLen);
       
   801         INFO_1( "minNameCharsLen : %d", minNameCharsLen);
       
   802         INFO_1( "minDescritopCharsLen : %d", minDescritopCharsLen);
       
   803         
       
   804         for(loopCount = 0; loopCount < maxLen; loopCount++)
       
   805             {
       
   806             if(loopCount >= maxCharsLen)
       
   807                 {
       
   808                         break;
       
   809                 }
       
   810             else
       
   811                 {
       
   812                     if(loopCount <  minNameCharsLen)
       
   813                         {
       
   814                         aTimings.iProductName[loopCount] = bufPtrModelCode[loopCount];
       
   815                         INFO_1( "aTimings.iProductName : %d", aTimings.iProductName[loopCount].GetLowerCase());
       
   816                         }
       
   817                     if(loopCount <  minDescritopCharsLen)
       
   818                         {
       
   819                         aTimings.iProductDescription[loopCount] = bufPtrManufacturerName[loopCount];
       
   820                         INFO_1( "aTimings.iProductDescription : %d", aTimings.iProductDescription[loopCount].GetLowerCase());
       
   821                         }
       
   822                 }
       
   823             }
       
   824         INFO("Before Deleting Pointer deviceTypeInfo");
       
   825         delete deviceTypeInfo;
       
   826         INFO("After Deleting Pointer deviceTypeInfo");
       
   827         aTimings.iSourceType = THdmiDviTimings::ESourceTypePCGeneral;
       
   828         }
       
   829     else
       
   830         {
       
   831         aTimings.iSourceType = THdmiDviTimings::ESourceTypeUnknown;
       
   832         }
   774     }
   833     }
   775 
   834 
   776 //------------------------------------------------------------------------------
   835 //------------------------------------------------------------------------------
   777 // CEDIDHandler::FillHdmiDviTimings
   836 // CEDIDHandler::FillHdmiDviTimings
   778 //------------------------------------------------------------------------------
   837 //------------------------------------------------------------------------------
  1554 				}
  1613 				}
  1555 		    }
  1614 		    }
  1556 		    else // It is DVI connector
  1615 		    else // It is DVI connector
  1557 		    {
  1616 		    {
  1558 				TInt modecount = aHdmiConfigs.Count();
  1617 				TInt modecount = aHdmiConfigs.Count();
       
  1618 
       
  1619 				if( !modecount )
       
  1620 					{
       
  1621 					THdmiDviTimings timings;
       
  1622 					
       
  1623 					INFO( "==No EDID available from the Sink. Setting DMT 4" );
       
  1624 					// No EDID data available from the sink
       
  1625 					// Default VGA resolution should be selected
       
  1626 					const TTimingItem* item = TimingByIndex( KDefaultDMTModeIndex, ETimingModeDMT );
       
  1627 					if( item )
       
  1628 						{
       
  1629 						Mem::FillZ( ( TAny* )&timings, sizeof( timings ) );
       
  1630 						FillHdmiDviTimings( *item, timings );
       
  1631 						timings.iTvPhysicalImageAspectRatioNumerator = 4;
       
  1632 						timings.iTvPhysicalImageAspectRatioDenominator = 3;
       
  1633 						retVal = aHdmiConfigs.Append( timings );
       
  1634 						ERROR_1( retVal, "Failed to append DMT timing: %S in array", item->iTimingName );
       
  1635 						if( retVal == KErrNone )
       
  1636 							{
       
  1637 							modecount = 1;
       
  1638 							ceaMode = EFalse;
       
  1639 							}
       
  1640 						}
       
  1641 					}
  1559 				
  1642 				
  1560 				while( modecount-- )
  1643 				while( modecount-- )
  1561 				  {
  1644 				  {
  1562 
  1645 
  1563 				    if( aHdmiConfigs[ modecount ].iDmtMode && (EFalse == ceaMode) )
  1646 				    if( aHdmiConfigs[ modecount ].iDmtMode && (EFalse == ceaMode) )