1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/boardsupport/haitest/bspsvs/suite/bsp/lcd/src/T_ScreenDriverData.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,1138 @@
1.4 +/*
1.5 +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
1.6 +* All rights reserved.
1.7 +* This component and the accompanying materials are made available
1.8 +* under the terms of "Eclipse Public License v1.0"
1.9 +* which accompanies this distribution, and is available
1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.11 +*
1.12 +* Initial Contributors:
1.13 +* Nokia Corporation - initial contribution.
1.14 +*
1.15 +* Contributors:
1.16 +*
1.17 +* Description:
1.18 +*
1.19 +*/
1.20 +
1.21 +#include "T_ScreenDriverData.h"
1.22 +
1.23 +#define MICROSECS_TO_SECS(x) (x*1000000)
1.24 +
1.25 +const TInt BPP8 =8;
1.26 +const TInt BPP12 =12;
1.27 +const TInt BPP16 =16;
1.28 +const TInt BPP24 =24;
1.29 +const TInt BPP32 =32;
1.30 +
1.31 +const TInt KDefaultBoxLength =16;
1.32 +const TInt KDefaultBoxWidth =16;
1.33 +const TInt KDefaultBoxStep =16;
1.34 +const TInt KDefaultMargin =16;
1.35 +const TInt KDefaultFrameDelay =20000;
1.36 +const TInt KDefaultScreenDelay =5;
1.37 +
1.38 +
1.39 +
1.40 +//These are for masks and shifts for rgb 332 data format
1.41 +/*@{*/
1.42 +_LIT(KEnumDisplayState, "EDisplayState");
1.43 +_LIT(KEnumBacklightState, "EBacklightState");
1.44 +_LIT(KEnumBacklight, "EBacklight");
1.45 +_LIT(KEnumDisplayMaxBrightness, "EDisplayBrightnessMax");
1.46 +_LIT(KEnumDisplayBrightness, "EDisplayBrightness");
1.47 +_LIT(KEnumDisplayMaxContrast, "EDisplayContrastMax");
1.48 +_LIT(KEnumDisplayContrast, "EDisplayContrast");
1.49 +_LIT(KEnumDisplayMemoryAddress, "EDisplayMemoryAddress");
1.50 +_LIT(KEnumDisplayIsPixelOrderRGB, "EDisplayIsPixelOrderRGB");
1.51 +_LIT(KEnumDisplayIsPixelOrderLandscape, "EDisplayIsPixelOrderLandscape");
1.52 +_LIT(KEnumDisplayMode, "EDisplayMode");
1.53 +_LIT(KEnumDisplayNumModes, "EDisplayNumModes");
1.54 +_LIT(KEnumDisplayColors, "EDisplayColors");
1.55 +_LIT(KEnumDisplayPaletteEntry, "EDisplayPaletteEntry");
1.56 +_LIT(KEnumDisplayXPixels, "EDisplayXPixels");
1.57 +_LIT(KEnumDisplayYPixels, "EDisplayYPixels");
1.58 +_LIT(KEnumDisplayXTwips, "EDisplayXTwips");
1.59 +_LIT(KEnumDisplayYTwips, "EDisplayYTwips");
1.60 +_LIT(KEnumDisplayBitsPerPixel, "EDisplayBitsPerPixel");
1.61 +_LIT(KEnumDisplayOffsetToFirstPixel, "EDisplayOffsetToFirstPixel");
1.62 +_LIT(KEnumDisplayOffsetBetweenLines, "EDisplayOffsetBetweenLines");
1.63 +_LIT(KEnumDisplayIsPalettized, "EDisplayIsPalettized");
1.64 +_LIT(KEnumDisplayNumberOfScreens, "EDisplayNumberOfScreens");
1.65 +_LIT(KEnumNull, "");
1.66 +
1.67 +_LIT(KFormatEntryField, "%S_%S");
1.68 +
1.69 +_LIT(KFldColor, "color");
1.70 +_LIT(KFldColorBackground, "background");
1.71 +_LIT(KFldColorForeground, "foreground");
1.72 +_LIT(KFldColorIndex, "color%d");
1.73 +_LIT(KFldFrameDelay, "framedelay");
1.74 +_LIT(KFldEndIndex, "endIndex");
1.75 +_LIT(KFldLength, "length");
1.76 +_LIT(KFldMargin, "margin");
1.77 +_LIT(KFldMask, "mask");
1.78 +_LIT(KFldShift, "shift");
1.79 +_LIT(KFldStartIndex, "startIndex");
1.80 +_LIT(KFldStep, "step");
1.81 +_LIT(KFldWidth, "width");
1.82 +
1.83 +_LIT(KTagRgbRed, "red");
1.84 +_LIT(KTagRgbGreen, "green");
1.85 +_LIT(KTagRgbBlue, "blue");
1.86 +_LIT(KTagRgbAlpha, "alpha");
1.87 +
1.88 +_LIT(KCmdUtilityFillColor, "utilityFillColor");
1.89 +_LIT(KCmdUtilityFillMultiColor, "utilityFillMultiColor");
1.90 +_LIT(KCmdUtilityMovingRectangle, "utilityMovingRectangle");
1.91 +_LIT(KCmdUtilityFillHorizontalStrip, "utilityFillHorizontalStrip");
1.92 +_LIT(KCmdUtilityFillVerticalStrip, "utilityFillVerticalStrip");
1.93 +_LIT(KCmdUtilityPromptMessage, "utilityPromptMessage");
1.94 +
1.95 +_LIT(KScreenDelay, "screenDelay");
1.96 +
1.97 +_LIT(KLogInvalidLength, "Invalid length %d. Must be >0.");
1.98 +_LIT(KLogInvalidMargin, "Invalid margin %d. Must be >0.");
1.99 +_LIT(KLogInvalidStep, "Invalid step %d. Must be >0.");
1.100 +_LIT(KLogInvalidWidth, "Invalid width %d. Must be >0.");
1.101 +_LIT(KLogMissingParameter, "Missing parameter '%S'");
1.102 +_LIT(KLogNotEnoughData, "Not enough data");
1.103 +/*@}*/
1.104 +
1.105 +const CT_HALData::THalTableLookup CT_ScreenDriverData::iTableLookup[] =
1.106 + {
1.107 +// Enum as a descriptor Enum Prepare input Prepare paramters prior Validation of Store data returned after a Flag indicating
1.108 +// value prior to to HAL::Get call value returned successful HAL::Get or if validation
1.109 +// HAL::Set call after a successful HAL::Set call is mandatory
1.110 +// HAL::Get call
1.111 + KEnumDisplayState, HALData::EDisplayState, SetPrepareInt, GetPrepareDisplayMode, GetValidationInt, SetDisplayState, EFalse,
1.112 + KEnumBacklightState, HALData::EBacklightState, SetPrepareInt, GetPrepareDisplayMode, GetValidationInt, SetBacklightState, EFalse,
1.113 + KEnumBacklight, HALData::EBacklight, SetPrepareInt, GetPrepareDisplayMode, GetValidationInt, SetBacklight, EFalse,
1.114 + KEnumDisplayBrightness, HALData::EDisplayBrightness, SetPrepareInt, GetPrepareDisplayMode, GetValidationInt, SetDisplayMaxBrightness, EFalse,
1.115 + KEnumDisplayMaxBrightness, HALData::EDisplayBrightnessMax, SetPrepareInt, GetPrepareDisplayMode, GetValidationInt, SetDisplayBrightness, EFalse,
1.116 + KEnumDisplayContrast, HALData::EDisplayContrast, SetPrepareInt, GetPrepareDisplayMode, GetValidationInt, SetDisplayMaxContrast, EFalse,
1.117 + KEnumDisplayMaxContrast, HALData::EDisplayContrastMax, SetPrepareInt, GetPrepareDisplayMode, GetValidationInt, SetDisplayContrast, EFalse,
1.118 + KEnumDisplayMemoryAddress, HALData::EDisplayMemoryAddress, SetPrepareUint, GetPrepareDisplayMode, GetValidationUint, SetDisplayMemoryAddress, EFalse,
1.119 + KEnumDisplayIsPixelOrderLandscape, HALData::EDisplayIsPixelOrderLandscape, SetPrepareInt, GetPrepareDisplayMode, GetValidationInt, SetDisplayIsPixelOrderRGB, EFalse,
1.120 + KEnumDisplayIsPixelOrderRGB, HALData::EDisplayIsPixelOrderRGB, SetPrepareInt, GetPrepareDisplayMode, GetValidationInt, SetDisplayIsPixelOrderLandscape, EFalse,
1.121 + KEnumDisplayMode, HALData::EDisplayMode, SetPrepareInt, GetPrepareDisplayMode, GetValidationInt, SetDisplayMode, EFalse,
1.122 + KEnumDisplayNumModes, HALData::EDisplayNumModes, SetPrepareInt, GetPrepareDisplayMode, GetValidationInt, SetDisplayNumModes, EFalse,
1.123 + KEnumDisplayColors, HALData::EDisplayColors, SetPrepareInt, GetPrepareDisplayMode, GetValidationInt, SetDisplayColors, EFalse,
1.124 + KEnumDisplayPaletteEntry, HALData::EDisplayPaletteEntry, SetPrepareInt, GetPrepareColorIndex, GetValidationInt, SetDisplayPaletteEntry, EFalse,
1.125 + KEnumDisplayXPixels, HALData::EDisplayXPixels, SetPrepareInt, GetPrepareDisplayMode, GetValidationInt, SetDisplayXPixels, EFalse,
1.126 + KEnumDisplayYPixels, HALData::EDisplayYPixels, SetPrepareInt, GetPrepareDisplayMode, GetValidationInt, SetDisplayYPixels, EFalse,
1.127 + KEnumDisplayXTwips, HALData::EDisplayXTwips, SetPrepareInt, GetPrepareDisplayMode, GetValidationInt, SetDisplayXTwips, EFalse,
1.128 + KEnumDisplayYTwips, HALData::EDisplayYTwips, SetPrepareInt, GetPrepareDisplayMode, GetValidationInt, SetDisplayYTwips, EFalse,
1.129 + KEnumDisplayBitsPerPixel, HALData::EDisplayBitsPerPixel, SetPrepareInt, GetPrepareDisplayMode, GetValidationInt, SetDisplayBitsPerPixel, EFalse,
1.130 + KEnumDisplayOffsetToFirstPixel, HALData::EDisplayOffsetToFirstPixel, SetPrepareInt, GetPrepareDisplayMode, GetValidationInt, SetDisplayOffsetToFirstPixel, EFalse,
1.131 + KEnumDisplayOffsetBetweenLines, HALData::EDisplayOffsetBetweenLines, SetPrepareInt, GetPrepareDisplayMode, GetValidationInt, SetDisplayOffsetBetweenLines, EFalse,
1.132 + KEnumDisplayIsPalettized, HALData::EDisplayIsPalettized, SetPrepareInt, GetPrepareDisplayMode, GetValidationBool, SetDisplayIsPalettized, EFalse,
1.133 + KEnumDisplayNumberOfScreens, HALData::EDisplayNumberOfScreens, SetPrepareInt, GetPrepareDisplayMode, GetValidationInt, SetDisplayNumberOfScreens, EFalse,
1.134 + KEnumNull, (HALData::TAttribute)0, NULL, NULL, NULL, NULL, NULL
1.135 + };
1.136 +
1.137 +//////////////////////////////////////////////////////////////////////
1.138 +// Construction/Destruction
1.139 +//////////////////////////////////////////////////////////////////////
1.140 +
1.141 +CT_ScreenDriverData* CT_ScreenDriverData::NewL()
1.142 + {
1.143 + CT_ScreenDriverData* ret=new (ELeave) CT_ScreenDriverData();
1.144 + CleanupStack::PushL(ret);
1.145 + ret->ConstructL();
1.146 + CleanupStack::Pop(ret);
1.147 + return ret;
1.148 + }
1.149 +
1.150 +
1.151 +CT_ScreenDriverData::CT_ScreenDriverData()
1.152 +: CT_HALData(iTableLookup)
1.153 +, iDisplayState(-1)
1.154 +, iBacklightState(-1)
1.155 +, iBacklight(-1)
1.156 +, iDisplayMaxBrightness(-1)
1.157 +, iDisplayBrightness(-1)
1.158 +, iDisplayMaxContrast(-1)
1.159 +, iDisplayContrast(-1)
1.160 +, iDisplayMemoryAddress((TUint8*)(-1))
1.161 +, iDisplayIsPixelOrderRGB(-1)
1.162 +, iDisplayIsPixelOrderLandscape(-1)
1.163 +, iDisplayMode(-1)
1.164 +, iDisplayNumModes(-1)
1.165 +, iDisplayColors(-1)
1.166 +, iDisplayPaletteEntry(-1)
1.167 +, iDisplayXPixels(-1)
1.168 +, iDisplayYPixels(-1)
1.169 +, iDisplayXTwips(-1)
1.170 +, iDisplayYTwips(-1)
1.171 +, iDisplayBitsPerPixel(-1)
1.172 +, iDisplayOffsetToFirstPixel(-1)
1.173 +, iDisplayOffsetBetweenLines(-1)
1.174 +, iDisplayIsPalettized(EFalse)
1.175 +, iDisplayNumberOfScreens(-1)
1.176 + {
1.177 + }
1.178 +
1.179 +void CT_ScreenDriverData::ConstructL()
1.180 +/**
1.181 + * Second phase construction
1.182 + *
1.183 + * @internalComponent
1.184 + *
1.185 + * @return N/A
1.186 + *
1.187 + * @pre None
1.188 + * @post None
1.189 + *
1.190 + * @leave system wide error
1.191 + */
1.192 + {
1.193 + }
1.194 +
1.195 +CT_ScreenDriverData::~CT_ScreenDriverData()
1.196 +/**
1.197 + * Public destructor
1.198 + */
1.199 + {
1.200 + iPalette.Close();
1.201 + }
1.202 +
1.203 +TAny* CT_ScreenDriverData::GetObject()
1.204 +/**
1.205 + * Return a pointer to the object that the data wraps
1.206 + *
1.207 + * @return pointer to the object that the data wraps
1.208 + */
1.209 + {
1.210 + return NULL;
1.211 + }
1.212 +
1.213 +// Prepare the range of values that are getting as color indexs
1.214 +TBool CT_ScreenDriverData::GetPrepareColorIndex(CDataWrapperBase* aThis, const TDesC& aSection, TInt& aValueStart, TInt& aValueEnd)
1.215 + {
1.216 + CT_ScreenDriverData* thisPtr=static_cast<CT_ScreenDriverData*>(aThis);
1.217 + TBool ret=thisPtr->GetIntFromConfig(aSection, KFldStartIndex(), aValueStart);
1.218 + if ( !ret )
1.219 + {
1.220 + thisPtr->ERR_PRINTF2(KLogMissingParameter, &KFldStartIndex());
1.221 + thisPtr->SetBlockResult(EFail);
1.222 + }
1.223 +
1.224 + aValueEnd=aValueStart;
1.225 + thisPtr->GetIntFromConfig(aSection, KFldEndIndex(), aValueEnd);
1.226 +
1.227 + return ret;
1.228 + }
1.229 +
1.230 +// Prepare the range of values that are getting as just the display mode
1.231 +TBool CT_ScreenDriverData::GetPrepareDisplayMode(CDataWrapperBase* aThis, const TDesC& /*aSection*/, TInt& aValueStart, TInt& aValueEnd)
1.232 + {
1.233 + aValueStart=aValueEnd=static_cast<CT_ScreenDriverData*>(aThis)->iDisplayMode;
1.234 +
1.235 + return ETrue;
1.236 + }
1.237 +
1.238 +// Store the display state
1.239 +void CT_ScreenDriverData::SetDisplayState(CDataWrapperBase* aThis, TInt aValue)
1.240 + {
1.241 + static_cast<CT_ScreenDriverData*>(aThis)->iDisplayState=aValue;
1.242 + }
1.243 +
1.244 +// Store the backlight state
1.245 +void CT_ScreenDriverData::SetBacklightState(CDataWrapperBase* aThis, TInt aValue)
1.246 + {
1.247 + static_cast<CT_ScreenDriverData*>(aThis)->iBacklightState=aValue;
1.248 + }
1.249 +
1.250 +// Store the backlight
1.251 +void CT_ScreenDriverData::SetBacklight(CDataWrapperBase* aThis, TInt aValue)
1.252 + {
1.253 + static_cast<CT_ScreenDriverData*>(aThis)->iBacklight=aValue;
1.254 + }
1.255 +
1.256 +// Store the displays maximum brightness
1.257 +void CT_ScreenDriverData::SetDisplayMaxBrightness(CDataWrapperBase* aThis, TInt aValue)
1.258 + {
1.259 + static_cast<CT_ScreenDriverData*>(aThis)->iDisplayMaxBrightness=aValue;
1.260 + }
1.261 +
1.262 +// Store the displays brightness
1.263 +void CT_ScreenDriverData::SetDisplayBrightness(CDataWrapperBase* aThis, TInt aValue)
1.264 + {
1.265 + static_cast<CT_ScreenDriverData*>(aThis)->iDisplayBrightness=aValue;
1.266 + }
1.267 +
1.268 +// Store the displays maximum contrast
1.269 +void CT_ScreenDriverData::SetDisplayMaxContrast(CDataWrapperBase* aThis, TInt aValue)
1.270 + {
1.271 + static_cast<CT_ScreenDriverData*>(aThis)->iDisplayMaxContrast=aValue;
1.272 + }
1.273 +
1.274 +// Store the displays contrast
1.275 +void CT_ScreenDriverData::SetDisplayContrast(CDataWrapperBase* aThis, TInt aValue)
1.276 + {
1.277 + static_cast<CT_ScreenDriverData*>(aThis)->iDisplayContrast=aValue;
1.278 + }
1.279 +
1.280 +// Store the displays memory address
1.281 +void CT_ScreenDriverData::SetDisplayMemoryAddress(CDataWrapperBase* aThis, TInt aValue)
1.282 + {
1.283 + static_cast<CT_ScreenDriverData*>(aThis)->iDisplayMemoryAddress=(TUint8*)(aValue);
1.284 + }
1.285 +
1.286 +// Store the displays pixel RGB order flag
1.287 +void CT_ScreenDriverData::SetDisplayIsPixelOrderRGB(CDataWrapperBase* aThis, TInt aValue)
1.288 + {
1.289 + static_cast<CT_ScreenDriverData*>(aThis)->iDisplayIsPixelOrderRGB=aValue;
1.290 + }
1.291 +
1.292 +// Store the displays landscape pixel order flag
1.293 +void CT_ScreenDriverData::SetDisplayIsPixelOrderLandscape(CDataWrapperBase* aThis, TInt aValue)
1.294 + {
1.295 + static_cast<CT_ScreenDriverData*>(aThis)->iDisplayIsPixelOrderLandscape=aValue;
1.296 + }
1.297 +
1.298 +// Store the displays mode
1.299 +void CT_ScreenDriverData::SetDisplayMode(CDataWrapperBase* aThis, TInt aValue)
1.300 + {
1.301 + static_cast<CT_ScreenDriverData*>(aThis)->iDisplayMode=aValue;
1.302 + }
1.303 +
1.304 +// Store the displays supported number of modes
1.305 +void CT_ScreenDriverData::SetDisplayNumModes(CDataWrapperBase* aThis, TInt aValue)
1.306 + {
1.307 + static_cast<CT_ScreenDriverData*>(aThis)->iDisplayNumModes=aValue;
1.308 + }
1.309 +
1.310 +// Store the displays supported number of colors
1.311 +void CT_ScreenDriverData::SetDisplayColors(CDataWrapperBase* aThis, TInt aValue)
1.312 + {
1.313 + CT_ScreenDriverData* thisPtr=static_cast<CT_ScreenDriverData*>(aThis);
1.314 + thisPtr->iDisplayColors=aValue;
1.315 + thisPtr->iPalette.Reset();
1.316 + thisPtr->iPalette.Reserve(aValue);
1.317 + }
1.318 +
1.319 +// Store the an entry in the displays color palette
1.320 +void CT_ScreenDriverData::SetDisplayPaletteEntry(CDataWrapperBase* aThis, TInt aValue)
1.321 + {
1.322 + CT_ScreenDriverData* thisPtr=static_cast<CT_ScreenDriverData*>(aThis);
1.323 + thisPtr->iDisplayPaletteEntry=aValue;
1.324 + if ( thisPtr->iPalette.Count()<thisPtr->iValue )
1.325 + {
1.326 + thisPtr->iPalette[thisPtr->iValue]=aValue;
1.327 + }
1.328 + }
1.329 +
1.330 +// Store the displays width in pixels
1.331 +void CT_ScreenDriverData::SetDisplayXPixels(CDataWrapperBase* aThis, TInt aValue)
1.332 + {
1.333 + static_cast<CT_ScreenDriverData*>(aThis)->iDisplayXPixels=aValue;
1.334 + }
1.335 +
1.336 +// Store the displays height in pixels
1.337 +void CT_ScreenDriverData::SetDisplayYPixels(CDataWrapperBase* aThis, TInt aValue)
1.338 + {
1.339 + static_cast<CT_ScreenDriverData*>(aThis)->iDisplayYPixels=aValue;
1.340 + }
1.341 +
1.342 +// Store the displays width in twips
1.343 +void CT_ScreenDriverData::SetDisplayXTwips(CDataWrapperBase* aThis, TInt aValue)
1.344 + {
1.345 + static_cast<CT_ScreenDriverData*>(aThis)->iDisplayXTwips=aValue;
1.346 + }
1.347 +
1.348 +// Store the displays height in twips
1.349 +void CT_ScreenDriverData::SetDisplayYTwips(CDataWrapperBase* aThis, TInt aValue)
1.350 + {
1.351 + static_cast<CT_ScreenDriverData*>(aThis)->iDisplayYTwips=aValue;
1.352 + }
1.353 +
1.354 +// Store the displays number of bits per pixel
1.355 +void CT_ScreenDriverData::SetDisplayBitsPerPixel(CDataWrapperBase* aThis, TInt aValue)
1.356 + {
1.357 + static_cast<CT_ScreenDriverData*>(aThis)->iDisplayBitsPerPixel=aValue;
1.358 + }
1.359 +
1.360 +// Store the displays memory address offset to the first pixel
1.361 +void CT_ScreenDriverData::SetDisplayOffsetToFirstPixel(CDataWrapperBase* aThis, TInt aValue)
1.362 + {
1.363 + static_cast<CT_ScreenDriverData*>(aThis)->iDisplayOffsetToFirstPixel=aValue;
1.364 + }
1.365 +
1.366 +// Store the displays memory address offset between successive lines
1.367 +void CT_ScreenDriverData::SetDisplayOffsetBetweenLines(CDataWrapperBase* aThis, TInt aValue)
1.368 + {
1.369 + static_cast<CT_ScreenDriverData*>(aThis)->iDisplayOffsetBetweenLines=aValue;
1.370 + }
1.371 +
1.372 +// Store the displays flag indicating if a palette is used
1.373 +void CT_ScreenDriverData::SetDisplayIsPalettized(CDataWrapperBase* aThis, TInt aValue)
1.374 + {
1.375 + static_cast<CT_ScreenDriverData*>(aThis)->iDisplayIsPalettized=(aValue!=0);
1.376 + }
1.377 +
1.378 +// Store the devices number of screens supported
1.379 +void CT_ScreenDriverData::SetDisplayNumberOfScreens(CDataWrapperBase* aThis, TInt aValue)
1.380 + {
1.381 + static_cast<CT_ScreenDriverData*>(aThis)->iDisplayNumberOfScreens=aValue;
1.382 + }
1.383 +TBool CT_ScreenDriverData::GetRgbFromConfig(const TDesC& aSectName, const TDesC& aKeyName, TUint& aRed, TUint& aGreen, TUint& aBlue, TUint& aAlpha)
1.384 + {
1.385 + TBuf<KMaxTestExecuteCommandLength> tempStore;
1.386 +
1.387 + tempStore.Format(KFormatEntryField, &aKeyName, &KTagRgbRed);
1.388 + TBool ret=GetUintFromConfig(aSectName, tempStore, aRed);
1.389 +
1.390 + tempStore.Format(KFormatEntryField, &aKeyName, &KTagRgbGreen);
1.391 + if ( !GetUintFromConfig(aSectName, tempStore, aGreen) )
1.392 + {
1.393 + ret=EFalse;
1.394 + }
1.395 +
1.396 + tempStore.Format(KFormatEntryField, &aKeyName, &KTagRgbBlue);
1.397 + if ( !GetUintFromConfig(aSectName, tempStore, aBlue) )
1.398 + {
1.399 + ret=EFalse;
1.400 + }
1.401 +
1.402 + aAlpha=0;
1.403 + tempStore.Format(KFormatEntryField, &aKeyName, &KTagRgbAlpha);
1.404 + GetUintFromConfig(aSectName, tempStore, aAlpha);
1.405 +
1.406 + return ret;
1.407 + }
1.408 +
1.409 +TBool CT_ScreenDriverData::GetRgbFromConfig(const TDesC& aSectName, const TDesC& aKeyName, TInt& aRed, TInt& aGreen, TInt& aBlue, TInt& aAlpha)
1.410 + {
1.411 + TBuf<KMaxTestExecuteCommandLength> tempStore;
1.412 +
1.413 + tempStore.Format(KFormatEntryField, &aKeyName, &KTagRgbRed);
1.414 + TBool ret=GetIntFromConfig(aSectName, tempStore, aRed);
1.415 +
1.416 + tempStore.Format(KFormatEntryField, &aKeyName, &KTagRgbGreen);
1.417 + if ( !GetIntFromConfig(aSectName, tempStore, aGreen) )
1.418 + {
1.419 + ret=EFalse;
1.420 + }
1.421 +
1.422 + tempStore.Format(KFormatEntryField, &aKeyName, &KTagRgbBlue);
1.423 + if ( !GetIntFromConfig(aSectName, tempStore, aBlue) )
1.424 + {
1.425 + ret=EFalse;
1.426 + }
1.427 +
1.428 + aAlpha=0;
1.429 + tempStore.Format(KFormatEntryField, &aKeyName, &KTagRgbAlpha);
1.430 + GetIntFromConfig(aSectName, tempStore, aAlpha);
1.431 +
1.432 + return ret;
1.433 + }
1.434 +
1.435 +TBool CT_ScreenDriverData::GetColorFromConfig(const TDesC& aSectName, const TDesC& aKeyName, TUint& aColor, TPtrC& aLogColor)
1.436 + {
1.437 + TBool dataOk=ETrue;
1.438 +
1.439 + if ( iDisplayIsPalettized )
1.440 + {
1.441 + WARN_PRINTF1(_L("Testing of Palettes not supported\n"));
1.442 + dataOk=EFalse;
1.443 + }
1.444 +
1.445 + TUint colorRed;
1.446 + TUint colorGreen;
1.447 + TUint colorBlue;
1.448 + TUint colorAlpha;
1.449 + if ( !GetRgbFromConfig(aSectName, aKeyName, colorRed, colorGreen, colorBlue, colorAlpha) )
1.450 + {
1.451 + WARN_PRINTF2(KLogMissingParameter, &aKeyName);
1.452 + dataOk=EFalse;
1.453 + }
1.454 +
1.455 + if ( !GetStringFromConfig(aSectName, aKeyName, aLogColor) )
1.456 + {
1.457 + WARN_PRINTF2(KLogMissingParameter, &aKeyName);
1.458 + dataOk=EFalse;
1.459 + }
1.460 +
1.461 + TUint maskRed;
1.462 + TUint maskGreen;
1.463 + TUint maskBlue;
1.464 + TUint maskAlpha;
1.465 + if ( !GetRgbFromConfig(aSectName, KFldMask(), maskRed, maskGreen, maskBlue, maskAlpha) )
1.466 + {
1.467 + WARN_PRINTF2(KLogMissingParameter, &KFldMask());
1.468 + dataOk=EFalse;
1.469 + }
1.470 +
1.471 + TInt shiftRed;
1.472 + TInt shiftGreen;
1.473 + TInt shiftBlue;
1.474 + TInt shiftAlpha;
1.475 + if ( !GetRgbFromConfig(aSectName, KFldShift(), shiftRed, shiftGreen, shiftBlue, shiftAlpha) )
1.476 + {
1.477 + WARN_PRINTF2(KLogMissingParameter, &KFldShift());
1.478 + dataOk=EFalse;
1.479 + }
1.480 +
1.481 + aColor=0;
1.482 +
1.483 + // Apply Red
1.484 + colorRed &= maskRed;
1.485 + if ( shiftRed<0 )
1.486 + {
1.487 + aColor |= (colorRed >> -shiftRed);
1.488 + }
1.489 + else
1.490 + {
1.491 + aColor |= (colorRed << shiftRed);
1.492 + }
1.493 +
1.494 + // Apply Green
1.495 + colorGreen &= maskGreen;
1.496 + if ( shiftGreen<0 )
1.497 + {
1.498 + aColor |= (colorGreen >> -shiftGreen);
1.499 + }
1.500 + else
1.501 + {
1.502 + aColor |= (colorGreen << shiftGreen);
1.503 + }
1.504 +
1.505 + // Apply Blue
1.506 + colorBlue &= maskBlue;
1.507 + if ( shiftBlue<0 )
1.508 + {
1.509 + aColor |= (colorBlue >> -shiftBlue);
1.510 + }
1.511 + else
1.512 + {
1.513 + aColor |= (colorBlue << shiftBlue);
1.514 + }
1.515 +
1.516 + // Apply Alpha
1.517 + colorAlpha &= maskAlpha;
1.518 + if ( shiftAlpha<0 )
1.519 + {
1.520 + aColor |= (colorAlpha >> -shiftAlpha);
1.521 + }
1.522 + else
1.523 + {
1.524 + aColor |= (colorAlpha << shiftAlpha);
1.525 + }
1.526 +
1.527 + return dataOk;
1.528 + }
1.529 +
1.530 +TBool CT_ScreenDriverData::DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex)
1.531 +/**
1.532 + * Process a command read from the ini file
1.533 + *
1.534 + * @param aCommand The command to process
1.535 + * @param aSection The section in the ini containing data for the command
1.536 + * @param aAsyncErrorIndex Command index for async calls to return errors to
1.537 + *
1.538 + * @return ETrue if the command is processed
1.539 + *
1.540 + * @leave System wide error
1.541 + */
1.542 + {
1.543 + TBool ret=ETrue;
1.544 +
1.545 + if ( aCommand==KCmdUtilityFillColor )
1.546 + {
1.547 + DoCmdUtilityFillColorL(aSection);
1.548 + }
1.549 + else if ( aCommand==KCmdUtilityFillMultiColor )
1.550 + {
1.551 + DoCmdUtilityFillMultiColorL(aSection);
1.552 + }
1.553 + else if ( aCommand==KCmdUtilityMovingRectangle )
1.554 + {
1.555 + DoCmdUtilityMovingRectangleL(aSection);
1.556 + }
1.557 + else if ( aCommand==KCmdUtilityFillHorizontalStrip )
1.558 + {
1.559 + DoCmdUtilityFillHorizontalStripL(aSection);
1.560 + }
1.561 + else if ( aCommand==KCmdUtilityFillVerticalStrip)
1.562 + {
1.563 + DoCmdUtilityFillVerticalStripL(aSection);
1.564 + }
1.565 + else if ( aCommand==KCmdUtilityPromptMessage)
1.566 + {
1.567 + ret=CDataWrapperBase::DoCommandL(aCommand, aSection, aAsyncErrorIndex);
1.568 + }
1.569 + else
1.570 + {
1.571 + ret=CT_HALData::DoCommandL(aCommand, aSection, aAsyncErrorIndex);
1.572 + }
1.573 +
1.574 + return ret;
1.575 + }
1.576 +
1.577 +/**
1.578 + * Fill the Screen in a single color by using screen base memory address
1.579 + *
1.580 + * @param aSection The section in the ini containing data for the command
1.581 + *
1.582 + * @return void
1.583 + *
1.584 + * @leave System wide error
1.585 + */
1.586 +void CT_ScreenDriverData::DoCmdUtilityFillColorL(const TDesC& aSection)
1.587 + {
1.588 +
1.589 + TUint color;
1.590 + TPtrC logColor;
1.591 + TBool dataOk=GetColorFromConfig(aSection, KFldColor, color, logColor);
1.592 + if ( !dataOk )
1.593 + {
1.594 + ERR_PRINTF2(KLogMissingParameter, &KFldColor());
1.595 + SetBlockResult(EFail);
1.596 + }
1.597 + else
1.598 + {
1.599 + TInt pixelsX=iDisplayXPixels;
1.600 + TInt pixelsY=iDisplayYPixels;
1.601 + TUint8* memoryAddress=iDisplayMemoryAddress;
1.602 + memoryAddress+=iDisplayOffsetToFirstPixel;
1.603 +
1.604 + TInt line=0;
1.605 + for ( line=0; line<pixelsY; ++line )
1.606 + {
1.607 + DrawLine(color, memoryAddress, 0, pixelsX);
1.608 + memoryAddress+=iDisplayOffsetBetweenLines;
1.609 + }
1.610 +
1.611 + }
1.612 +
1.613 + //delays the image on the screen to allow for the user to verify
1.614 + TInt screenDelay;
1.615 + TBool screenDelayOk = GetIntFromConfig(aSection, KScreenDelay(), screenDelay);
1.616 + if(!screenDelayOk)
1.617 + {
1.618 +
1.619 + INFO_PRINTF1(_L("defualt screen delay value used"));
1.620 + screenDelay = KDefaultScreenDelay;
1.621 + }
1.622 + CDataWrapperBase::Timedelay(MICROSECS_TO_SECS(screenDelay));
1.623 + }
1.624 +
1.625 +/**
1.626 + * Fill the Screen color with multiple nested rectangles by using screen base memory address
1.627 + *
1.628 + * @param aSection The section in the ini containing data for the command
1.629 + *
1.630 + * @return void
1.631 + *
1.632 + * @leave System wide error
1.633 + */
1.634 +void CT_ScreenDriverData::DoCmdUtilityFillMultiColorL(const TDesC& aSection)
1.635 + {
1.636 + TBuf<KMaxTestExecuteCommandLength> tempStore;
1.637 +
1.638 + RArray<TUint> color;
1.639 + CleanupClosePushL(color);
1.640 +
1.641 + RArray<TDesC> colorLog;
1.642 + CleanupClosePushL(colorLog);
1.643 +
1.644 + TBool moreData=ETrue;
1.645 + TBool index=0;
1.646 + while ( moreData )
1.647 + {
1.648 + tempStore.Format(KFldColorIndex(), ++index);
1.649 + TUint colorTemp;
1.650 + TPtrC colorLogTemp;
1.651 +
1.652 + moreData=GetColorFromConfig(aSection, tempStore, colorTemp, colorLogTemp);
1.653 + if ( moreData )
1.654 + {
1.655 + color.AppendL(colorTemp);
1.656 + colorLog.AppendL(colorLogTemp);
1.657 + }
1.658 + }
1.659 +
1.660 + // Must have more than one color for this to work
1.661 + TBool dataOk=color.Count()>1;
1.662 + if ( !dataOk )
1.663 + {
1.664 + ERR_PRINTF1(KLogNotEnoughData);
1.665 + SetBlockResult(EFail);
1.666 + }
1.667 +
1.668 + TInt margin=KDefaultMargin;
1.669 + GetIntFromConfig(aSection, KFldMargin(), margin);
1.670 + if ( margin<=0 )
1.671 + {
1.672 + ERR_PRINTF2(KLogInvalidMargin, margin);
1.673 + SetBlockResult(EFail);
1.674 + dataOk=EFalse;
1.675 + }
1.676 +
1.677 + if ( dataOk )
1.678 + {
1.679 + TInt pixelsX=iDisplayXPixels;
1.680 + TInt pixelsY=iDisplayYPixels;
1.681 + TUint8* memoryAddress=iDisplayMemoryAddress;
1.682 + memoryAddress+=iDisplayOffsetToFirstPixel;
1.683 +
1.684 + TInt colorIndex=0;
1.685 + TInt left=0;
1.686 + TInt pixels=pixelsX;
1.687 + TInt top=0;
1.688 + TInt bottom=pixelsY;
1.689 + TInt line=0;
1.690 + while ( (left<pixels) && (top<bottom) )
1.691 + {
1.692 + TUint8* address=memoryAddress + top*iDisplayOffsetBetweenLines;
1.693 + for ( line=top; line<bottom; ++line )
1.694 + {
1.695 + DrawLine(color[colorIndex], address, left, pixels);
1.696 + address+=iDisplayOffsetBetweenLines;
1.697 + }
1.698 + left += margin;
1.699 + pixels -= margin;
1.700 + top += margin;
1.701 + bottom -= margin;
1.702 + ++colorIndex;
1.703 + if ( colorIndex>=color.Count() )
1.704 + {
1.705 + colorIndex=0;
1.706 + }
1.707 + }
1.708 +
1.709 + }
1.710 + CleanupStack::PopAndDestroy(2, &color);
1.711 +
1.712 + TInt screenDelay;
1.713 + TBool screenDelayOk = GetIntFromConfig(aSection, KScreenDelay(), screenDelay);
1.714 + if(!screenDelayOk)
1.715 + {
1.716 + screenDelay = KDefaultScreenDelay;
1.717 + INFO_PRINTF1(_L("defualt screen delay value used"));
1.718 + }
1.719 +
1.720 + CDataWrapperBase::Timedelay(MICROSECS_TO_SECS(screenDelay));
1.721 + }
1.722 +
1.723 +/**
1.724 + * Fill the Screen in a color and animate a rectangle moving around the perimeter of the screen
1.725 + * by using screen base memory address
1.726 + *
1.727 + * @param aSection The section in the ini containing data for the command
1.728 + *
1.729 + * @return void
1.730 + *
1.731 + * @leave System wide error
1.732 + */
1.733 +void CT_ScreenDriverData::DoCmdUtilityMovingRectangleL(const TDesC& aSection)
1.734 + {
1.735 + TBool dataOk=ETrue;
1.736 +
1.737 + TUint colorBackground;
1.738 + TPtrC logColorBackground;
1.739 + if ( !GetColorFromConfig(aSection, KFldColorBackground, colorBackground, logColorBackground) )
1.740 + {
1.741 + ERR_PRINTF2(KLogMissingParameter, &KFldColorBackground());
1.742 + SetBlockResult(EFail);
1.743 + dataOk=EFalse;
1.744 + }
1.745 +
1.746 + TUint colorForeground;
1.747 + TPtrC logColorForeground;
1.748 + if ( !GetColorFromConfig(aSection, KFldColorForeground, colorForeground, logColorForeground) )
1.749 + {
1.750 + ERR_PRINTF2(KLogMissingParameter, &KFldColorForeground());
1.751 + SetBlockResult(EFail);
1.752 + dataOk=EFalse;
1.753 + }
1.754 +
1.755 + TInt boxLength=KDefaultBoxLength;
1.756 + GetIntFromConfig(aSection, KFldLength(), boxLength);
1.757 + if ( boxLength<=0 )
1.758 + {
1.759 + ERR_PRINTF2(KLogInvalidLength, boxLength);
1.760 + SetBlockResult(EFail);
1.761 + dataOk=EFalse;
1.762 + }
1.763 +
1.764 + TInt boxWidth=KDefaultBoxWidth;
1.765 + GetIntFromConfig(aSection, KFldWidth(), boxWidth);
1.766 + if ( boxWidth<=0 )
1.767 + {
1.768 + ERR_PRINTF2(KLogInvalidWidth, boxWidth);
1.769 + SetBlockResult(EFail);
1.770 + dataOk=EFalse;
1.771 + }
1.772 +
1.773 + TInt step=KDefaultBoxStep;
1.774 + GetIntFromConfig(aSection, KFldStep(), step);
1.775 + if ( step<=0 )
1.776 + {
1.777 + ERR_PRINTF2(KLogInvalidStep, step);
1.778 + SetBlockResult(EFail);
1.779 + dataOk=EFalse;
1.780 + }
1.781 +
1.782 + TInt frameDelay=KDefaultFrameDelay;
1.783 + GetIntFromConfig(aSection, KFldFrameDelay(), frameDelay);
1.784 + if ( frameDelay<=0 )
1.785 + {
1.786 + ERR_PRINTF2(KLogInvalidStep, frameDelay);
1.787 + SetBlockResult(EFail);
1.788 + dataOk=EFalse;
1.789 + }
1.790 +
1.791 + if ( dataOk )
1.792 + {
1.793 + TInt pixelsX=iDisplayXPixels;
1.794 + TInt pixelsY=iDisplayYPixels;
1.795 + TUint8* memoryAddress=iDisplayMemoryAddress;
1.796 + memoryAddress+=iDisplayOffsetToFirstPixel;
1.797 +
1.798 + // Fill the background
1.799 + INFO_PRINTF1(_L("-->Fill the background"));
1.800 + TUint8* address=memoryAddress;
1.801 + TInt x=0;
1.802 + TInt y=0;
1.803 + TInt line=0;
1.804 + for ( line=0; line<pixelsY; ++line )
1.805 + {
1.806 + DrawLine(colorBackground, address, 0, pixelsX);
1.807 + address+=iDisplayOffsetBetweenLines;
1.808 + }
1.809 + INFO_PRINTF1(_L("<--Fill the background"));
1.810 +
1.811 + // Draw box moving from top left to top right
1.812 + TInt max=pixelsX-boxLength;
1.813 + for ( x=0; x<max; x+=step )
1.814 + {
1.815 + address=memoryAddress;
1.816 + for ( line=0; line<boxWidth; ++line )
1.817 + {
1.818 + DrawLine(colorForeground, address, x, boxLength+x);
1.819 + address+=iDisplayOffsetBetweenLines;
1.820 + }
1.821 + Timedelay(frameDelay);
1.822 +
1.823 + address=memoryAddress;
1.824 + for ( line=0; line<boxWidth; ++line )
1.825 + {
1.826 + DrawLine(colorBackground, address, x, boxLength+x);
1.827 + address+=iDisplayOffsetBetweenLines;
1.828 + }
1.829 + }
1.830 +
1.831 + // Draw box moving from top right to bottom right
1.832 + // Missing out first as it was draw at the end of the previous draw
1.833 + max=pixelsY-boxWidth;
1.834 + x=pixelsX-boxLength;
1.835 + for ( y=step; y<max; y+=step )
1.836 + {
1.837 + address=memoryAddress+y*iDisplayOffsetBetweenLines;
1.838 + for ( line=0; line<boxWidth; ++line )
1.839 + {
1.840 + DrawLine(colorForeground, address, x, pixelsX);
1.841 + address+=iDisplayOffsetBetweenLines;
1.842 + }
1.843 + Timedelay(frameDelay);
1.844 +
1.845 + address=memoryAddress+y*iDisplayOffsetBetweenLines;
1.846 + for ( line=0; line<boxWidth; ++line )
1.847 + {
1.848 + DrawLine(colorBackground, address, x, pixelsX);
1.849 + address+=iDisplayOffsetBetweenLines;
1.850 + }
1.851 + }
1.852 +
1.853 + // Draw box moving from bottom right to bottom left
1.854 + // Missing out first as it was draw at the end of the previous draw
1.855 + for ( x=pixelsX-boxLength; x>0; x-=step )
1.856 + {
1.857 + address=memoryAddress+pixelsY*iDisplayOffsetBetweenLines;
1.858 + for ( line=0; line<boxWidth; ++line )
1.859 + {
1.860 + address-=iDisplayOffsetBetweenLines;
1.861 + DrawLine(colorForeground, address, x, boxLength+x);
1.862 + }
1.863 + Timedelay(frameDelay);
1.864 +
1.865 + address=memoryAddress+pixelsY*iDisplayOffsetBetweenLines;
1.866 + for ( line=0; line<boxWidth; ++line )
1.867 + {
1.868 + address-=iDisplayOffsetBetweenLines;
1.869 + DrawLine(colorBackground, address, x, boxLength+x);
1.870 + }
1.871 + }
1.872 +
1.873 + // Draw box moving from bottom right bottom left to top right
1.874 + // Missing out first as it was draw at the end of the previous draw
1.875 + for ( y=pixelsY-boxWidth; y>0; y-=step )
1.876 + {
1.877 + address=memoryAddress+y*iDisplayOffsetBetweenLines;
1.878 + for ( line=0; line<boxWidth; ++line )
1.879 + {
1.880 + DrawLine(colorForeground, address, 0, boxLength);
1.881 + address+=iDisplayOffsetBetweenLines;
1.882 + }
1.883 + Timedelay(frameDelay);
1.884 +
1.885 + address=memoryAddress+y*iDisplayOffsetBetweenLines;
1.886 + for ( line=0; line<boxWidth; ++line )
1.887 + {
1.888 + DrawLine(colorBackground, address, 0, boxLength);
1.889 + address+=iDisplayOffsetBetweenLines;
1.890 + }
1.891 + }
1.892 + }
1.893 + }
1.894 +
1.895 +/**
1.896 +Utility function to Fill color in a 16pixels*16 lines area at the given xb,yb position in the screen
1.897 +@param ColorVal color to be filled in .For 4 bpp mode ColorVal contains only 4 bits of information, the upper 4 bits are empty
1.898 + For 8 bpp mode all the 8 bits are filled in , the value is taken from the standard OS palette
1.899 + For all other modes ColorVal holds data in rgb 332 format.
1.900 +
1.901 +@param aColor Color to draw in
1.902 +@param aMemoryAddress Address offset to start of line
1.903 +@param aLeftMargin Left margin to not draw in
1.904 +@param aPixelsX Number of pixels to draw on line
1.905 +*/
1.906 +void CT_ScreenDriverData::DrawLine(TUint aColor, TUint8* aMemoryAddress, TInt aLeftMargin, TInt aPixelsX)
1.907 + {
1.908 +
1.909 + switch ( iDisplayBitsPerPixel )
1.910 + {
1.911 + case BPP32:
1.912 + case BPP24:
1.913 + {
1.914 + TUint32* pixelPtr=(TUint32*)aMemoryAddress;
1.915 + TUint32 color=aColor;
1.916 + pixelPtr += aLeftMargin;
1.917 + for ( TInt x=aLeftMargin; x<aPixelsX; ++x )
1.918 + {
1.919 + *pixelPtr++=color;
1.920 + }
1.921 + }
1.922 + break;
1.923 +
1.924 + case BPP16:
1.925 + case BPP12:
1.926 + {
1.927 + TUint16* pixelPtr=(TUint16*)aMemoryAddress;
1.928 + TUint16 color=aColor;
1.929 + pixelPtr += aLeftMargin;
1.930 + for ( TInt x=aLeftMargin; x<aPixelsX; ++x )
1.931 + {
1.932 + *pixelPtr++=color;
1.933 + }
1.934 + }
1.935 + break;
1.936 + case BPP8:
1.937 + {
1.938 + TUint8* pixelPtr=aMemoryAddress;
1.939 + TUint8 color=aColor;
1.940 + pixelPtr += aLeftMargin;
1.941 + for ( TInt x=aLeftMargin; x<aPixelsX; ++x )
1.942 + {
1.943 + *pixelPtr++=color;
1.944 + }
1.945 + }
1.946 + break;
1.947 + default:
1.948 + break;
1.949 + }
1.950 + }
1.951 +
1.952 +/**
1.953 + * Fill the Screen color with multicoloured horizontal strips using screen base memory address
1.954 + *
1.955 + * @param aSection The section in the ini containing data for the command
1.956 + *
1.957 + * @return void
1.958 + *
1.959 + * @leave System wide error
1.960 + */
1.961 +void CT_ScreenDriverData::DoCmdUtilityFillHorizontalStripL(const TDesC& aSection)
1.962 + {
1.963 + TBuf<KMaxTestExecuteCommandLength> tempStore;
1.964 +
1.965 + RArray<TUint> color;
1.966 + CleanupClosePushL(color);
1.967 +
1.968 + RArray<TDesC> colorLog;
1.969 + CleanupClosePushL(colorLog);
1.970 +
1.971 + TBool moreData=ETrue;
1.972 + TBool index=0;
1.973 + while ( moreData )
1.974 + {
1.975 + tempStore.Format(KFldColorIndex(), ++index);
1.976 + TUint colorTemp;
1.977 + TPtrC colorLogTemp;
1.978 +
1.979 + moreData=GetColorFromConfig(aSection, tempStore, colorTemp, colorLogTemp);
1.980 + if ( moreData )
1.981 + {
1.982 + color.AppendL(colorTemp);
1.983 + colorLog.AppendL(colorLogTemp);
1.984 + }
1.985 + }
1.986 +
1.987 + // Must have more than one color for this to work
1.988 + TBool dataOk=color.Count()>1;
1.989 + if ( !dataOk )
1.990 + {
1.991 + ERR_PRINTF1(KLogNotEnoughData);
1.992 + SetBlockResult(EFail);
1.993 + }
1.994 +
1.995 + TInt margin=KDefaultMargin;
1.996 + GetIntFromConfig(aSection, KFldMargin(), margin);
1.997 + if ( margin<=0 )
1.998 + {
1.999 + ERR_PRINTF2(KLogInvalidMargin, margin);
1.1000 + SetBlockResult(EFail);
1.1001 + dataOk=EFalse;
1.1002 + }
1.1003 +
1.1004 + if ( dataOk )
1.1005 + {
1.1006 + TInt pixelsX=iDisplayXPixels;
1.1007 + TInt pixelsY=iDisplayYPixels;
1.1008 + TUint8* memoryAddress=iDisplayMemoryAddress;
1.1009 + memoryAddress+=iDisplayOffsetToFirstPixel;
1.1010 +
1.1011 + TInt count=0;
1.1012 + TInt colorIndex=0;
1.1013 + for ( TInt liney=0; liney<pixelsY; liney++ )
1.1014 + {
1.1015 + DrawLine(color[colorIndex], memoryAddress, 0, pixelsX);
1.1016 + memoryAddress+=iDisplayOffsetBetweenLines;
1.1017 +
1.1018 + ++count;
1.1019 + if( count>margin )
1.1020 + {
1.1021 + ++colorIndex;
1.1022 + count=0;
1.1023 + }
1.1024 +
1.1025 + if ( colorIndex>=color.Count() )
1.1026 + {
1.1027 + colorIndex=0;
1.1028 + }
1.1029 + }
1.1030 +
1.1031 + }
1.1032 + CleanupStack::PopAndDestroy(2, &color);
1.1033 +
1.1034 + TInt screenDelay;
1.1035 + TBool screenDelayOk = GetIntFromConfig(aSection, KScreenDelay(), screenDelay);
1.1036 + if(!screenDelayOk)
1.1037 + {
1.1038 + screenDelay = KDefaultScreenDelay;
1.1039 + INFO_PRINTF1(_L("defualt screen delay value used"));
1.1040 + }
1.1041 + CDataWrapperBase::Timedelay(MICROSECS_TO_SECS(screenDelay));
1.1042 +
1.1043 + }
1.1044 +
1.1045 +/**
1.1046 + * Fill the Screen color with multicoloured vertical strips using screen based memory address
1.1047 + *
1.1048 + * @param aSection The section in the ini containing data for the command
1.1049 + *
1.1050 + * @return void
1.1051 + *
1.1052 + * @leave System wide error
1.1053 + */
1.1054 +void CT_ScreenDriverData::DoCmdUtilityFillVerticalStripL(const TDesC& aSection)
1.1055 + {
1.1056 + TBuf<KMaxTestExecuteCommandLength> tempStore;
1.1057 +
1.1058 + RArray<TUint> color;
1.1059 + CleanupClosePushL(color);
1.1060 +
1.1061 + RArray<TDesC> colorLog;
1.1062 + CleanupClosePushL(colorLog);
1.1063 +
1.1064 + TBool moreData=ETrue;
1.1065 + TBool index=0;
1.1066 + while ( moreData )
1.1067 + {
1.1068 + tempStore.Format(KFldColorIndex(), ++index);
1.1069 + TUint colorTemp;
1.1070 + TPtrC colorLogTemp;
1.1071 +
1.1072 + moreData=GetColorFromConfig(aSection, tempStore, colorTemp, colorLogTemp);
1.1073 + if ( moreData )
1.1074 + {
1.1075 + color.AppendL(colorTemp);
1.1076 + colorLog.AppendL(colorLogTemp);
1.1077 + }
1.1078 + }
1.1079 +
1.1080 + // Must have more than one color for this to work
1.1081 + TBool dataOk=color.Count()>1;
1.1082 + if ( !dataOk )
1.1083 + {
1.1084 + ERR_PRINTF1(KLogNotEnoughData);
1.1085 + SetBlockResult(EFail);
1.1086 + }
1.1087 +
1.1088 + TInt margin=KDefaultMargin;
1.1089 + GetIntFromConfig(aSection, KFldMargin(), margin);
1.1090 + if ( margin<=0 )
1.1091 + {
1.1092 + ERR_PRINTF2(KLogInvalidMargin, margin);
1.1093 + SetBlockResult(EFail);
1.1094 + dataOk=EFalse;
1.1095 + }
1.1096 +
1.1097 + if ( dataOk )
1.1098 + {
1.1099 + TInt pixelsX=iDisplayXPixels;
1.1100 + TInt pixelsY=iDisplayYPixels;
1.1101 + TUint8* memoryAddress=iDisplayMemoryAddress;
1.1102 + memoryAddress+=iDisplayOffsetToFirstPixel;
1.1103 +
1.1104 + TInt colorIndex=0;
1.1105 + TUint8* address;
1.1106 + TInt right=0;
1.1107 + for ( TInt left=0; left<pixelsX; left+=margin )
1.1108 + {
1.1109 + address = memoryAddress;
1.1110 + right += margin;
1.1111 + if ( right>=pixelsX )
1.1112 + {
1.1113 + right=pixelsX-1;
1.1114 + }
1.1115 + for ( TInt liney=0; liney<pixelsY; liney++ )
1.1116 + {
1.1117 + DrawLine(color[colorIndex], address, left, right);
1.1118 + address+=iDisplayOffsetBetweenLines;
1.1119 + }
1.1120 + ++colorIndex;
1.1121 + if ( colorIndex>=color.Count() )
1.1122 + {
1.1123 + colorIndex=0;
1.1124 + }
1.1125 + }
1.1126 +
1.1127 + }
1.1128 + CleanupStack::PopAndDestroy(2, &color);
1.1129 +
1.1130 + TInt screenDelay;
1.1131 + TBool screenDelayOk = GetIntFromConfig(aSection, KScreenDelay(), screenDelay);
1.1132 + if(!screenDelayOk)
1.1133 + {
1.1134 + screenDelay = KDefaultScreenDelay;
1.1135 + INFO_PRINTF1(_L("defualt screen delay value used"));
1.1136 + }
1.1137 + CDataWrapperBase::Timedelay(MICROSECS_TO_SECS(screenDelay));
1.1138 +
1.1139 + }
1.1140 +
1.1141 +