os/boardsupport/haitest/bspsvs/suite/bsp/lcd/src/T_ScreenDriverData.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 /*
     2 * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). 
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     8 *
     9 * Initial Contributors:
    10 * Nokia Corporation - initial contribution.
    11 *
    12 * Contributors:
    13 *
    14 * Description:
    15 *
    16 */
    17 
    18 #include "T_ScreenDriverData.h"
    19 
    20 #define MICROSECS_TO_SECS(x)  (x*1000000)
    21 
    22 const TInt	BPP8					=8;
    23 const TInt	BPP12					=12;
    24 const TInt	BPP16					=16;
    25 const TInt	BPP24					=24;
    26 const TInt	BPP32					=32;
    27 
    28 const TInt	KDefaultBoxLength		=16;
    29 const TInt	KDefaultBoxWidth		=16;
    30 const TInt	KDefaultBoxStep			=16;
    31 const TInt	KDefaultMargin			=16;
    32 const TInt	KDefaultFrameDelay		=20000;
    33 const TInt	KDefaultScreenDelay		=5;
    34 
    35 
    36 
    37 //These are for masks and shifts for rgb 332 data format
    38 /*@{*/
    39 _LIT(KEnumDisplayState,						"EDisplayState");
    40 _LIT(KEnumBacklightState,					"EBacklightState");
    41 _LIT(KEnumBacklight,						"EBacklight");
    42 _LIT(KEnumDisplayMaxBrightness,				"EDisplayBrightnessMax");
    43 _LIT(KEnumDisplayBrightness,				"EDisplayBrightness");
    44 _LIT(KEnumDisplayMaxContrast,				"EDisplayContrastMax");
    45 _LIT(KEnumDisplayContrast,					"EDisplayContrast");
    46 _LIT(KEnumDisplayMemoryAddress,				"EDisplayMemoryAddress");
    47 _LIT(KEnumDisplayIsPixelOrderRGB,			"EDisplayIsPixelOrderRGB");
    48 _LIT(KEnumDisplayIsPixelOrderLandscape,		"EDisplayIsPixelOrderLandscape");
    49 _LIT(KEnumDisplayMode,						"EDisplayMode");
    50 _LIT(KEnumDisplayNumModes,					"EDisplayNumModes");
    51 _LIT(KEnumDisplayColors,					"EDisplayColors");
    52 _LIT(KEnumDisplayPaletteEntry,				"EDisplayPaletteEntry");
    53 _LIT(KEnumDisplayXPixels,					"EDisplayXPixels");
    54 _LIT(KEnumDisplayYPixels,					"EDisplayYPixels");
    55 _LIT(KEnumDisplayXTwips,					"EDisplayXTwips");
    56 _LIT(KEnumDisplayYTwips,					"EDisplayYTwips");
    57 _LIT(KEnumDisplayBitsPerPixel,				"EDisplayBitsPerPixel");
    58 _LIT(KEnumDisplayOffsetToFirstPixel,		"EDisplayOffsetToFirstPixel");
    59 _LIT(KEnumDisplayOffsetBetweenLines,		"EDisplayOffsetBetweenLines");
    60 _LIT(KEnumDisplayIsPalettized,				"EDisplayIsPalettized");
    61 _LIT(KEnumDisplayNumberOfScreens,			"EDisplayNumberOfScreens");
    62 _LIT(KEnumNull,								"");
    63 
    64 _LIT(KFormatEntryField,						"%S_%S");
    65 
    66 _LIT(KFldColor,								"color");
    67 _LIT(KFldColorBackground,					"background");
    68 _LIT(KFldColorForeground,					"foreground");
    69 _LIT(KFldColorIndex,						"color%d");
    70 _LIT(KFldFrameDelay,						"framedelay");
    71 _LIT(KFldEndIndex,							"endIndex");
    72 _LIT(KFldLength,							"length");
    73 _LIT(KFldMargin,							"margin");
    74 _LIT(KFldMask,								"mask");
    75 _LIT(KFldShift,								"shift");
    76 _LIT(KFldStartIndex,						"startIndex");
    77 _LIT(KFldStep,								"step");
    78 _LIT(KFldWidth,								"width");
    79 
    80 _LIT(KTagRgbRed,							"red");
    81 _LIT(KTagRgbGreen,							"green");
    82 _LIT(KTagRgbBlue,							"blue");
    83 _LIT(KTagRgbAlpha,							"alpha");
    84 
    85 _LIT(KCmdUtilityFillColor,					"utilityFillColor");
    86 _LIT(KCmdUtilityFillMultiColor,				"utilityFillMultiColor");
    87 _LIT(KCmdUtilityMovingRectangle,			"utilityMovingRectangle");
    88 _LIT(KCmdUtilityFillHorizontalStrip,		"utilityFillHorizontalStrip");
    89 _LIT(KCmdUtilityFillVerticalStrip,			"utilityFillVerticalStrip");
    90 _LIT(KCmdUtilityPromptMessage,	  			  "utilityPromptMessage");
    91 
    92 _LIT(KScreenDelay,					"screenDelay");
    93 
    94 _LIT(KLogInvalidLength,						"Invalid length %d. Must be >0.");
    95 _LIT(KLogInvalidMargin,						"Invalid margin %d. Must be >0.");
    96 _LIT(KLogInvalidStep,						"Invalid step %d. Must be >0.");
    97 _LIT(KLogInvalidWidth,						"Invalid width %d. Must be >0.");
    98 _LIT(KLogMissingParameter,					"Missing parameter '%S'");
    99 _LIT(KLogNotEnoughData,						"Not enough data");
   100 /*@}*/
   101 
   102 const CT_HALData::THalTableLookup	CT_ScreenDriverData::iTableLookup[] =
   103 	{
   104 //	Enum as a descriptor				Enum									Prepare input	Prepare paramters prior	Validation of		Store data returned after a			Flag indicating
   105 //																				value prior to	to HAL::Get call		value returned		successful HAL::Get or				if validation
   106 //																				HAL::Set call							after a successful	HAL::Set call						is mandatory
   107 //																														HAL::Get call
   108 	KEnumDisplayState,					HALData::EDisplayState,					SetPrepareInt,	GetPrepareDisplayMode,	GetValidationInt,	SetDisplayState,					EFalse,
   109 	KEnumBacklightState,				HALData::EBacklightState,				SetPrepareInt,	GetPrepareDisplayMode,	GetValidationInt,	SetBacklightState,					EFalse,
   110 	KEnumBacklight,					HALData::EBacklight,					SetPrepareInt,	GetPrepareDisplayMode,	GetValidationInt,	SetBacklight,						EFalse,
   111 	KEnumDisplayBrightness,			HALData::EDisplayBrightness,			SetPrepareInt,	GetPrepareDisplayMode,	GetValidationInt,	SetDisplayMaxBrightness,			EFalse,
   112 	KEnumDisplayMaxBrightness,			HALData::EDisplayBrightnessMax,			SetPrepareInt,	GetPrepareDisplayMode,	GetValidationInt,	SetDisplayBrightness,				EFalse,
   113 	KEnumDisplayContrast,				HALData::EDisplayContrast,				SetPrepareInt,	GetPrepareDisplayMode,	GetValidationInt,	SetDisplayMaxContrast,				EFalse,
   114 	KEnumDisplayMaxContrast,			HALData::EDisplayContrastMax,			SetPrepareInt,	GetPrepareDisplayMode,	GetValidationInt,	SetDisplayContrast,					EFalse,
   115 	KEnumDisplayMemoryAddress,			HALData::EDisplayMemoryAddress,			SetPrepareUint,	GetPrepareDisplayMode,	GetValidationUint,	SetDisplayMemoryAddress,			EFalse,
   116 	KEnumDisplayIsPixelOrderLandscape,	HALData::EDisplayIsPixelOrderLandscape,	SetPrepareInt,	GetPrepareDisplayMode,	GetValidationInt,	SetDisplayIsPixelOrderRGB,			EFalse,
   117 	KEnumDisplayIsPixelOrderRGB,		HALData::EDisplayIsPixelOrderRGB,		SetPrepareInt,	GetPrepareDisplayMode,	GetValidationInt,	SetDisplayIsPixelOrderLandscape,	EFalse,
   118 	KEnumDisplayMode,					HALData::EDisplayMode,					SetPrepareInt,	GetPrepareDisplayMode,	GetValidationInt,	SetDisplayMode,						EFalse,
   119 	KEnumDisplayNumModes,				HALData::EDisplayNumModes,				SetPrepareInt,	GetPrepareDisplayMode,	GetValidationInt,	SetDisplayNumModes,					EFalse,
   120 	KEnumDisplayColors,				HALData::EDisplayColors,				SetPrepareInt,	GetPrepareDisplayMode,	GetValidationInt,	SetDisplayColors,					EFalse,
   121 	KEnumDisplayPaletteEntry,			HALData::EDisplayPaletteEntry,			SetPrepareInt,	GetPrepareColorIndex,	GetValidationInt,	SetDisplayPaletteEntry,				EFalse,
   122 	KEnumDisplayXPixels,				HALData::EDisplayXPixels,				SetPrepareInt,	GetPrepareDisplayMode,	GetValidationInt,	SetDisplayXPixels,					EFalse,
   123 	KEnumDisplayYPixels,				HALData::EDisplayYPixels,				SetPrepareInt,	GetPrepareDisplayMode,	GetValidationInt,	SetDisplayYPixels,					EFalse,
   124 	KEnumDisplayXTwips,				HALData::EDisplayXTwips,				SetPrepareInt,	GetPrepareDisplayMode,	GetValidationInt,	SetDisplayXTwips,					EFalse,
   125 	KEnumDisplayYTwips,				HALData::EDisplayYTwips,				SetPrepareInt,	GetPrepareDisplayMode,	GetValidationInt,	SetDisplayYTwips,					EFalse,
   126 	KEnumDisplayBitsPerPixel,			HALData::EDisplayBitsPerPixel,			SetPrepareInt,	GetPrepareDisplayMode,	GetValidationInt,	SetDisplayBitsPerPixel,				EFalse,
   127 	KEnumDisplayOffsetToFirstPixel,	HALData::EDisplayOffsetToFirstPixel,	SetPrepareInt,	GetPrepareDisplayMode,	GetValidationInt,	SetDisplayOffsetToFirstPixel,		EFalse,
   128 	KEnumDisplayOffsetBetweenLines,	HALData::EDisplayOffsetBetweenLines,	SetPrepareInt,	GetPrepareDisplayMode,	GetValidationInt,	SetDisplayOffsetBetweenLines,		EFalse,
   129 	KEnumDisplayIsPalettized,			HALData::EDisplayIsPalettized,			SetPrepareInt,	GetPrepareDisplayMode,	GetValidationBool,	SetDisplayIsPalettized,				EFalse,
   130 	KEnumDisplayNumberOfScreens,		HALData::EDisplayNumberOfScreens,		SetPrepareInt,	GetPrepareDisplayMode,	GetValidationInt,	SetDisplayNumberOfScreens,			EFalse,
   131 	KEnumNull,							(HALData::TAttribute)0,					NULL,			NULL,					NULL,				NULL,								NULL
   132 	};
   133 
   134 //////////////////////////////////////////////////////////////////////
   135 // Construction/Destruction
   136 //////////////////////////////////////////////////////////////////////
   137 
   138 CT_ScreenDriverData* CT_ScreenDriverData::NewL()
   139 	{
   140 	CT_ScreenDriverData*	ret=new (ELeave) CT_ScreenDriverData();
   141 	CleanupStack::PushL(ret);
   142 	ret->ConstructL();
   143 	CleanupStack::Pop(ret);
   144 	return ret;
   145 	}
   146 
   147 
   148 CT_ScreenDriverData::CT_ScreenDriverData()
   149 :	CT_HALData(iTableLookup)
   150 ,	iDisplayState(-1)
   151 ,	iBacklightState(-1)
   152 ,	iBacklight(-1)
   153 ,	iDisplayMaxBrightness(-1)
   154 ,	iDisplayBrightness(-1)
   155 ,	iDisplayMaxContrast(-1)
   156 ,	iDisplayContrast(-1)
   157 ,	iDisplayMemoryAddress((TUint8*)(-1))
   158 ,	iDisplayIsPixelOrderRGB(-1)
   159 ,	iDisplayIsPixelOrderLandscape(-1)
   160 ,	iDisplayMode(-1)
   161 ,	iDisplayNumModes(-1)
   162 ,	iDisplayColors(-1)
   163 ,	iDisplayPaletteEntry(-1)
   164 ,	iDisplayXPixels(-1)
   165 ,	iDisplayYPixels(-1)
   166 ,	iDisplayXTwips(-1)
   167 ,	iDisplayYTwips(-1)
   168 ,	iDisplayBitsPerPixel(-1)
   169 ,	iDisplayOffsetToFirstPixel(-1)
   170 ,	iDisplayOffsetBetweenLines(-1)
   171 ,	iDisplayIsPalettized(EFalse)
   172 ,	iDisplayNumberOfScreens(-1)
   173 	{
   174 	}
   175 
   176 void CT_ScreenDriverData::ConstructL()
   177 /**
   178  * Second phase construction
   179  *
   180  * @internalComponent
   181  *
   182  * @return	N/A
   183  *
   184  * @pre		None
   185  * @post	None
   186  *
   187  * @leave	system wide error
   188  */
   189 	{
   190 	}
   191 
   192 CT_ScreenDriverData::~CT_ScreenDriverData()
   193 /**
   194  * Public destructor
   195  */
   196 	{
   197 	iPalette.Close();
   198 	}
   199 
   200 TAny* CT_ScreenDriverData::GetObject()
   201 /**
   202  * Return a pointer to the object that the data wraps
   203  *
   204  * @return	pointer to the object that the data wraps
   205  */
   206 	{
   207 	return NULL;
   208 	}
   209 
   210 //	Prepare the range of values that are getting as color indexs
   211 TBool CT_ScreenDriverData::GetPrepareColorIndex(CDataWrapperBase* aThis, const TDesC& aSection, TInt& aValueStart, TInt& aValueEnd)
   212 	{
   213 	CT_ScreenDriverData*	thisPtr=static_cast<CT_ScreenDriverData*>(aThis);
   214 	TBool	ret=thisPtr->GetIntFromConfig(aSection, KFldStartIndex(), aValueStart);
   215 	if ( !ret )
   216 		{
   217 		thisPtr->ERR_PRINTF2(KLogMissingParameter, &KFldStartIndex());
   218 		thisPtr->SetBlockResult(EFail);
   219 		}
   220 
   221 	aValueEnd=aValueStart;
   222 	thisPtr->GetIntFromConfig(aSection, KFldEndIndex(), aValueEnd);
   223 
   224 	return ret;
   225 	}
   226 
   227 //	Prepare the range of values that are getting as just the display mode
   228 TBool CT_ScreenDriverData::GetPrepareDisplayMode(CDataWrapperBase* aThis, const TDesC& /*aSection*/, TInt& aValueStart, TInt& aValueEnd)
   229 	{
   230 	aValueStart=aValueEnd=static_cast<CT_ScreenDriverData*>(aThis)->iDisplayMode;
   231 
   232 	return ETrue;
   233 	}
   234 
   235 //	Store the display state
   236 void CT_ScreenDriverData::SetDisplayState(CDataWrapperBase* aThis, TInt aValue)
   237 	{
   238 	static_cast<CT_ScreenDriverData*>(aThis)->iDisplayState=aValue;
   239 	}
   240 
   241 //	Store the backlight state
   242 void CT_ScreenDriverData::SetBacklightState(CDataWrapperBase* aThis, TInt aValue)
   243 	{
   244 	static_cast<CT_ScreenDriverData*>(aThis)->iBacklightState=aValue;
   245 	}
   246 
   247 //	Store the backlight
   248 void CT_ScreenDriverData::SetBacklight(CDataWrapperBase* aThis, TInt aValue)
   249 	{
   250 	static_cast<CT_ScreenDriverData*>(aThis)->iBacklight=aValue;
   251 	}
   252 
   253 //	Store the displays maximum brightness
   254 void CT_ScreenDriverData::SetDisplayMaxBrightness(CDataWrapperBase* aThis, TInt aValue)
   255 	{
   256 	static_cast<CT_ScreenDriverData*>(aThis)->iDisplayMaxBrightness=aValue;
   257 	}
   258 
   259 //	Store the displays brightness
   260 void CT_ScreenDriverData::SetDisplayBrightness(CDataWrapperBase* aThis, TInt aValue)
   261 	{
   262 	static_cast<CT_ScreenDriverData*>(aThis)->iDisplayBrightness=aValue;
   263 	}
   264 
   265 //	Store the displays maximum contrast
   266 void CT_ScreenDriverData::SetDisplayMaxContrast(CDataWrapperBase* aThis, TInt aValue)
   267 	{
   268 	static_cast<CT_ScreenDriverData*>(aThis)->iDisplayMaxContrast=aValue;
   269 	}
   270 
   271 //	Store the displays contrast
   272 void CT_ScreenDriverData::SetDisplayContrast(CDataWrapperBase* aThis, TInt aValue)
   273 	{
   274 	static_cast<CT_ScreenDriverData*>(aThis)->iDisplayContrast=aValue;
   275 	}
   276 
   277 //	Store the displays memory address
   278 void CT_ScreenDriverData::SetDisplayMemoryAddress(CDataWrapperBase* aThis, TInt aValue)
   279 	{
   280 	static_cast<CT_ScreenDriverData*>(aThis)->iDisplayMemoryAddress=(TUint8*)(aValue);
   281 	}
   282 
   283 //	Store the displays pixel RGB order flag
   284 void CT_ScreenDriverData::SetDisplayIsPixelOrderRGB(CDataWrapperBase* aThis, TInt aValue)
   285 	{
   286 	static_cast<CT_ScreenDriverData*>(aThis)->iDisplayIsPixelOrderRGB=aValue;
   287 	}
   288 
   289 //	Store the displays landscape pixel order flag
   290 void CT_ScreenDriverData::SetDisplayIsPixelOrderLandscape(CDataWrapperBase* aThis, TInt aValue)
   291 	{
   292 	static_cast<CT_ScreenDriverData*>(aThis)->iDisplayIsPixelOrderLandscape=aValue;
   293 	}
   294 
   295 //	Store the displays mode
   296 void CT_ScreenDriverData::SetDisplayMode(CDataWrapperBase* aThis, TInt aValue)
   297 	{
   298 	static_cast<CT_ScreenDriverData*>(aThis)->iDisplayMode=aValue;
   299 	}
   300 
   301 //	Store the displays supported number of modes
   302 void CT_ScreenDriverData::SetDisplayNumModes(CDataWrapperBase* aThis, TInt aValue)
   303 	{
   304 	static_cast<CT_ScreenDriverData*>(aThis)->iDisplayNumModes=aValue;
   305 	}
   306 
   307 //	Store the displays supported number of colors
   308 void CT_ScreenDriverData::SetDisplayColors(CDataWrapperBase* aThis, TInt aValue)
   309 	{
   310 	CT_ScreenDriverData*	thisPtr=static_cast<CT_ScreenDriverData*>(aThis);
   311 	thisPtr->iDisplayColors=aValue;
   312 	thisPtr->iPalette.Reset();
   313 	thisPtr->iPalette.Reserve(aValue);
   314 	}
   315 
   316 //	Store the an entry in the displays color palette
   317 void CT_ScreenDriverData::SetDisplayPaletteEntry(CDataWrapperBase* aThis, TInt aValue)
   318 	{
   319 	CT_ScreenDriverData*	thisPtr=static_cast<CT_ScreenDriverData*>(aThis);
   320 	thisPtr->iDisplayPaletteEntry=aValue;
   321 	if ( thisPtr->iPalette.Count()<thisPtr->iValue )
   322 		{
   323 		thisPtr->iPalette[thisPtr->iValue]=aValue;
   324 		}
   325 	}
   326 
   327 //	Store the displays width in pixels
   328 void CT_ScreenDriverData::SetDisplayXPixels(CDataWrapperBase* aThis, TInt aValue)
   329 	{
   330 	static_cast<CT_ScreenDriverData*>(aThis)->iDisplayXPixels=aValue;
   331 	}
   332 
   333 //	Store the displays height in pixels
   334 void CT_ScreenDriverData::SetDisplayYPixels(CDataWrapperBase* aThis, TInt aValue)
   335 	{
   336 	static_cast<CT_ScreenDriverData*>(aThis)->iDisplayYPixels=aValue;
   337 	}
   338 
   339 //	Store the displays width in twips
   340 void CT_ScreenDriverData::SetDisplayXTwips(CDataWrapperBase* aThis, TInt aValue)
   341 	{
   342 	static_cast<CT_ScreenDriverData*>(aThis)->iDisplayXTwips=aValue;
   343 	}
   344 
   345 //	Store the displays height in twips
   346 void CT_ScreenDriverData::SetDisplayYTwips(CDataWrapperBase* aThis, TInt aValue)
   347 	{
   348 	static_cast<CT_ScreenDriverData*>(aThis)->iDisplayYTwips=aValue;
   349 	}
   350 
   351 //	Store the displays number of bits per pixel
   352 void CT_ScreenDriverData::SetDisplayBitsPerPixel(CDataWrapperBase* aThis, TInt aValue)
   353 	{
   354 	static_cast<CT_ScreenDriverData*>(aThis)->iDisplayBitsPerPixel=aValue;
   355 	}
   356 
   357 //	Store the displays memory address offset to the first pixel
   358 void CT_ScreenDriverData::SetDisplayOffsetToFirstPixel(CDataWrapperBase* aThis, TInt aValue)
   359 	{
   360 	static_cast<CT_ScreenDriverData*>(aThis)->iDisplayOffsetToFirstPixel=aValue;
   361 	}
   362 
   363 //	Store the displays memory address offset between successive lines
   364 void CT_ScreenDriverData::SetDisplayOffsetBetweenLines(CDataWrapperBase* aThis, TInt aValue)
   365 	{
   366 	static_cast<CT_ScreenDriverData*>(aThis)->iDisplayOffsetBetweenLines=aValue;
   367 	}
   368 
   369 //	Store the displays flag indicating if a palette is used
   370 void CT_ScreenDriverData::SetDisplayIsPalettized(CDataWrapperBase* aThis, TInt aValue)
   371 	{
   372 	static_cast<CT_ScreenDriverData*>(aThis)->iDisplayIsPalettized=(aValue!=0);
   373 	}
   374 
   375 //	Store the devices number of screens supported
   376 void CT_ScreenDriverData::SetDisplayNumberOfScreens(CDataWrapperBase* aThis, TInt aValue)
   377 	{
   378 	static_cast<CT_ScreenDriverData*>(aThis)->iDisplayNumberOfScreens=aValue;
   379 	}
   380 TBool CT_ScreenDriverData::GetRgbFromConfig(const TDesC& aSectName, const TDesC& aKeyName, TUint& aRed, TUint& aGreen, TUint& aBlue, TUint& aAlpha)
   381 	{
   382 	TBuf<KMaxTestExecuteCommandLength>	tempStore;
   383 
   384 	tempStore.Format(KFormatEntryField, &aKeyName, &KTagRgbRed);
   385 	TBool	ret=GetUintFromConfig(aSectName, tempStore, aRed);
   386 
   387 	tempStore.Format(KFormatEntryField, &aKeyName, &KTagRgbGreen);
   388 	if ( !GetUintFromConfig(aSectName, tempStore, aGreen) )
   389 		{
   390 		ret=EFalse;
   391 		}
   392 
   393 	tempStore.Format(KFormatEntryField, &aKeyName, &KTagRgbBlue);
   394 	if ( !GetUintFromConfig(aSectName, tempStore, aBlue) )
   395 		{
   396 		ret=EFalse;
   397 		}
   398 
   399 	aAlpha=0;
   400 	tempStore.Format(KFormatEntryField, &aKeyName, &KTagRgbAlpha);
   401 	GetUintFromConfig(aSectName, tempStore, aAlpha);
   402 
   403 	return ret;
   404 	}
   405 
   406 TBool CT_ScreenDriverData::GetRgbFromConfig(const TDesC& aSectName, const TDesC& aKeyName, TInt& aRed, TInt& aGreen, TInt& aBlue, TInt& aAlpha)
   407 	{
   408 	TBuf<KMaxTestExecuteCommandLength>	tempStore;
   409 
   410 	tempStore.Format(KFormatEntryField, &aKeyName, &KTagRgbRed);
   411 	TBool	ret=GetIntFromConfig(aSectName, tempStore, aRed);
   412 
   413 	tempStore.Format(KFormatEntryField, &aKeyName, &KTagRgbGreen);
   414 	if ( !GetIntFromConfig(aSectName, tempStore, aGreen) )
   415 		{
   416 		ret=EFalse;
   417 		}
   418 
   419 	tempStore.Format(KFormatEntryField, &aKeyName, &KTagRgbBlue);
   420 	if ( !GetIntFromConfig(aSectName, tempStore, aBlue) )
   421 		{
   422 		ret=EFalse;
   423 		}
   424 
   425 	aAlpha=0;
   426 	tempStore.Format(KFormatEntryField, &aKeyName, &KTagRgbAlpha);
   427 	GetIntFromConfig(aSectName, tempStore, aAlpha);
   428 
   429 	return ret;
   430 	}
   431 
   432 TBool CT_ScreenDriverData::GetColorFromConfig(const TDesC& aSectName, const TDesC& aKeyName, TUint& aColor, TPtrC& aLogColor)
   433 	{
   434 	TBool	dataOk=ETrue;
   435 	
   436 	if ( iDisplayIsPalettized )
   437 		{
   438 		WARN_PRINTF1(_L("Testing of Palettes not supported\n"));
   439 		dataOk=EFalse;
   440 		}
   441 
   442 	TUint	colorRed;
   443 	TUint	colorGreen;
   444 	TUint	colorBlue;
   445 	TUint	colorAlpha;
   446 	if ( !GetRgbFromConfig(aSectName, aKeyName, colorRed, colorGreen, colorBlue, colorAlpha) )
   447 		{
   448 		WARN_PRINTF2(KLogMissingParameter, &aKeyName);
   449 		dataOk=EFalse;
   450 		}
   451 
   452 	if ( !GetStringFromConfig(aSectName, aKeyName, aLogColor) )
   453 		{
   454 		WARN_PRINTF2(KLogMissingParameter, &aKeyName);
   455 		dataOk=EFalse;
   456 		}
   457 
   458 	TUint	maskRed;
   459 	TUint	maskGreen;
   460 	TUint	maskBlue;
   461 	TUint	maskAlpha;
   462 	if ( !GetRgbFromConfig(aSectName, KFldMask(), maskRed, maskGreen, maskBlue, maskAlpha) )
   463 		{
   464 		WARN_PRINTF2(KLogMissingParameter, &KFldMask());
   465 		dataOk=EFalse;
   466 		}
   467 
   468 	TInt	shiftRed;
   469 	TInt	shiftGreen;
   470 	TInt	shiftBlue;
   471 	TInt	shiftAlpha;
   472 	if ( !GetRgbFromConfig(aSectName, KFldShift(), shiftRed, shiftGreen, shiftBlue, shiftAlpha) )
   473 		{
   474 		WARN_PRINTF2(KLogMissingParameter, &KFldShift());
   475 		dataOk=EFalse;
   476 		}
   477 
   478 	aColor=0;
   479 
   480 	//	Apply Red
   481 	colorRed	&= maskRed;
   482 	if ( shiftRed<0 )
   483 		{
   484 		aColor |= (colorRed >> -shiftRed);
   485 		}
   486 	else
   487 		{
   488 		aColor |= (colorRed << shiftRed);
   489 		}
   490 
   491 	//	Apply Green
   492 	colorGreen	&= maskGreen;
   493 	if ( shiftGreen<0 )
   494 		{
   495 		aColor |= (colorGreen >> -shiftGreen);
   496 		}
   497 	else
   498 		{
   499 		aColor |= (colorGreen << shiftGreen);
   500 		}
   501 
   502 	//	Apply Blue
   503 	colorBlue	&= maskBlue;
   504 	if ( shiftBlue<0 )
   505 		{
   506 		aColor |= (colorBlue >> -shiftBlue);
   507 		}
   508 	else
   509 		{
   510 		aColor |= (colorBlue << shiftBlue);
   511 		}
   512 
   513 	//	Apply Alpha
   514 	colorAlpha	&= maskAlpha;
   515 	if ( shiftAlpha<0 )
   516 		{
   517 		aColor |= (colorAlpha >> -shiftAlpha);
   518 		}
   519 	else
   520 		{
   521 		aColor |= (colorAlpha << shiftAlpha);
   522 		}
   523 
   524 	return dataOk;
   525 	}
   526 
   527 TBool CT_ScreenDriverData::DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex)
   528 /**
   529  * Process a command read from the ini file
   530  *
   531  * @param aCommand			The command to process
   532  * @param aSection			The section in the ini containing data for the command
   533  * @param aAsyncErrorIndex	Command index for async calls to return errors to
   534  *
   535  * @return					ETrue if the command is processed
   536  *
   537  * @leave					System wide error
   538  */
   539 	{
   540 	TBool	ret=ETrue;
   541 
   542 	if ( aCommand==KCmdUtilityFillColor )
   543 		{
   544 		DoCmdUtilityFillColorL(aSection);
   545 		}
   546 	else if ( aCommand==KCmdUtilityFillMultiColor )
   547 		{
   548 		DoCmdUtilityFillMultiColorL(aSection);
   549 		}
   550 	else if ( aCommand==KCmdUtilityMovingRectangle )
   551 		{
   552 		DoCmdUtilityMovingRectangleL(aSection);
   553 		}
   554 	else if ( aCommand==KCmdUtilityFillHorizontalStrip )
   555 		{
   556 		DoCmdUtilityFillHorizontalStripL(aSection);	
   557 		}
   558 	else if ( aCommand==KCmdUtilityFillVerticalStrip)
   559 		{
   560 		DoCmdUtilityFillVerticalStripL(aSection);	
   561 		}
   562 	else if ( aCommand==KCmdUtilityPromptMessage)
   563 		{
   564 		ret=CDataWrapperBase::DoCommandL(aCommand, aSection, aAsyncErrorIndex);
   565 		}
   566 	else
   567 		{
   568 		ret=CT_HALData::DoCommandL(aCommand, aSection, aAsyncErrorIndex);
   569 		}
   570 
   571 	return ret;
   572 	}
   573 
   574 /**
   575  * Fill the Screen in a single color by using screen base memory address
   576  *
   577  * @param aSection			The section in the ini containing data for the command
   578  *
   579  * @return					void
   580  *
   581  * @leave					System wide error
   582  */
   583 void CT_ScreenDriverData::DoCmdUtilityFillColorL(const TDesC& aSection)
   584 	{
   585 	
   586 	TUint	 color;
   587 	TPtrC	 logColor;
   588 	TBool	 dataOk=GetColorFromConfig(aSection, KFldColor, color, logColor);
   589 	if ( !dataOk )
   590 		{
   591 		ERR_PRINTF2(KLogMissingParameter, &KFldColor());
   592 		SetBlockResult(EFail);
   593 		}
   594 	else
   595 	 	{
   596 		TInt	pixelsX=iDisplayXPixels;
   597 		TInt	pixelsY=iDisplayYPixels;
   598 		TUint8*	memoryAddress=iDisplayMemoryAddress;
   599 		memoryAddress+=iDisplayOffsetToFirstPixel;
   600 
   601 		TInt	line=0;
   602 		for ( line=0; line<pixelsY; ++line )
   603 			{
   604 			DrawLine(color, memoryAddress, 0, pixelsX);
   605 			memoryAddress+=iDisplayOffsetBetweenLines;
   606 			}
   607 
   608 		}	
   609 
   610 	//delays the image on the screen to allow for the user to verify
   611 	TInt screenDelay;	
   612 	TBool screenDelayOk = GetIntFromConfig(aSection, KScreenDelay(), screenDelay);
   613 	if(!screenDelayOk)
   614 		{
   615 
   616 			INFO_PRINTF1(_L("defualt screen delay value used"));
   617 			screenDelay = KDefaultScreenDelay;
   618 		}
   619 	CDataWrapperBase::Timedelay(MICROSECS_TO_SECS(screenDelay));
   620 	}
   621 
   622 /**
   623  * Fill the Screen color with multiple nested rectangles by using screen base memory address
   624  *
   625  * @param aSection			The section in the ini containing data for the command
   626  *
   627  * @return					void
   628  *
   629  * @leave					System wide error
   630  */
   631 void CT_ScreenDriverData::DoCmdUtilityFillMultiColorL(const TDesC& aSection)
   632 	{
   633 	TBuf<KMaxTestExecuteCommandLength>	tempStore;
   634 
   635 	RArray<TUint>	color;
   636 	CleanupClosePushL(color);
   637 
   638 	RArray<TDesC>	colorLog;
   639 	CleanupClosePushL(colorLog);
   640 
   641 	TBool	moreData=ETrue;
   642 	TBool	index=0;
   643 	while ( moreData )
   644 		{
   645 		tempStore.Format(KFldColorIndex(), ++index);
   646 		TUint	colorTemp;
   647 		TPtrC	colorLogTemp;
   648 
   649 		moreData=GetColorFromConfig(aSection, tempStore, colorTemp, colorLogTemp);
   650 		if ( moreData )
   651 			{
   652 			color.AppendL(colorTemp);
   653 			colorLog.AppendL(colorLogTemp);
   654 			}
   655 		}
   656 
   657 	//	Must have more than one color for this to work
   658 	TBool	dataOk=color.Count()>1;
   659 	if ( !dataOk )
   660 		{
   661 		ERR_PRINTF1(KLogNotEnoughData);
   662 		SetBlockResult(EFail);
   663 		}
   664 
   665 	TInt	margin=KDefaultMargin;
   666 	GetIntFromConfig(aSection, KFldMargin(), margin);
   667 	if ( margin<=0 )
   668 		{
   669 		ERR_PRINTF2(KLogInvalidMargin, margin);
   670 		SetBlockResult(EFail);
   671 		dataOk=EFalse;
   672 		}
   673 
   674 	if ( dataOk )
   675 	 	{
   676 		TInt	pixelsX=iDisplayXPixels;
   677 		TInt	pixelsY=iDisplayYPixels;
   678 		TUint8*	memoryAddress=iDisplayMemoryAddress;
   679 		memoryAddress+=iDisplayOffsetToFirstPixel;
   680 
   681 		TInt	colorIndex=0;
   682 		TInt	left=0;
   683 		TInt	pixels=pixelsX;
   684 		TInt	top=0;
   685 		TInt	bottom=pixelsY;
   686 		TInt	line=0;
   687 		while ( (left<pixels) && (top<bottom) )
   688 			{
   689 			TUint8*	address=memoryAddress + top*iDisplayOffsetBetweenLines;
   690 			for ( line=top; line<bottom; ++line )
   691 				{
   692 				DrawLine(color[colorIndex], address, left, pixels);
   693 				address+=iDisplayOffsetBetweenLines;
   694 				}
   695 			left += margin;
   696 			pixels -= margin;
   697 			top += margin;
   698 			bottom -= margin;
   699 			++colorIndex;
   700 			if ( colorIndex>=color.Count() )
   701 				{
   702 				colorIndex=0;
   703 				}
   704 			}
   705 
   706 		}
   707 	CleanupStack::PopAndDestroy(2, &color);
   708 	
   709 	TInt screenDelay;	
   710 	TBool screenDelayOk = GetIntFromConfig(aSection, KScreenDelay(), screenDelay);
   711 	if(!screenDelayOk)
   712 		{
   713 			screenDelay = KDefaultScreenDelay;
   714 			INFO_PRINTF1(_L("defualt screen delay value used"));
   715 		}
   716 
   717 	CDataWrapperBase::Timedelay(MICROSECS_TO_SECS(screenDelay));
   718 	}
   719 
   720 /**
   721  * Fill the Screen in a color and animate a rectangle moving around the perimeter of the screen
   722  * by using screen base memory address
   723  *
   724  * @param aSection			The section in the ini containing data for the command
   725  *
   726  * @return					void
   727  *
   728  * @leave					System wide error
   729  */
   730 void CT_ScreenDriverData::DoCmdUtilityMovingRectangleL(const TDesC& aSection)
   731 	{
   732 	TBool	dataOk=ETrue;
   733 
   734 	TUint	colorBackground;
   735 	TPtrC	logColorBackground;
   736 	if ( !GetColorFromConfig(aSection, KFldColorBackground, colorBackground, logColorBackground) )
   737 		{
   738 		ERR_PRINTF2(KLogMissingParameter, &KFldColorBackground());
   739 		SetBlockResult(EFail);
   740 		dataOk=EFalse;
   741 		}
   742 
   743 	TUint	colorForeground;
   744 	TPtrC	logColorForeground;
   745 	if ( !GetColorFromConfig(aSection, KFldColorForeground, colorForeground, logColorForeground) )
   746 		{
   747 		ERR_PRINTF2(KLogMissingParameter, &KFldColorForeground());
   748 		SetBlockResult(EFail);
   749 		dataOk=EFalse;
   750 		}
   751 
   752 	TInt	boxLength=KDefaultBoxLength;
   753 	GetIntFromConfig(aSection, KFldLength(), boxLength);
   754 	if ( boxLength<=0 )
   755 		{
   756 		ERR_PRINTF2(KLogInvalidLength, boxLength);
   757 		SetBlockResult(EFail);
   758 		dataOk=EFalse;
   759 		}
   760 
   761 	TInt	boxWidth=KDefaultBoxWidth;
   762 	GetIntFromConfig(aSection, KFldWidth(), boxWidth);
   763 	if ( boxWidth<=0 )
   764 		{
   765 		ERR_PRINTF2(KLogInvalidWidth, boxWidth);
   766 		SetBlockResult(EFail);
   767 		dataOk=EFalse;
   768 		}
   769 
   770 	TInt	step=KDefaultBoxStep;
   771 	GetIntFromConfig(aSection, KFldStep(), step);
   772 	if ( step<=0 )
   773 		{
   774 		ERR_PRINTF2(KLogInvalidStep, step);
   775 		SetBlockResult(EFail);
   776 		dataOk=EFalse;
   777 		}
   778 
   779 	TInt	frameDelay=KDefaultFrameDelay;
   780 	GetIntFromConfig(aSection, KFldFrameDelay(), frameDelay);
   781 	if ( frameDelay<=0 )
   782 		{
   783 		ERR_PRINTF2(KLogInvalidStep, frameDelay);
   784 		SetBlockResult(EFail);
   785 		dataOk=EFalse;
   786 		}
   787 
   788 	if ( dataOk )
   789 	 	{
   790 		TInt	pixelsX=iDisplayXPixels;
   791 		TInt	pixelsY=iDisplayYPixels;
   792 		TUint8*	memoryAddress=iDisplayMemoryAddress;
   793 		memoryAddress+=iDisplayOffsetToFirstPixel;
   794 
   795 		//	Fill the background
   796 		INFO_PRINTF1(_L("-->Fill the background"));
   797 		TUint8*	address=memoryAddress;
   798 		TInt	x=0;
   799 		TInt	y=0;
   800 		TInt	line=0;
   801 		for ( line=0; line<pixelsY; ++line )
   802 			{
   803 			DrawLine(colorBackground, address, 0, pixelsX);
   804 			address+=iDisplayOffsetBetweenLines;
   805 			}
   806 		INFO_PRINTF1(_L("<--Fill the background"));
   807 
   808 		//	Draw box moving from top left to top right
   809 		TInt	max=pixelsX-boxLength;
   810 		for ( x=0; x<max; x+=step )
   811 			{
   812 			address=memoryAddress;
   813 			for ( line=0; line<boxWidth; ++line )
   814 				{
   815 				DrawLine(colorForeground, address, x, boxLength+x);
   816 				address+=iDisplayOffsetBetweenLines;
   817 				}
   818 			Timedelay(frameDelay);
   819 
   820 			address=memoryAddress;
   821 			for ( line=0; line<boxWidth; ++line )
   822 				{
   823 				DrawLine(colorBackground, address, x, boxLength+x);
   824 				address+=iDisplayOffsetBetweenLines;
   825 				}
   826 			}
   827 
   828 		//	Draw box moving from top right to bottom right
   829 		//	Missing out first as it was draw at the end of the previous draw
   830 		max=pixelsY-boxWidth;
   831 		x=pixelsX-boxLength;
   832 		for ( y=step; y<max; y+=step )
   833 			{
   834 			address=memoryAddress+y*iDisplayOffsetBetweenLines;
   835 			for ( line=0; line<boxWidth; ++line )
   836 				{
   837 				DrawLine(colorForeground, address, x, pixelsX);
   838 				address+=iDisplayOffsetBetweenLines;
   839 				}
   840 			Timedelay(frameDelay);
   841 
   842 			address=memoryAddress+y*iDisplayOffsetBetweenLines;
   843 			for ( line=0; line<boxWidth; ++line )
   844 				{
   845 				DrawLine(colorBackground, address, x, pixelsX);
   846 				address+=iDisplayOffsetBetweenLines;
   847 				}
   848 			}
   849 
   850 		//	Draw box moving from bottom right to bottom left
   851 		//	Missing out first as it was draw at the end of the previous draw
   852 		for ( x=pixelsX-boxLength; x>0; x-=step )
   853 			{
   854 			address=memoryAddress+pixelsY*iDisplayOffsetBetweenLines;
   855 			for ( line=0; line<boxWidth; ++line )
   856 				{
   857 				address-=iDisplayOffsetBetweenLines;
   858 				DrawLine(colorForeground, address, x, boxLength+x);
   859 				}
   860 			Timedelay(frameDelay);
   861 
   862 			address=memoryAddress+pixelsY*iDisplayOffsetBetweenLines;
   863 			for ( line=0; line<boxWidth; ++line )
   864 				{
   865 				address-=iDisplayOffsetBetweenLines;
   866 				DrawLine(colorBackground, address, x, boxLength+x);
   867 				}
   868 			}
   869 
   870 		//	Draw box moving from bottom right bottom left to top right
   871 		//	Missing out first as it was draw at the end of the previous draw
   872 		for ( y=pixelsY-boxWidth; y>0; y-=step )
   873 			{
   874 			address=memoryAddress+y*iDisplayOffsetBetweenLines;
   875 			for ( line=0; line<boxWidth; ++line )
   876 				{
   877 				DrawLine(colorForeground, address, 0, boxLength);
   878 				address+=iDisplayOffsetBetweenLines;
   879 				}
   880 			Timedelay(frameDelay);
   881 
   882 			address=memoryAddress+y*iDisplayOffsetBetweenLines;
   883 			for ( line=0; line<boxWidth; ++line )
   884 				{
   885 				DrawLine(colorBackground, address, 0, boxLength);
   886 				address+=iDisplayOffsetBetweenLines;
   887 				}
   888 			}
   889 		}
   890 	}
   891 
   892 /**
   893 Utility function to Fill color in a 16pixels*16 lines area at the given xb,yb position in the screen
   894 @param ColorVal color to be filled in .For 4 bpp mode ColorVal contains only 4 bits of information, the upper 4 bits are empty
   895 	For 8 bpp mode all the 8 bits are filled in , the value is taken from the standard OS palette
   896 	For all other modes ColorVal holds data in rgb 332 format.
   897 
   898 @param aColor			Color to draw in
   899 @param aMemoryAddress	Address offset to start of line
   900 @param aLeftMargin		Left margin to not draw in
   901 @param aPixelsX			Number of pixels to draw on line
   902 */
   903 void CT_ScreenDriverData::DrawLine(TUint aColor, TUint8* aMemoryAddress, TInt aLeftMargin, TInt aPixelsX)
   904 	{
   905 
   906 	switch ( iDisplayBitsPerPixel )
   907 		{
   908 	case BPP32:
   909 	case BPP24:
   910 		{
   911 		TUint32*	pixelPtr=(TUint32*)aMemoryAddress;
   912 		TUint32		color=aColor;
   913 		pixelPtr += aLeftMargin;
   914 		for ( TInt x=aLeftMargin; x<aPixelsX; ++x )
   915 			{
   916 			*pixelPtr++=color;
   917 			}
   918 		}
   919 		break;
   920 		
   921 	case BPP16:
   922 	case BPP12:
   923 		{
   924 		TUint16*	pixelPtr=(TUint16*)aMemoryAddress;
   925 		TUint16		color=aColor;
   926 		pixelPtr += aLeftMargin;
   927 		for ( TInt x=aLeftMargin; x<aPixelsX; ++x )
   928 			{
   929 			*pixelPtr++=color;
   930 			}
   931 		}
   932 		break;
   933 	case BPP8:
   934 		{
   935 		TUint8*	pixelPtr=aMemoryAddress;
   936 		TUint8	color=aColor;
   937 		pixelPtr += aLeftMargin;
   938 		for ( TInt x=aLeftMargin; x<aPixelsX; ++x )
   939 			{
   940 			*pixelPtr++=color;
   941 			}
   942 		}
   943 		break;
   944 	default:
   945 		break;
   946 		}
   947 	}
   948 
   949 /**
   950  * Fill the Screen color with multicoloured horizontal strips using screen base memory address
   951  *
   952  * @param aSection			The section in the ini containing data for the command
   953  *
   954  * @return					void
   955  *
   956  * @leave					System wide error
   957  */
   958 void CT_ScreenDriverData::DoCmdUtilityFillHorizontalStripL(const TDesC& aSection)
   959 	{
   960 	TBuf<KMaxTestExecuteCommandLength>	tempStore;
   961 
   962 	RArray<TUint>	color;
   963 	CleanupClosePushL(color);
   964 	
   965 	RArray<TDesC>	colorLog;
   966 	CleanupClosePushL(colorLog);
   967 
   968 	TBool		moreData=ETrue;
   969 	TBool		index=0;
   970 	while ( moreData )
   971 		{
   972 		tempStore.Format(KFldColorIndex(), ++index);
   973 		TUint	colorTemp;
   974 		TPtrC	colorLogTemp;
   975 
   976 		moreData=GetColorFromConfig(aSection, tempStore, colorTemp, colorLogTemp);
   977 		if ( moreData )
   978 			{
   979 			color.AppendL(colorTemp);
   980 			colorLog.AppendL(colorLogTemp);
   981 			}
   982 		}
   983 
   984 	//	Must have more than one color for this to work
   985 	TBool	dataOk=color.Count()>1;
   986 	if ( !dataOk )
   987 		{
   988 		ERR_PRINTF1(KLogNotEnoughData);
   989 		SetBlockResult(EFail);
   990 		}
   991 
   992 	TInt	margin=KDefaultMargin;
   993 	GetIntFromConfig(aSection, KFldMargin(), margin);
   994 	if ( margin<=0 )
   995 		{
   996 		ERR_PRINTF2(KLogInvalidMargin, margin);
   997 		SetBlockResult(EFail);
   998 		dataOk=EFalse;
   999 		}
  1000 
  1001 	if ( dataOk )
  1002 		{
  1003 		TInt	pixelsX=iDisplayXPixels;
  1004 		TInt	pixelsY=iDisplayYPixels;
  1005 		TUint8*	memoryAddress=iDisplayMemoryAddress;
  1006 		memoryAddress+=iDisplayOffsetToFirstPixel;
  1007 				
  1008 		TInt	count=0;
  1009 		TInt 	colorIndex=0;
  1010 		for ( TInt liney=0; liney<pixelsY; liney++ )
  1011 			{
  1012 			DrawLine(color[colorIndex], memoryAddress, 0, pixelsX);
  1013 			memoryAddress+=iDisplayOffsetBetweenLines;
  1014 			
  1015 			++count;
  1016 			if( count>margin )
  1017 				{
  1018 				++colorIndex;
  1019 				count=0;
  1020 				}
  1021 			
  1022 			if ( colorIndex>=color.Count() )
  1023 				{
  1024 				colorIndex=0;
  1025 				}
  1026 			}
  1027 
  1028 		}
  1029 	CleanupStack::PopAndDestroy(2, &color);
  1030 
  1031 	TInt screenDelay;	
  1032 	TBool screenDelayOk = GetIntFromConfig(aSection, KScreenDelay(), screenDelay);
  1033 	if(!screenDelayOk)
  1034 		{
  1035 			screenDelay = KDefaultScreenDelay;
  1036 			INFO_PRINTF1(_L("defualt screen delay value used"));
  1037 		}
  1038 	CDataWrapperBase::Timedelay(MICROSECS_TO_SECS(screenDelay));
  1039 
  1040 	}
  1041 
  1042 /**
  1043  * Fill the Screen color with multicoloured vertical strips using screen based memory address
  1044  *
  1045  * @param aSection			The section in the ini containing data for the command
  1046  *
  1047  * @return					void
  1048  *
  1049  * @leave					System wide error
  1050  */
  1051 void CT_ScreenDriverData::DoCmdUtilityFillVerticalStripL(const TDesC& aSection)
  1052 	{
  1053 	TBuf<KMaxTestExecuteCommandLength>	tempStore;
  1054 
  1055 	RArray<TUint>	color;
  1056 	CleanupClosePushL(color);
  1057 
  1058 	RArray<TDesC>	colorLog;
  1059 	CleanupClosePushL(colorLog);
  1060 
  1061 	TBool	moreData=ETrue;
  1062 	TBool	index=0;
  1063 	while ( moreData )
  1064 		{
  1065 		tempStore.Format(KFldColorIndex(), ++index);
  1066 		TUint	colorTemp;
  1067 		TPtrC	colorLogTemp;
  1068 
  1069 		moreData=GetColorFromConfig(aSection, tempStore, colorTemp, colorLogTemp);
  1070 		if ( moreData )
  1071 			{
  1072 			color.AppendL(colorTemp);
  1073 			colorLog.AppendL(colorLogTemp);
  1074 			}
  1075 		}
  1076 
  1077 	//	Must have more than one color for this to work
  1078 	TBool	dataOk=color.Count()>1;
  1079 	if ( !dataOk )
  1080 		{
  1081 		ERR_PRINTF1(KLogNotEnoughData);
  1082 		SetBlockResult(EFail);
  1083 		}
  1084 
  1085 	TInt	margin=KDefaultMargin;
  1086 	GetIntFromConfig(aSection, KFldMargin(), margin);
  1087 	if ( margin<=0 )
  1088 		{
  1089 		ERR_PRINTF2(KLogInvalidMargin, margin);
  1090 		SetBlockResult(EFail);
  1091 		dataOk=EFalse;
  1092 		}
  1093 
  1094 	if ( dataOk )
  1095 	 	{
  1096 		TInt	pixelsX=iDisplayXPixels;
  1097 		TInt	pixelsY=iDisplayYPixels;
  1098 		TUint8*	memoryAddress=iDisplayMemoryAddress;
  1099 		memoryAddress+=iDisplayOffsetToFirstPixel;
  1100 
  1101 		TInt	colorIndex=0;
  1102 		TUint8*	address;
  1103 		TInt	right=0;
  1104 		for ( TInt left=0; left<pixelsX; left+=margin )
  1105 			{
  1106 			address = memoryAddress;
  1107 			right += margin;
  1108 			if ( right>=pixelsX )
  1109 				{
  1110 				right=pixelsX-1;
  1111 				}
  1112 			for ( TInt liney=0; liney<pixelsY; liney++ )
  1113 				{
  1114 				DrawLine(color[colorIndex], address, left, right);
  1115 				address+=iDisplayOffsetBetweenLines;
  1116 				}
  1117 			++colorIndex;	
  1118 			if ( colorIndex>=color.Count() )
  1119 				{
  1120 				colorIndex=0;
  1121 				}
  1122 			}
  1123 
  1124 		}
  1125 	CleanupStack::PopAndDestroy(2, &color);
  1126 	
  1127 	TInt screenDelay;	
  1128 	TBool screenDelayOk = GetIntFromConfig(aSection, KScreenDelay(), screenDelay);
  1129 	if(!screenDelayOk)
  1130 		{
  1131 			screenDelay = KDefaultScreenDelay;
  1132 			INFO_PRINTF1(_L("defualt screen delay value used"));
  1133 		}
  1134 	CDataWrapperBase::Timedelay(MICROSECS_TO_SECS(screenDelay));
  1135 
  1136 	}
  1137 
  1138