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