Update contrib.
2 * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
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".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
18 #include "T_ScreenDriverData.h"
20 #define MICROSECS_TO_SECS(x) (x*1000000)
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;
37 //These are for masks and shifts for rgb 332 data format
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");
64 _LIT(KFormatEntryField, "%S_%S");
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");
80 _LIT(KTagRgbRed, "red");
81 _LIT(KTagRgbGreen, "green");
82 _LIT(KTagRgbBlue, "blue");
83 _LIT(KTagRgbAlpha, "alpha");
85 _LIT(KCmdUtilityFillColor, "utilityFillColor");
86 _LIT(KCmdUtilityFillMultiColor, "utilityFillMultiColor");
87 _LIT(KCmdUtilityMovingRectangle, "utilityMovingRectangle");
88 _LIT(KCmdUtilityFillHorizontalStrip, "utilityFillHorizontalStrip");
89 _LIT(KCmdUtilityFillVerticalStrip, "utilityFillVerticalStrip");
90 _LIT(KCmdUtilityPromptMessage, "utilityPromptMessage");
92 _LIT(KScreenDelay, "screenDelay");
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");
102 const CT_HALData::THalTableLookup CT_ScreenDriverData::iTableLookup[] =
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
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
134 //////////////////////////////////////////////////////////////////////
135 // Construction/Destruction
136 //////////////////////////////////////////////////////////////////////
138 CT_ScreenDriverData* CT_ScreenDriverData::NewL()
140 CT_ScreenDriverData* ret=new (ELeave) CT_ScreenDriverData();
141 CleanupStack::PushL(ret);
143 CleanupStack::Pop(ret);
148 CT_ScreenDriverData::CT_ScreenDriverData()
149 : CT_HALData(iTableLookup)
151 , iBacklightState(-1)
153 , iDisplayMaxBrightness(-1)
154 , iDisplayBrightness(-1)
155 , iDisplayMaxContrast(-1)
156 , iDisplayContrast(-1)
157 , iDisplayMemoryAddress((TUint8*)(-1))
158 , iDisplayIsPixelOrderRGB(-1)
159 , iDisplayIsPixelOrderLandscape(-1)
161 , iDisplayNumModes(-1)
163 , iDisplayPaletteEntry(-1)
164 , iDisplayXPixels(-1)
165 , iDisplayYPixels(-1)
168 , iDisplayBitsPerPixel(-1)
169 , iDisplayOffsetToFirstPixel(-1)
170 , iDisplayOffsetBetweenLines(-1)
171 , iDisplayIsPalettized(EFalse)
172 , iDisplayNumberOfScreens(-1)
176 void CT_ScreenDriverData::ConstructL()
178 * Second phase construction
187 * @leave system wide error
192 CT_ScreenDriverData::~CT_ScreenDriverData()
200 TAny* CT_ScreenDriverData::GetObject()
202 * Return a pointer to the object that the data wraps
204 * @return pointer to the object that the data wraps
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)
213 CT_ScreenDriverData* thisPtr=static_cast<CT_ScreenDriverData*>(aThis);
214 TBool ret=thisPtr->GetIntFromConfig(aSection, KFldStartIndex(), aValueStart);
217 thisPtr->ERR_PRINTF2(KLogMissingParameter, &KFldStartIndex());
218 thisPtr->SetBlockResult(EFail);
221 aValueEnd=aValueStart;
222 thisPtr->GetIntFromConfig(aSection, KFldEndIndex(), aValueEnd);
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)
230 aValueStart=aValueEnd=static_cast<CT_ScreenDriverData*>(aThis)->iDisplayMode;
235 // Store the display state
236 void CT_ScreenDriverData::SetDisplayState(CDataWrapperBase* aThis, TInt aValue)
238 static_cast<CT_ScreenDriverData*>(aThis)->iDisplayState=aValue;
241 // Store the backlight state
242 void CT_ScreenDriverData::SetBacklightState(CDataWrapperBase* aThis, TInt aValue)
244 static_cast<CT_ScreenDriverData*>(aThis)->iBacklightState=aValue;
247 // Store the backlight
248 void CT_ScreenDriverData::SetBacklight(CDataWrapperBase* aThis, TInt aValue)
250 static_cast<CT_ScreenDriverData*>(aThis)->iBacklight=aValue;
253 // Store the displays maximum brightness
254 void CT_ScreenDriverData::SetDisplayMaxBrightness(CDataWrapperBase* aThis, TInt aValue)
256 static_cast<CT_ScreenDriverData*>(aThis)->iDisplayMaxBrightness=aValue;
259 // Store the displays brightness
260 void CT_ScreenDriverData::SetDisplayBrightness(CDataWrapperBase* aThis, TInt aValue)
262 static_cast<CT_ScreenDriverData*>(aThis)->iDisplayBrightness=aValue;
265 // Store the displays maximum contrast
266 void CT_ScreenDriverData::SetDisplayMaxContrast(CDataWrapperBase* aThis, TInt aValue)
268 static_cast<CT_ScreenDriverData*>(aThis)->iDisplayMaxContrast=aValue;
271 // Store the displays contrast
272 void CT_ScreenDriverData::SetDisplayContrast(CDataWrapperBase* aThis, TInt aValue)
274 static_cast<CT_ScreenDriverData*>(aThis)->iDisplayContrast=aValue;
277 // Store the displays memory address
278 void CT_ScreenDriverData::SetDisplayMemoryAddress(CDataWrapperBase* aThis, TInt aValue)
280 static_cast<CT_ScreenDriverData*>(aThis)->iDisplayMemoryAddress=(TUint8*)(aValue);
283 // Store the displays pixel RGB order flag
284 void CT_ScreenDriverData::SetDisplayIsPixelOrderRGB(CDataWrapperBase* aThis, TInt aValue)
286 static_cast<CT_ScreenDriverData*>(aThis)->iDisplayIsPixelOrderRGB=aValue;
289 // Store the displays landscape pixel order flag
290 void CT_ScreenDriverData::SetDisplayIsPixelOrderLandscape(CDataWrapperBase* aThis, TInt aValue)
292 static_cast<CT_ScreenDriverData*>(aThis)->iDisplayIsPixelOrderLandscape=aValue;
295 // Store the displays mode
296 void CT_ScreenDriverData::SetDisplayMode(CDataWrapperBase* aThis, TInt aValue)
298 static_cast<CT_ScreenDriverData*>(aThis)->iDisplayMode=aValue;
301 // Store the displays supported number of modes
302 void CT_ScreenDriverData::SetDisplayNumModes(CDataWrapperBase* aThis, TInt aValue)
304 static_cast<CT_ScreenDriverData*>(aThis)->iDisplayNumModes=aValue;
307 // Store the displays supported number of colors
308 void CT_ScreenDriverData::SetDisplayColors(CDataWrapperBase* aThis, TInt aValue)
310 CT_ScreenDriverData* thisPtr=static_cast<CT_ScreenDriverData*>(aThis);
311 thisPtr->iDisplayColors=aValue;
312 thisPtr->iPalette.Reset();
313 thisPtr->iPalette.Reserve(aValue);
316 // Store the an entry in the displays color palette
317 void CT_ScreenDriverData::SetDisplayPaletteEntry(CDataWrapperBase* aThis, TInt aValue)
319 CT_ScreenDriverData* thisPtr=static_cast<CT_ScreenDriverData*>(aThis);
320 thisPtr->iDisplayPaletteEntry=aValue;
321 if ( thisPtr->iPalette.Count()<thisPtr->iValue )
323 thisPtr->iPalette[thisPtr->iValue]=aValue;
327 // Store the displays width in pixels
328 void CT_ScreenDriverData::SetDisplayXPixels(CDataWrapperBase* aThis, TInt aValue)
330 static_cast<CT_ScreenDriverData*>(aThis)->iDisplayXPixels=aValue;
333 // Store the displays height in pixels
334 void CT_ScreenDriverData::SetDisplayYPixels(CDataWrapperBase* aThis, TInt aValue)
336 static_cast<CT_ScreenDriverData*>(aThis)->iDisplayYPixels=aValue;
339 // Store the displays width in twips
340 void CT_ScreenDriverData::SetDisplayXTwips(CDataWrapperBase* aThis, TInt aValue)
342 static_cast<CT_ScreenDriverData*>(aThis)->iDisplayXTwips=aValue;
345 // Store the displays height in twips
346 void CT_ScreenDriverData::SetDisplayYTwips(CDataWrapperBase* aThis, TInt aValue)
348 static_cast<CT_ScreenDriverData*>(aThis)->iDisplayYTwips=aValue;
351 // Store the displays number of bits per pixel
352 void CT_ScreenDriverData::SetDisplayBitsPerPixel(CDataWrapperBase* aThis, TInt aValue)
354 static_cast<CT_ScreenDriverData*>(aThis)->iDisplayBitsPerPixel=aValue;
357 // Store the displays memory address offset to the first pixel
358 void CT_ScreenDriverData::SetDisplayOffsetToFirstPixel(CDataWrapperBase* aThis, TInt aValue)
360 static_cast<CT_ScreenDriverData*>(aThis)->iDisplayOffsetToFirstPixel=aValue;
363 // Store the displays memory address offset between successive lines
364 void CT_ScreenDriverData::SetDisplayOffsetBetweenLines(CDataWrapperBase* aThis, TInt aValue)
366 static_cast<CT_ScreenDriverData*>(aThis)->iDisplayOffsetBetweenLines=aValue;
369 // Store the displays flag indicating if a palette is used
370 void CT_ScreenDriverData::SetDisplayIsPalettized(CDataWrapperBase* aThis, TInt aValue)
372 static_cast<CT_ScreenDriverData*>(aThis)->iDisplayIsPalettized=(aValue!=0);
375 // Store the devices number of screens supported
376 void CT_ScreenDriverData::SetDisplayNumberOfScreens(CDataWrapperBase* aThis, TInt aValue)
378 static_cast<CT_ScreenDriverData*>(aThis)->iDisplayNumberOfScreens=aValue;
380 TBool CT_ScreenDriverData::GetRgbFromConfig(const TDesC& aSectName, const TDesC& aKeyName, TUint& aRed, TUint& aGreen, TUint& aBlue, TUint& aAlpha)
382 TBuf<KMaxTestExecuteCommandLength> tempStore;
384 tempStore.Format(KFormatEntryField, &aKeyName, &KTagRgbRed);
385 TBool ret=GetUintFromConfig(aSectName, tempStore, aRed);
387 tempStore.Format(KFormatEntryField, &aKeyName, &KTagRgbGreen);
388 if ( !GetUintFromConfig(aSectName, tempStore, aGreen) )
393 tempStore.Format(KFormatEntryField, &aKeyName, &KTagRgbBlue);
394 if ( !GetUintFromConfig(aSectName, tempStore, aBlue) )
400 tempStore.Format(KFormatEntryField, &aKeyName, &KTagRgbAlpha);
401 GetUintFromConfig(aSectName, tempStore, aAlpha);
406 TBool CT_ScreenDriverData::GetRgbFromConfig(const TDesC& aSectName, const TDesC& aKeyName, TInt& aRed, TInt& aGreen, TInt& aBlue, TInt& aAlpha)
408 TBuf<KMaxTestExecuteCommandLength> tempStore;
410 tempStore.Format(KFormatEntryField, &aKeyName, &KTagRgbRed);
411 TBool ret=GetIntFromConfig(aSectName, tempStore, aRed);
413 tempStore.Format(KFormatEntryField, &aKeyName, &KTagRgbGreen);
414 if ( !GetIntFromConfig(aSectName, tempStore, aGreen) )
419 tempStore.Format(KFormatEntryField, &aKeyName, &KTagRgbBlue);
420 if ( !GetIntFromConfig(aSectName, tempStore, aBlue) )
426 tempStore.Format(KFormatEntryField, &aKeyName, &KTagRgbAlpha);
427 GetIntFromConfig(aSectName, tempStore, aAlpha);
432 TBool CT_ScreenDriverData::GetColorFromConfig(const TDesC& aSectName, const TDesC& aKeyName, TUint& aColor, TPtrC& aLogColor)
436 if ( iDisplayIsPalettized )
438 WARN_PRINTF1(_L("Testing of Palettes not supported\n"));
446 if ( !GetRgbFromConfig(aSectName, aKeyName, colorRed, colorGreen, colorBlue, colorAlpha) )
448 WARN_PRINTF2(KLogMissingParameter, &aKeyName);
452 if ( !GetStringFromConfig(aSectName, aKeyName, aLogColor) )
454 WARN_PRINTF2(KLogMissingParameter, &aKeyName);
462 if ( !GetRgbFromConfig(aSectName, KFldMask(), maskRed, maskGreen, maskBlue, maskAlpha) )
464 WARN_PRINTF2(KLogMissingParameter, &KFldMask());
472 if ( !GetRgbFromConfig(aSectName, KFldShift(), shiftRed, shiftGreen, shiftBlue, shiftAlpha) )
474 WARN_PRINTF2(KLogMissingParameter, &KFldShift());
484 aColor |= (colorRed >> -shiftRed);
488 aColor |= (colorRed << shiftRed);
492 colorGreen &= maskGreen;
495 aColor |= (colorGreen >> -shiftGreen);
499 aColor |= (colorGreen << shiftGreen);
503 colorBlue &= maskBlue;
506 aColor |= (colorBlue >> -shiftBlue);
510 aColor |= (colorBlue << shiftBlue);
514 colorAlpha &= maskAlpha;
517 aColor |= (colorAlpha >> -shiftAlpha);
521 aColor |= (colorAlpha << shiftAlpha);
527 TBool CT_ScreenDriverData::DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex)
529 * Process a command read from the ini file
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
535 * @return ETrue if the command is processed
537 * @leave System wide error
542 if ( aCommand==KCmdUtilityFillColor )
544 DoCmdUtilityFillColorL(aSection);
546 else if ( aCommand==KCmdUtilityFillMultiColor )
548 DoCmdUtilityFillMultiColorL(aSection);
550 else if ( aCommand==KCmdUtilityMovingRectangle )
552 DoCmdUtilityMovingRectangleL(aSection);
554 else if ( aCommand==KCmdUtilityFillHorizontalStrip )
556 DoCmdUtilityFillHorizontalStripL(aSection);
558 else if ( aCommand==KCmdUtilityFillVerticalStrip)
560 DoCmdUtilityFillVerticalStripL(aSection);
562 else if ( aCommand==KCmdUtilityPromptMessage)
564 ret=CDataWrapperBase::DoCommandL(aCommand, aSection, aAsyncErrorIndex);
568 ret=CT_HALData::DoCommandL(aCommand, aSection, aAsyncErrorIndex);
575 * Fill the Screen in a single color by using screen base memory address
577 * @param aSection The section in the ini containing data for the command
581 * @leave System wide error
583 void CT_ScreenDriverData::DoCmdUtilityFillColorL(const TDesC& aSection)
588 TBool dataOk=GetColorFromConfig(aSection, KFldColor, color, logColor);
591 ERR_PRINTF2(KLogMissingParameter, &KFldColor());
592 SetBlockResult(EFail);
596 TInt pixelsX=iDisplayXPixels;
597 TInt pixelsY=iDisplayYPixels;
598 TUint8* memoryAddress=iDisplayMemoryAddress;
599 memoryAddress+=iDisplayOffsetToFirstPixel;
602 for ( line=0; line<pixelsY; ++line )
604 DrawLine(color, memoryAddress, 0, pixelsX);
605 memoryAddress+=iDisplayOffsetBetweenLines;
610 //delays the image on the screen to allow for the user to verify
612 TBool screenDelayOk = GetIntFromConfig(aSection, KScreenDelay(), screenDelay);
616 INFO_PRINTF1(_L("defualt screen delay value used"));
617 screenDelay = KDefaultScreenDelay;
619 CDataWrapperBase::Timedelay(MICROSECS_TO_SECS(screenDelay));
623 * Fill the Screen color with multiple nested rectangles by using screen base memory address
625 * @param aSection The section in the ini containing data for the command
629 * @leave System wide error
631 void CT_ScreenDriverData::DoCmdUtilityFillMultiColorL(const TDesC& aSection)
633 TBuf<KMaxTestExecuteCommandLength> tempStore;
636 CleanupClosePushL(color);
638 RArray<TDesC> colorLog;
639 CleanupClosePushL(colorLog);
641 TBool moreData=ETrue;
645 tempStore.Format(KFldColorIndex(), ++index);
649 moreData=GetColorFromConfig(aSection, tempStore, colorTemp, colorLogTemp);
652 color.AppendL(colorTemp);
653 colorLog.AppendL(colorLogTemp);
657 // Must have more than one color for this to work
658 TBool dataOk=color.Count()>1;
661 ERR_PRINTF1(KLogNotEnoughData);
662 SetBlockResult(EFail);
665 TInt margin=KDefaultMargin;
666 GetIntFromConfig(aSection, KFldMargin(), margin);
669 ERR_PRINTF2(KLogInvalidMargin, margin);
670 SetBlockResult(EFail);
676 TInt pixelsX=iDisplayXPixels;
677 TInt pixelsY=iDisplayYPixels;
678 TUint8* memoryAddress=iDisplayMemoryAddress;
679 memoryAddress+=iDisplayOffsetToFirstPixel;
687 while ( (left<pixels) && (top<bottom) )
689 TUint8* address=memoryAddress + top*iDisplayOffsetBetweenLines;
690 for ( line=top; line<bottom; ++line )
692 DrawLine(color[colorIndex], address, left, pixels);
693 address+=iDisplayOffsetBetweenLines;
700 if ( colorIndex>=color.Count() )
707 CleanupStack::PopAndDestroy(2, &color);
710 TBool screenDelayOk = GetIntFromConfig(aSection, KScreenDelay(), screenDelay);
713 screenDelay = KDefaultScreenDelay;
714 INFO_PRINTF1(_L("defualt screen delay value used"));
717 CDataWrapperBase::Timedelay(MICROSECS_TO_SECS(screenDelay));
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
724 * @param aSection The section in the ini containing data for the command
728 * @leave System wide error
730 void CT_ScreenDriverData::DoCmdUtilityMovingRectangleL(const TDesC& aSection)
734 TUint colorBackground;
735 TPtrC logColorBackground;
736 if ( !GetColorFromConfig(aSection, KFldColorBackground, colorBackground, logColorBackground) )
738 ERR_PRINTF2(KLogMissingParameter, &KFldColorBackground());
739 SetBlockResult(EFail);
743 TUint colorForeground;
744 TPtrC logColorForeground;
745 if ( !GetColorFromConfig(aSection, KFldColorForeground, colorForeground, logColorForeground) )
747 ERR_PRINTF2(KLogMissingParameter, &KFldColorForeground());
748 SetBlockResult(EFail);
752 TInt boxLength=KDefaultBoxLength;
753 GetIntFromConfig(aSection, KFldLength(), boxLength);
756 ERR_PRINTF2(KLogInvalidLength, boxLength);
757 SetBlockResult(EFail);
761 TInt boxWidth=KDefaultBoxWidth;
762 GetIntFromConfig(aSection, KFldWidth(), boxWidth);
765 ERR_PRINTF2(KLogInvalidWidth, boxWidth);
766 SetBlockResult(EFail);
770 TInt step=KDefaultBoxStep;
771 GetIntFromConfig(aSection, KFldStep(), step);
774 ERR_PRINTF2(KLogInvalidStep, step);
775 SetBlockResult(EFail);
779 TInt frameDelay=KDefaultFrameDelay;
780 GetIntFromConfig(aSection, KFldFrameDelay(), frameDelay);
783 ERR_PRINTF2(KLogInvalidStep, frameDelay);
784 SetBlockResult(EFail);
790 TInt pixelsX=iDisplayXPixels;
791 TInt pixelsY=iDisplayYPixels;
792 TUint8* memoryAddress=iDisplayMemoryAddress;
793 memoryAddress+=iDisplayOffsetToFirstPixel;
795 // Fill the background
796 INFO_PRINTF1(_L("-->Fill the background"));
797 TUint8* address=memoryAddress;
801 for ( line=0; line<pixelsY; ++line )
803 DrawLine(colorBackground, address, 0, pixelsX);
804 address+=iDisplayOffsetBetweenLines;
806 INFO_PRINTF1(_L("<--Fill the background"));
808 // Draw box moving from top left to top right
809 TInt max=pixelsX-boxLength;
810 for ( x=0; x<max; x+=step )
812 address=memoryAddress;
813 for ( line=0; line<boxWidth; ++line )
815 DrawLine(colorForeground, address, x, boxLength+x);
816 address+=iDisplayOffsetBetweenLines;
818 Timedelay(frameDelay);
820 address=memoryAddress;
821 for ( line=0; line<boxWidth; ++line )
823 DrawLine(colorBackground, address, x, boxLength+x);
824 address+=iDisplayOffsetBetweenLines;
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;
832 for ( y=step; y<max; y+=step )
834 address=memoryAddress+y*iDisplayOffsetBetweenLines;
835 for ( line=0; line<boxWidth; ++line )
837 DrawLine(colorForeground, address, x, pixelsX);
838 address+=iDisplayOffsetBetweenLines;
840 Timedelay(frameDelay);
842 address=memoryAddress+y*iDisplayOffsetBetweenLines;
843 for ( line=0; line<boxWidth; ++line )
845 DrawLine(colorBackground, address, x, pixelsX);
846 address+=iDisplayOffsetBetweenLines;
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 )
854 address=memoryAddress+pixelsY*iDisplayOffsetBetweenLines;
855 for ( line=0; line<boxWidth; ++line )
857 address-=iDisplayOffsetBetweenLines;
858 DrawLine(colorForeground, address, x, boxLength+x);
860 Timedelay(frameDelay);
862 address=memoryAddress+pixelsY*iDisplayOffsetBetweenLines;
863 for ( line=0; line<boxWidth; ++line )
865 address-=iDisplayOffsetBetweenLines;
866 DrawLine(colorBackground, address, x, boxLength+x);
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 )
874 address=memoryAddress+y*iDisplayOffsetBetweenLines;
875 for ( line=0; line<boxWidth; ++line )
877 DrawLine(colorForeground, address, 0, boxLength);
878 address+=iDisplayOffsetBetweenLines;
880 Timedelay(frameDelay);
882 address=memoryAddress+y*iDisplayOffsetBetweenLines;
883 for ( line=0; line<boxWidth; ++line )
885 DrawLine(colorBackground, address, 0, boxLength);
886 address+=iDisplayOffsetBetweenLines;
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.
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
903 void CT_ScreenDriverData::DrawLine(TUint aColor, TUint8* aMemoryAddress, TInt aLeftMargin, TInt aPixelsX)
906 switch ( iDisplayBitsPerPixel )
911 TUint32* pixelPtr=(TUint32*)aMemoryAddress;
912 TUint32 color=aColor;
913 pixelPtr += aLeftMargin;
914 for ( TInt x=aLeftMargin; x<aPixelsX; ++x )
924 TUint16* pixelPtr=(TUint16*)aMemoryAddress;
925 TUint16 color=aColor;
926 pixelPtr += aLeftMargin;
927 for ( TInt x=aLeftMargin; x<aPixelsX; ++x )
935 TUint8* pixelPtr=aMemoryAddress;
937 pixelPtr += aLeftMargin;
938 for ( TInt x=aLeftMargin; x<aPixelsX; ++x )
950 * Fill the Screen color with multicoloured horizontal strips using screen base memory address
952 * @param aSection The section in the ini containing data for the command
956 * @leave System wide error
958 void CT_ScreenDriverData::DoCmdUtilityFillHorizontalStripL(const TDesC& aSection)
960 TBuf<KMaxTestExecuteCommandLength> tempStore;
963 CleanupClosePushL(color);
965 RArray<TDesC> colorLog;
966 CleanupClosePushL(colorLog);
968 TBool moreData=ETrue;
972 tempStore.Format(KFldColorIndex(), ++index);
976 moreData=GetColorFromConfig(aSection, tempStore, colorTemp, colorLogTemp);
979 color.AppendL(colorTemp);
980 colorLog.AppendL(colorLogTemp);
984 // Must have more than one color for this to work
985 TBool dataOk=color.Count()>1;
988 ERR_PRINTF1(KLogNotEnoughData);
989 SetBlockResult(EFail);
992 TInt margin=KDefaultMargin;
993 GetIntFromConfig(aSection, KFldMargin(), margin);
996 ERR_PRINTF2(KLogInvalidMargin, margin);
997 SetBlockResult(EFail);
1003 TInt pixelsX=iDisplayXPixels;
1004 TInt pixelsY=iDisplayYPixels;
1005 TUint8* memoryAddress=iDisplayMemoryAddress;
1006 memoryAddress+=iDisplayOffsetToFirstPixel;
1010 for ( TInt liney=0; liney<pixelsY; liney++ )
1012 DrawLine(color[colorIndex], memoryAddress, 0, pixelsX);
1013 memoryAddress+=iDisplayOffsetBetweenLines;
1022 if ( colorIndex>=color.Count() )
1029 CleanupStack::PopAndDestroy(2, &color);
1032 TBool screenDelayOk = GetIntFromConfig(aSection, KScreenDelay(), screenDelay);
1035 screenDelay = KDefaultScreenDelay;
1036 INFO_PRINTF1(_L("defualt screen delay value used"));
1038 CDataWrapperBase::Timedelay(MICROSECS_TO_SECS(screenDelay));
1043 * Fill the Screen color with multicoloured vertical strips using screen based memory address
1045 * @param aSection The section in the ini containing data for the command
1049 * @leave System wide error
1051 void CT_ScreenDriverData::DoCmdUtilityFillVerticalStripL(const TDesC& aSection)
1053 TBuf<KMaxTestExecuteCommandLength> tempStore;
1055 RArray<TUint> color;
1056 CleanupClosePushL(color);
1058 RArray<TDesC> colorLog;
1059 CleanupClosePushL(colorLog);
1061 TBool moreData=ETrue;
1065 tempStore.Format(KFldColorIndex(), ++index);
1069 moreData=GetColorFromConfig(aSection, tempStore, colorTemp, colorLogTemp);
1072 color.AppendL(colorTemp);
1073 colorLog.AppendL(colorLogTemp);
1077 // Must have more than one color for this to work
1078 TBool dataOk=color.Count()>1;
1081 ERR_PRINTF1(KLogNotEnoughData);
1082 SetBlockResult(EFail);
1085 TInt margin=KDefaultMargin;
1086 GetIntFromConfig(aSection, KFldMargin(), margin);
1089 ERR_PRINTF2(KLogInvalidMargin, margin);
1090 SetBlockResult(EFail);
1096 TInt pixelsX=iDisplayXPixels;
1097 TInt pixelsY=iDisplayYPixels;
1098 TUint8* memoryAddress=iDisplayMemoryAddress;
1099 memoryAddress+=iDisplayOffsetToFirstPixel;
1104 for ( TInt left=0; left<pixelsX; left+=margin )
1106 address = memoryAddress;
1108 if ( right>=pixelsX )
1112 for ( TInt liney=0; liney<pixelsY; liney++ )
1114 DrawLine(color[colorIndex], address, left, right);
1115 address+=iDisplayOffsetBetweenLines;
1118 if ( colorIndex>=color.Count() )
1125 CleanupStack::PopAndDestroy(2, &color);
1128 TBool screenDelayOk = GetIntFromConfig(aSection, KScreenDelay(), screenDelay);
1131 screenDelay = KDefaultScreenDelay;
1132 INFO_PRINTF1(_L("defualt screen delay value used"));
1134 CDataWrapperBase::Timedelay(MICROSECS_TO_SECS(screenDelay));