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_ActiveRConsoleRead.h"
20 const TInt KDefaultTimeout =10000000;
21 const TUint8 KWhite =0xFF;
22 const TUint8 KBlack =0x00;
25 _LIT(KFldTimeout, "timeout");
26 _LIT(KFldErrorMargin, "errorMargin");
27 _LIT(KFldTests, "tests");
30 _LIT(KFldEventType, "eventType%d");
31 _LIT(KFldEventOccurance, "eventOccurance%d");
32 _LIT(KFldDataVerify, "dataVerify%d");
33 _LIT(KFldDataDraw, "dataDraw%d");
34 _LIT(KFldExitKeyCode, "exitKeyCode");
35 _LIT(KFldExitRectangle, "exitRectangle");
38 _LIT(KFldKeyCode, "keyCode%d");
39 _LIT(KFldPoint, "point%d");
40 _LIT(KFldRect, "rect%d");
41 _LIT(KFldColourWhite, "white");
42 _LIT(KFldColourBlack, "black");
46 _LIT(KLogUnexpectedEvent, "Unexpected event. Expected %d Actual %d Index %d");
47 _LIT(KLogUnexpectedKeyCode, "Unexpected key code %d");
48 _LIT(KLogUnexpectedPoint, "Unexpected point (%d,%d)");
49 _LIT(KLogEvent, "Event %d");
50 _LIT(KLogKey, "Key %d");
53 //This represents a NULL attribute
58 _LIT(KPointerMove, "EPointerMove");
59 _LIT(KPointerSwitchOn, "EPointerSwitchOn");
60 _LIT(KKeyDown, "EKeyDown");
61 _LIT(KKeyUp, "EKeyUp");
62 _LIT(KRedraw, "ERedraw");
63 _LIT(KSwitchOn, "ESwitchOn");
64 _LIT(KActive, "EActive");
65 _LIT(KInactive, "EInactive");
66 _LIT(KUpdateModifiers, "EUpdateModifiers");
67 _LIT(KButton1Down, "EButton1Down");
68 _LIT(KButton1Up, "EButton1Up");
69 _LIT(KButton2Down, "EButton2Down");
70 _LIT(KButton2Up, "EButton2Up");
71 _LIT(KButton3Down, "EButton3Down");
72 _LIT(KButton3Up, "EButton3Up");
73 _LIT(KSwitchOff, "ESwitchOff");
74 _LIT(KKeyRepeat, "EKeyRepeat");
75 _LIT(KCaseOpen, "ECaseOpen");
76 _LIT(KCaseClose, "ECaseClose");
77 _LIT(KRestartSystem, "ERestartSystem");
78 const CDataWrapperBase::TEnumEntryTable CT_ActiveRConsoleRead::iEnumRawEventTable [] =
80 /** Enum as a descriptor Enum integar value
81 * In this case these enums represent TRawEvents
85 // Enum as a descriptor Enum
86 KNone, TRawEvent::ENone,
87 KPointerMove, TRawEvent::EPointerMove,
88 KPointerSwitchOn, TRawEvent::EPointerSwitchOn,
89 KKeyDown, TRawEvent::EKeyDown,
90 KKeyUp, TRawEvent::EKeyUp,
91 KRedraw, TRawEvent::ERedraw,
92 KSwitchOn, TRawEvent::ESwitchOn,
93 KActive, TRawEvent::EActive,
94 KInactive, TRawEvent::EInactive,
95 KUpdateModifiers, TRawEvent::EUpdateModifiers,
96 KButton1Down, TRawEvent::EButton1Down,
97 KButton1Up, TRawEvent::EButton1Up,
98 KButton2Down, TRawEvent::EButton2Down,
99 KButton2Up, TRawEvent::EButton2Up,
100 KButton3Down, TRawEvent::EButton3Down,
101 KButton3Up, TRawEvent::EButton3Up,
102 KSwitchOff, TRawEvent::ESwitchOff,
103 KKeyRepeat, TRawEvent::EKeyRepeat,
104 KCaseOpen, TRawEvent::ECaseOpen,
105 KCaseClose, TRawEvent::ECaseClose,
106 KRestartSystem, TRawEvent::ERestartSystem,
111 _LIT(KKeyNull, "EKeyNull");
112 _LIT(KKeyBell, "EKeyBell");
113 _LIT(KKeyBackspace, "EKeyBackspace");
114 _LIT(KKeyTab, "EKeyTab");
115 _LIT(KKeyLineFeed, "EKeyLineFeed");
116 _LIT(KKeyVerticalTab, "EKeyVerticalTab");
117 _LIT(KKeyFormFeed, "EKeyFormFeed");
118 _LIT(KKeyEnter, "EKeyEnter");
119 _LIT(KKeyEscape, "EKeyEscape");
120 _LIT(KKeySpace, "EKeySpace");
121 _LIT(KKeyDelete, "EKeyDelete");
122 _LIT(KKeyPrintScreen, "EKeyPrintScreen");
123 _LIT(KKeyPause, "EKeyPause");
124 _LIT(KKeyHome, "EKeyHome");
125 _LIT(KKeyEnd, "EKeyEnd");
126 _LIT(KKeyPageUp, "EKeyPageUp");
127 _LIT(KKeyPageDown, "EKeyPageDown");
128 _LIT(KKeyInsert, "EKeyInsert");
129 _LIT(KKeyLeftArrow, "EKeyLeftArrow");
130 _LIT(KKeyRightArrow, "EKeyRightArrow");
131 _LIT(KKeyUpArrow, "EKeyUpArrow");
132 _LIT(KKeyDownArrow, "EKeyDownArrow");
133 _LIT(KKeyLeftShift, "EKeyLeftShift");
134 _LIT(KKeyRightShift, "EKeyRightShift");
135 _LIT(KKeyLeftAlt, "EKeyLeftAlt");
136 _LIT(KKeyRightAlt, "EKeyRightAlt");
137 _LIT(KKeyLeftCtrl, "EKeyLeftCtrl");
138 _LIT(KKeyRightCtrl, "EKeyRightCtrl");
139 _LIT(KKeyLeftFunc, "EKeyLeftFunc");
140 _LIT(KKeyRightFunc, "EKeyRightFunc");
141 _LIT(KKeyCapsLock, "EKeyCapsLock");
142 _LIT(KKeyNumLock, "EKeyNumLock");
143 _LIT(KKeyScrollLock, "EKeyScrollLock");
144 _LIT(KKeyF1, "EKeyF1");
145 _LIT(KKeyF2, "EKeyF2");
146 _LIT(KKeyF3, "EKeyF3");
147 _LIT(KKeyF4, "EKeyF4");
148 _LIT(KKeyF5, "EKeyF5");
149 _LIT(KKeyF6, "EKeyF6");
150 _LIT(KKeyF7, "EKeyF7");
151 _LIT(KKeyF8, "EKeyF8");
152 _LIT(KKeyF9, "EKeyF9");
153 _LIT(KKeyF10, "EKeyF10");
154 _LIT(KKeyF11, "EKeyF11");
155 _LIT(KKeyF12, "EKeyF12");
156 _LIT(KKeyF13, "EKeyF13");
157 _LIT(KKeyF14, "EKeyF14");
158 _LIT(KKeyF15, "EKeyF15");
159 _LIT(KKeyF16, "EKeyF16");
160 _LIT(KKeyF17, "EKeyF17");
161 _LIT(KKeyF18, "EKeyF18");
162 _LIT(KKeyF19, "EKeyF19");
163 _LIT(KKeyF20, "EKeyF20");
164 _LIT(KKeyF21, "EKeyF21");
165 _LIT(KKeyF22, "EKeyF22");
166 _LIT(KKeyF23, "EKeyF23");
167 _LIT(KKeyF24, "EKeyF24");
168 _LIT(KKeyOff, "EKeyOff");
169 _LIT(KKeyIncContrast, "EKeyIncContrast");
170 _LIT(KKeyDecContrast, "EKeyDecContrast");
171 _LIT(KKeyBacklightOn, "EKeyBacklightOn");
172 _LIT(KKeyBacklightOff, "EKeyBacklightOff");
173 _LIT(KKeyBacklightToggle, "EKeyBacklightToggle");
174 _LIT(KKeySliderDown, "EKeySliderDown");
175 _LIT(KKeySliderUp, "EKeySliderUp");
176 _LIT(KKeyMenu, "EKeyMenu");
177 _LIT(KKeyDictaphonePlay, "EKeyDictaphonePlay");
178 _LIT(KKeyDictaphoneStop, "EKeyDictaphoneStop");
179 _LIT(KKeyDictaphoneRecord, "EKeyDictaphoneRecord");
180 _LIT(KKeyHelp, "EKeyHelp");
181 _LIT(KKeyDial, "EKeyDial");
182 _LIT(KKeyScreenDimension0, "EKeyScreenDimension0");
183 _LIT(KKeyScreenDimension1, "EKeyScreenDimension1");
184 _LIT(KKeyScreenDimension2, "EKeyScreenDimension2");
185 _LIT(KKeyScreenDimension3, "EKeyScreenDimension3");
186 _LIT(KKeyIncVolume, "EKeyIncVolume");
187 _LIT(KKeyDecVolume, "EKeyDecVolume");
188 _LIT(KKeyDevice0, "EKeyDevice0");
189 _LIT(KKeyDevice1, "EKeyDevice1");
190 _LIT(KKeyDevice2, "EKeyDevice2");
191 _LIT(KKeyDevice3, "EKeyDevice3");
192 _LIT(KKeyDevice4, "EKeyDevice4");
193 _LIT(KKeyDevice5, "EKeyDevice5");
194 _LIT(KKeyDevice6, "EKeyDevice6");
195 _LIT(KKeyDevice7, "EKeyDevice7");
196 _LIT(KKeyDevice8, "EKeyDevice8");
197 _LIT(KKeyDevice9, "EKeyDevice9");
198 _LIT(KKeyDeviceA, "EKeyDeviceA");
199 _LIT(KKeyDeviceB, "EKeyDeviceB");
200 _LIT(KKeyDeviceC, "EKeyDeviceC");
201 _LIT(KKeyDeviceD, "EKeyDeviceD");
202 _LIT(KKeyDeviceE, "EKeyDeviceE");
203 _LIT(KKeyDeviceF, "EKeyDeviceF");
204 _LIT(KKeyApplication0, "EKeyApplication0");
205 _LIT(KKeyApplication1, "EKeyApplication1");
206 _LIT(KKeyApplication2, "EKeyApplication2");
207 _LIT(KKeyApplication3, "EKeyApplication3");
208 _LIT(KKeyApplication4, "EKeyApplication4");
209 _LIT(KKeyApplication5, "EKeyApplication5");
210 _LIT(KKeyApplication6, "EKeyApplication6");
211 _LIT(KKeyApplication7, "EKeyApplication7");
212 _LIT(KKeyApplication8, "EKeyApplication8");
213 _LIT(KKeyApplication9, "EKeyApplication9");
214 _LIT(KKeyApplicationA, "EKeyApplicationA");
215 _LIT(KKeyApplicationB, "EKeyApplicationB");
216 _LIT(KKeyApplicationC, "EKeyApplicationC");
217 _LIT(KKeyApplicationD, "EKeyApplicationD");
218 _LIT(KKeyApplicationE, "EKeyApplicationE");
219 _LIT(KKeyApplicationF, "EKeyApplicationF");
220 _LIT(KKeyYes, "EKeyYes");
221 _LIT(KKeyNo, "EKeyNo");
222 _LIT(KKeyIncBrightness, "EKeyIncBrightness");
223 _LIT(KKeyDecBrightness, "EKeyDecBrightness");
224 _LIT(KKeyKeyboardExtend, "EKeyKeyboardExtend");
225 _LIT(KKeyDevice10, "EKeyDevice10");
226 _LIT(KKeyDevice11, "EKeyDevice11");
227 _LIT(KKeyDevice12, "EKeyDevice12");
228 _LIT(KKeyDevice13, "EKeyDevice13");
229 _LIT(KKeyDevice14, "EKeyDevice14");
230 _LIT(KKeyDevice15, "EKeyDevice15");
231 _LIT(KKeyDevice16, "EKeyDevice16");
232 _LIT(KKeyDevice17, "EKeyDevice17");
233 _LIT(KKeyDevice18, "EKeyDevice18");
234 _LIT(KKeyDevice19, "EKeyDevice19");
235 _LIT(KKeyDevice1A, "EKeyDevice1A");
236 _LIT(KKeyDevice1B, "EKeyDevice1B");
237 _LIT(KKeyDevice1C, "EKeyDevice1C");
238 _LIT(KKeyDevice1D, "EKeyDevice1D");
239 _LIT(KKeyDevice1E, "EKeyDevice1E");
240 _LIT(KKeyDevice1F, "EKeyDevice1F");
241 _LIT(KKeyApplication10, "EKeyApplication10");
242 _LIT(KKeyApplication11, "EKeyApplication11");
243 _LIT(KKeyApplication12, "EKeyApplication12");
244 _LIT(KKeyApplication13, "EKeyApplication13");
245 _LIT(KKeyApplication14, "EKeyApplication14");
246 _LIT(KKeyApplication15, "EKeyApplication15");
247 _LIT(KKeyApplication16, "EKeyApplication16");
248 _LIT(KKeyApplication17, "EKeyApplication17");
249 _LIT(KKeyApplication18, "EKeyApplication18");
250 _LIT(KKeyApplication19, "EKeyApplication19");
251 _LIT(KKeyApplication1A, "EKeyApplication1A");
252 _LIT(KKeyApplication1B, "EKeyApplication1B");
253 _LIT(KKeyApplication1C, "EKeyApplication1C");
254 _LIT(KKeyApplication1D, "EKeyApplication1D");
255 _LIT(KKeyApplication1E, "EKeyApplication1E");
256 _LIT(KKeyApplication1F, "EKeyApplication1F");
257 _LIT(KKeyDevice20, "EKeyDevice20");
258 _LIT(KKeyDevice21, "EKeyDevice21");
259 _LIT(KKeyDevice22, "EKeyDevice22");
260 _LIT(KKeyDevice23, "EKeyDevice23");
261 _LIT(KKeyDevice24, "EKeyDevice24");
262 _LIT(KKeyDevice25, "EKeyDevice25");
263 _LIT(KKeyDevice26, "EKeyDevice26");
264 _LIT(KKeyDevice27, "EKeyDevice27");
265 _LIT(KKeyApplication20, "EKeyApplication20");
266 _LIT(KKeyApplication21, "EKeyApplication21");
267 _LIT(KKeyApplication22, "EKeyApplication22");
268 _LIT(KKeyApplication23, "EKeyApplication23");
269 _LIT(KKeyApplication24, "EKeyApplication24");
270 _LIT(KKeyApplication25, "EKeyApplication25");
271 _LIT(KKeyApplication26, "EKeyApplication26");
272 _LIT(KKeyApplication27, "EKeyApplication27");
273 const CDataWrapperBase::TEnumEntryTable CT_ActiveRConsoleRead::iEnumKeyCodeTable [] =
275 // Enum as a descriptor Enum
278 KKeyBackspace, EKeyBackspace,
280 KKeyLineFeed, EKeyLineFeed,
281 KKeyVerticalTab, EKeyVerticalTab,
282 KKeyFormFeed, EKeyFormFeed,
283 KKeyEnter, EKeyEnter,
284 KKeyEscape, EKeyEscape,
285 KKeySpace, EKeySpace,
286 KKeyDelete, EKeyDelete,
287 KKeyPrintScreen, EKeyPrintScreen,
288 KKeyPause, EKeyPause,
291 KKeyPageUp, EKeyPageUp,
292 KKeyPageDown, EKeyPageDown,
293 KKeyInsert, EKeyInsert,
294 KKeyLeftArrow, EKeyLeftArrow,
295 KKeyRightArrow, EKeyRightArrow,
296 KKeyUpArrow, EKeyUpArrow,
297 KKeyDownArrow, EKeyDownArrow,
298 KKeyLeftShift, EKeyLeftShift,
299 KKeyRightShift, EKeyRightShift,
300 KKeyLeftAlt, EKeyLeftAlt,
301 KKeyRightAlt, EKeyRightAlt,
302 KKeyLeftCtrl, EKeyLeftCtrl,
303 KKeyRightCtrl, EKeyRightCtrl,
304 KKeyLeftFunc, EKeyLeftFunc,
305 KKeyRightFunc, EKeyRightFunc,
306 KKeyCapsLock, EKeyCapsLock,
307 KKeyNumLock, EKeyNumLock,
308 KKeyScrollLock, EKeyScrollLock,
334 KKeyIncContrast, EKeyIncContrast,
335 KKeyDecContrast, EKeyDecContrast,
336 KKeyBacklightOn, EKeyBacklightOn,
337 KKeyBacklightOff, EKeyBacklightOff,
338 KKeyBacklightToggle, EKeyBacklightToggle,
339 KKeySliderDown, EKeySliderDown,
340 KKeySliderUp, EKeySliderUp,
342 KKeyDictaphonePlay, EKeyDictaphonePlay,
343 KKeyDictaphoneStop, EKeyDictaphoneStop,
344 KKeyDictaphoneRecord, EKeyDictaphoneRecord,
347 KKeyScreenDimension0, EKeyScreenDimension0,
348 KKeyScreenDimension1, EKeyScreenDimension1,
349 KKeyScreenDimension2, EKeyScreenDimension2,
350 KKeyScreenDimension3, EKeyScreenDimension3,
351 KKeyIncVolume, EKeyIncVolume,
352 KKeyDecVolume, EKeyDecVolume,
353 KKeyDevice0, EKeyDevice0,
354 KKeyDevice1, EKeyDevice1,
355 KKeyDevice2, EKeyDevice2,
356 KKeyDevice3, EKeyDevice3,
357 KKeyDevice4, EKeyDevice4,
358 KKeyDevice5, EKeyDevice5,
359 KKeyDevice6, EKeyDevice6,
360 KKeyDevice7, EKeyDevice7,
361 KKeyDevice8, EKeyDevice8,
362 KKeyDevice9, EKeyDevice9,
363 KKeyDeviceA, EKeyDeviceA,
364 KKeyDeviceB, EKeyDeviceB,
365 KKeyDeviceC, EKeyDeviceC,
366 KKeyDeviceD, EKeyDeviceD,
367 KKeyDeviceE, EKeyDeviceE,
368 KKeyDeviceF, EKeyDeviceF,
369 KKeyApplication0, EKeyApplication0,
370 KKeyApplication1, EKeyApplication1,
371 KKeyApplication2, EKeyApplication2,
372 KKeyApplication3, EKeyApplication3,
373 KKeyApplication4, EKeyApplication4,
374 KKeyApplication5, EKeyApplication5,
375 KKeyApplication6, EKeyApplication6,
376 KKeyApplication7, EKeyApplication7,
377 KKeyApplication8, EKeyApplication8,
378 KKeyApplication9, EKeyApplication9,
379 KKeyApplicationA, EKeyApplicationA,
380 KKeyApplicationB, EKeyApplicationB,
381 KKeyApplicationC, EKeyApplicationC,
382 KKeyApplicationD, EKeyApplicationD,
383 KKeyApplicationE, EKeyApplicationE,
384 KKeyApplicationF, EKeyApplicationF,
387 KKeyIncBrightness, EKeyIncBrightness,
388 KKeyDecBrightness, EKeyDecBrightness,
389 KKeyKeyboardExtend, EKeyKeyboardExtend,
390 KKeyDevice10, EKeyDevice10,
391 KKeyDevice11, EKeyDevice11,
392 KKeyDevice12, EKeyDevice12,
393 KKeyDevice13, EKeyDevice13,
394 KKeyDevice14, EKeyDevice14,
395 KKeyDevice15, EKeyDevice15,
396 KKeyDevice16, EKeyDevice16,
397 KKeyDevice17, EKeyDevice17,
398 KKeyDevice18, EKeyDevice18,
399 KKeyDevice19, EKeyDevice19,
400 KKeyDevice1A, EKeyDevice1A,
401 KKeyDevice1B, EKeyDevice1B,
402 KKeyDevice1C, EKeyDevice1C,
403 KKeyDevice1D, EKeyDevice1D,
404 KKeyDevice1E, EKeyDevice1E,
405 KKeyDevice1F, EKeyDevice1F,
406 KKeyApplication10, EKeyApplication10,
407 KKeyApplication11, EKeyApplication11,
408 KKeyApplication12, EKeyApplication12,
409 KKeyApplication13, EKeyApplication13,
410 KKeyApplication14, EKeyApplication14,
411 KKeyApplication15, EKeyApplication15,
412 KKeyApplication16, EKeyApplication16,
413 KKeyApplication17, EKeyApplication17,
414 KKeyApplication18, EKeyApplication18,
415 KKeyApplication19, EKeyApplication19,
416 KKeyApplication1A, EKeyApplication1A,
417 KKeyApplication1B, EKeyApplication1B,
418 KKeyApplication1C, EKeyApplication1C,
419 KKeyApplication1D, EKeyApplication1D,
420 KKeyApplication1E, EKeyApplication1E,
421 KKeyApplication1F, EKeyApplication1F,
422 KKeyDevice20, EKeyDevice20,
423 KKeyDevice21, EKeyDevice21,
424 KKeyDevice22, EKeyDevice22,
425 KKeyDevice23, EKeyDevice23,
426 KKeyDevice24, EKeyDevice24,
427 KKeyDevice25, EKeyDevice25,
428 KKeyDevice26, EKeyDevice26,
429 KKeyDevice27, EKeyDevice27,
430 KKeyApplication20, EKeyApplication20,
431 KKeyApplication21, EKeyApplication21,
432 KKeyApplication22, EKeyApplication22,
433 KKeyApplication23, EKeyApplication23,
434 KKeyApplication24, EKeyApplication24,
435 KKeyApplication25, EKeyApplication25,
436 KKeyApplication26, EKeyApplication26,
437 KKeyApplication27, EKeyApplication27,
441 _LIT(KEEventOccuranceOnce, "EEventOccuranceOnce");
442 _LIT(KEEventOccuranceZeroOrMore, "EEventOccuranceZeroOrMore");
443 _LIT(KEEventOccuranceOneOrMore, "EEventOccuranceOneOrMore");
444 const CDataWrapperBase::TEnumEntryTable CT_ActiveRConsoleRead::iEnumEventOccuranceTable[] =
446 // Enum as a descriptor Enum
447 KEEventOccuranceOnce, CT_ActiveRConsoleRead::EEventOccuranceOnce,
448 KEEventOccuranceZeroOrMore, CT_ActiveRConsoleRead::EEventOccuranceZeroOrMore,
449 KEEventOccuranceOneOrMore, CT_ActiveRConsoleRead::EEventOccuranceOneOrMore,
454 //////////////////////////////////////////////////////////////////////
455 // Construction/Destruction
456 //////////////////////////////////////////////////////////////////////
458 CT_ActiveRConsoleRead* CT_ActiveRConsoleRead::NewL(CDataWrapperBase& aDataWrapperBase)
460 CT_ActiveRConsoleRead* self=new (ELeave) CT_ActiveRConsoleRead(aDataWrapperBase);
461 CleanupStack::PushL(self);
463 CleanupStack::Pop(self);
468 CT_ActiveRConsoleRead::CT_ActiveRConsoleRead(CDataWrapperBase& aDataWrapperBase)
469 : CActiveCallbackBase(aDataWrapperBase,EPriorityStandard)
470 , iColourValueBlack(0)
471 , iColourValueWhite(0)
476 , iHasExitKeyCode(EFalse)
477 , iHasExitRectangle(EFalse)
481 , iHasExpectedKeyCode(EFalse)
482 , iHasExpectedRectangle(EFalse)
483 , iExpectedKeyCode(0)
488 CT_ActiveRConsoleRead::~CT_ActiveRConsoleRead()
496 void CT_ActiveRConsoleRead::DestroyData()
502 TBool CT_ActiveRConsoleRead::KickStartL(const TDesC& aSection, const TInt aAsyncErrorIndex, RConsole& aConsole)
504 * Kick Start the object and set up intials
505 * @param aSection The section in the ini containing data for the command
506 * @param aAsyncErrorIndex Command index for async calls to return errors to
507 * @param aConsole The RConsole object
510 TBuf<KMaxTestExecuteCommandLength> tempStore;
511 iSection.Set(aSection);
513 iColourValueBlack =KBlack;
514 iColourValueWhite =KWhite;
515 iDataWrapperBase.GetUint8FromConfig(iSection, KFldColourBlack(), iColourValueBlack);
516 iDataWrapperBase.GetUint8FromConfig(iSection, KFldColourWhite(), iColourValueWhite);
518 iTimeOut=KDefaultTimeout;
519 iDataWrapperBase.GetIntFromConfig(iSection, KFldTimeout(), iTimeOut);
522 iDataWrapperBase.GetIntFromConfig(iSection, KFldErrorMargin(), iErrorMargin);
524 iHasExitKeyCode=iDataWrapperBase.GetHexFromConfig(iSection, KFldExitKeyCode(), iExitKeyCode);
526 iHasExitRectangle=iDataWrapperBase.GetRectFromConfig(iSection, KFldExitRectangle(), iExitRectangle);
527 if ( iHasExitRectangle )
530 TInt height =Abs(iExitRectangle.iBr.iY-iExitRectangle.iTl.iY);
531 TInt width =Abs(iExitRectangle.iBr.iX-iExitRectangle.iTl.iX);
532 CDrawUtils::DrawSquareUtility(iExitRectangle.iTl, height, width, iColourValueWhite);
540 TBool moreData=ETrue;
543 tempStore.Format(KFldEventType, ++eventIndex);
544 moreData=iDataWrapperBase.GetEnumFromConfig(iSection, tempStore, iEnumRawEventTable, config.iEventType);
547 tempStore.Format(KFldEventOccurance, eventIndex);
548 TInt eventOccurance=EEventOccuranceOnce;
549 iDataWrapperBase.GetEnumFromConfig(iSection, tempStore, iEnumEventOccuranceTable, eventOccurance);
550 config.iEventOccurance=(TEventOccurance)eventOccurance;
552 tempStore.Format(KFldDataVerify, eventIndex);
553 config.iDataVerify=EFalse;
554 iDataWrapperBase.GetBoolFromConfig(iSection, tempStore, config.iDataVerify);
556 tempStore.Format(KFldDataDraw, eventIndex);
557 config.iDataDraw=EFalse;
558 iDataWrapperBase.GetBoolFromConfig(iSection, tempStore, config.iDataDraw);
560 iEvent.AppendL(config);
565 // If -1 then we have an umlimited number of test(s) that completes with an exit event
566 // which can be an exit key code or a pen event in the exit rectangle
568 iDataWrapperBase.GetIntFromConfig(iSection, KFldTests(), iNumberOfTests);
573 dataOk=KickNext(aAsyncErrorIndex, aConsole);
579 TBool CT_ActiveRConsoleRead::KickNext(const TInt aAsyncErrorIndex, RConsole& aConsole)
581 TInt testing=(iTestIndex<iNumberOfTests) || (iNumberOfTests==-1);
585 TBuf<KMaxTestExecuteCommandLength> tempStore;
588 iHasExpectedKeyCode=EFalse;
589 iHasExpectedRectangle=EFalse;
593 tempStore.Format(KFldKeyCode, iTestIndex);
594 iHasExpectedKeyCode=iDataWrapperBase.GetHexFromConfig(iSection, tempStore, iExpectedKeyCode);
596 tempStore.Format(KFldPoint, iTestIndex);
598 if ( iDataWrapperBase.GetPointFromConfig(iSection, tempStore, point) )
600 iHasExpectedRectangle=ETrue;
601 iExpectedRectangle.SetRect(point.iX-iErrorMargin, point.iY-iErrorMargin, point.iX+iErrorMargin, point.iY+iErrorMargin);
604 tempStore.Format(KFldRect, iTestIndex);
606 if ( iDataWrapperBase.GetRectFromConfig(iSection, tempStore, rect) )
608 iHasExpectedRectangle=ETrue;
609 iExpectedRectangle=rect;
612 if ( iHasExpectedRectangle )
615 TInt height =Abs(iExpectedRectangle.iBr.iY-iExpectedRectangle.iTl.iY);
616 TInt width =Abs(iExpectedRectangle.iBr.iX-iExpectedRectangle.iTl.iX);
617 CDrawUtils::DrawSquareOutLineUtility(iExpectedRectangle.iTl,height,width,iColourValueWhite);
620 Kick(aAsyncErrorIndex, aConsole);
626 void CT_ActiveRConsoleRead::Kick(const TInt aAsyncErrorIndex, RConsole& aConsole)
631 iDataWrapperBase.INFO_PRINTF1(_L("issuing kick"));
632 aConsole.Read(iKey, iStatus);//wait for user input
633 CActiveCallbackBase::Activate(aAsyncErrorIndex, iTimeOut);
636 TBool CT_ActiveRConsoleRead::VerifyDataAndKick(const TInt aAsyncErrorIndex, RConsole& aConsole)
638 TInt eventType=iKey.Type();
639 iDataWrapperBase.INFO_PRINTF2(KLogEvent, eventType);
641 // Do we ignore the event
642 TBool moreToDo=!ExitEvent();
643 TBool eventOk=EFalse;
645 TEventConfig config=iEvent[iEventIndex];
646 while ( iEventIndex<iEvent.Count() && !eventOk && moreToDo )
648 config=iEvent[iEventIndex];
649 if ( eventType==config.iEventType )
653 iDataWrapperBase.INFO_PRINTF3(_L("Events type match Expected=%d, Actual=%d"), config.iEventType,eventType);
657 switch(config.iEventOccurance)
659 case EEventOccuranceOnce:
660 iDataWrapperBase.ERR_PRINTF4(KLogUnexpectedEvent, config.iEventType, eventType, iEventIndex);
661 iDataWrapperBase.SetBlockResult(EFail);
664 case EEventOccuranceZeroOrMore:
665 // If the event may not occur then go to the next one
669 case EEventOccuranceOneOrMore:
672 iDataWrapperBase.ERR_PRINTF4(KLogUnexpectedEvent, config.iEventType, eventType, iEventIndex);
673 iDataWrapperBase.SetBlockResult(EFail);
688 if ( config.iDataDraw )
693 if ( config.iDataVerify )
695 if ( iHasExpectedRectangle )
697 TPoint point=iKey.MousePos();
698 if ( !iExpectedRectangle.Contains(point) )
700 iDataWrapperBase.ERR_PRINTF3(KLogUnexpectedPoint, point.iX, point.iY);
701 iDataWrapperBase.SetBlockResult(EFail);
705 if ( iHasExpectedKeyCode )
707 TKeyCode keyCode=iKey.Code();
708 if ( keyCode!=iExpectedKeyCode )
710 iDataWrapperBase.ERR_PRINTF2(KLogUnexpectedKeyCode, keyCode);
711 iDataWrapperBase.SetBlockResult(EFail);
715 iDataWrapperBase.INFO_PRINTF3(_L("keycodes match as expected:%d, actual:%d"), iExpectedKeyCode,keyCode);
720 if ( config.iEventOccurance==EEventOccuranceOnce )
725 if ( iEventIndex>=iEvent.Count() )
727 moreToDo=KickNext(aAsyncErrorIndex, aConsole);
731 // Event can occur multiple times
732 Kick(aAsyncErrorIndex, aConsole);
739 TConsoleKey CT_ActiveRConsoleRead::GetConsoleKey()
744 TBool CT_ActiveRConsoleRead::ExitEvent()
746 * Exit the testcase if certain scenarios are hit
751 TBool exitEvent=EFalse;
753 iDataWrapperBase.INFO_PRINTF2(_L("checking if we are an exit event:%d"),iKey.Type() );
755 switch (iKey.Type() )
757 case TRawEvent::ENone:
759 case TRawEvent::EPointerMove:
760 case TRawEvent::EButton1Down:
762 case TRawEvent::EButton1Up:
763 if ( iHasExitRectangle )
765 exitEvent=iExitRectangle.Contains(iKey.MousePos());
768 case TRawEvent::EButton2Down:
770 case TRawEvent::EButton2Up:
772 case TRawEvent::EButton3Down:
774 case TRawEvent::EButton3Up:
776 case TRawEvent::EKeyDown:
778 case TRawEvent::EKeyUp:
779 if ( iHasExitKeyCode )
781 iDataWrapperBase.INFO_PRINTF2(KLogKey, TInt (iKey.Code()));
782 if ( !iKey.Code()==TKeyCode(iExitKeyCode) )
784 iDataWrapperBase.ERR_PRINTF3(_L("Test failed due to user feedback :actual key %d, expected key %d"), TInt(iKey.Code()), iExitKeyCode);
785 iDataWrapperBase.SetBlockResult(EFail);
790 case TRawEvent::EKeyRepeat:
799 void CT_ActiveRConsoleRead::DrawData()
801 switch (iKey.Type() )
803 case TRawEvent::ENone:
805 case TRawEvent::EPointerMove:
806 case TRawEvent::EButton1Down:
807 case TRawEvent::EButton1Up:
808 case TRawEvent::EButton2Down:
809 case TRawEvent::EButton2Up:
810 case TRawEvent::EButton3Down:
811 case TRawEvent::EButton3Up:
813 CDrawUtils::ColourFillUtility(iColourValueBlack, iKey.MousePos());
815 case TRawEvent::EKeyDown:
817 case TRawEvent::EKeyUp:
819 case TRawEvent::EKeyRepeat: