|
1 /* |
|
2 * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 #include "T_ActiveRConsoleRead.h" |
|
19 |
|
20 const TInt KDefaultTimeout =10000000; |
|
21 const TUint8 KWhite =0xFF; |
|
22 const TUint8 KBlack =0x00; |
|
23 |
|
24 /*@{*/ |
|
25 _LIT(KFldTimeout, "timeout"); |
|
26 _LIT(KFldErrorMargin, "errorMargin"); |
|
27 _LIT(KFldTests, "tests"); |
|
28 |
|
29 |
|
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"); |
|
36 |
|
37 |
|
38 _LIT(KFldKeyCode, "keyCode%d"); |
|
39 _LIT(KFldPoint, "point%d"); |
|
40 _LIT(KFldRect, "rect%d"); |
|
41 _LIT(KFldColourWhite, "white"); |
|
42 _LIT(KFldColourBlack, "black"); |
|
43 |
|
44 |
|
45 //format fields |
|
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"); |
|
51 |
|
52 /*@}*/ |
|
53 //This represents a NULL attribute |
|
54 _LIT(KEnumNull, ""); |
|
55 |
|
56 // TRawEvent |
|
57 _LIT(KNone, "ENone"); |
|
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 [] = |
|
79 { |
|
80 /** Enum as a descriptor Enum integar value |
|
81 * In this case these enums represent TRawEvents |
|
82 * |
|
83 * |
|
84 */ |
|
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, |
|
107 KEnumNull, -1, |
|
108 }; |
|
109 |
|
110 // TKeyCode |
|
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 [] = |
|
274 { |
|
275 // Enum as a descriptor Enum |
|
276 KKeyNull, EKeyNull, |
|
277 KKeyBell, EKeyBell, |
|
278 KKeyBackspace, EKeyBackspace, |
|
279 KKeyTab, EKeyTab, |
|
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, |
|
289 KKeyHome, EKeyHome, |
|
290 KKeyEnd, EKeyEnd, |
|
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, |
|
309 KKeyF1, EKeyF1, |
|
310 KKeyF2, EKeyF2, |
|
311 KKeyF3, EKeyF3, |
|
312 KKeyF4, EKeyF4, |
|
313 KKeyF5, EKeyF5, |
|
314 KKeyF6, EKeyF6, |
|
315 KKeyF7, EKeyF7, |
|
316 KKeyF8, EKeyF8, |
|
317 KKeyF9, EKeyF9, |
|
318 KKeyF10, EKeyF10, |
|
319 KKeyF11, EKeyF11, |
|
320 KKeyF12, EKeyF12, |
|
321 KKeyF13, EKeyF13, |
|
322 KKeyF14, EKeyF14, |
|
323 KKeyF15, EKeyF15, |
|
324 KKeyF16, EKeyF16, |
|
325 KKeyF17, EKeyF17, |
|
326 KKeyF18, EKeyF18, |
|
327 KKeyF19, EKeyF19, |
|
328 KKeyF20, EKeyF20, |
|
329 KKeyF21, EKeyF21, |
|
330 KKeyF22, EKeyF22, |
|
331 KKeyF23, EKeyF23, |
|
332 KKeyF24, EKeyF24, |
|
333 KKeyOff, EKeyOff, |
|
334 KKeyIncContrast, EKeyIncContrast, |
|
335 KKeyDecContrast, EKeyDecContrast, |
|
336 KKeyBacklightOn, EKeyBacklightOn, |
|
337 KKeyBacklightOff, EKeyBacklightOff, |
|
338 KKeyBacklightToggle, EKeyBacklightToggle, |
|
339 KKeySliderDown, EKeySliderDown, |
|
340 KKeySliderUp, EKeySliderUp, |
|
341 KKeyMenu, EKeyMenu, |
|
342 KKeyDictaphonePlay, EKeyDictaphonePlay, |
|
343 KKeyDictaphoneStop, EKeyDictaphoneStop, |
|
344 KKeyDictaphoneRecord, EKeyDictaphoneRecord, |
|
345 KKeyHelp, EKeyHelp, |
|
346 KKeyDial, EKeyDial, |
|
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, |
|
385 KKeyYes, EKeyYes, |
|
386 KKeyNo, EKeyNo, |
|
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, |
|
438 KEnumNull, -1, |
|
439 }; |
|
440 |
|
441 _LIT(KEEventOccuranceOnce, "EEventOccuranceOnce"); |
|
442 _LIT(KEEventOccuranceZeroOrMore, "EEventOccuranceZeroOrMore"); |
|
443 _LIT(KEEventOccuranceOneOrMore, "EEventOccuranceOneOrMore"); |
|
444 const CDataWrapperBase::TEnumEntryTable CT_ActiveRConsoleRead::iEnumEventOccuranceTable[] = |
|
445 { |
|
446 // Enum as a descriptor Enum |
|
447 KEEventOccuranceOnce, CT_ActiveRConsoleRead::EEventOccuranceOnce, |
|
448 KEEventOccuranceZeroOrMore, CT_ActiveRConsoleRead::EEventOccuranceZeroOrMore, |
|
449 KEEventOccuranceOneOrMore, CT_ActiveRConsoleRead::EEventOccuranceOneOrMore, |
|
450 KEnumNull, -1, |
|
451 }; |
|
452 /*@}*/ |
|
453 |
|
454 ////////////////////////////////////////////////////////////////////// |
|
455 // Construction/Destruction |
|
456 ////////////////////////////////////////////////////////////////////// |
|
457 |
|
458 CT_ActiveRConsoleRead* CT_ActiveRConsoleRead::NewL(CDataWrapperBase& aDataWrapperBase) |
|
459 { |
|
460 CT_ActiveRConsoleRead* self=new (ELeave) CT_ActiveRConsoleRead(aDataWrapperBase); |
|
461 CleanupStack::PushL(self); |
|
462 self->ConstructL(); |
|
463 CleanupStack::Pop(self); |
|
464 return self; |
|
465 } |
|
466 |
|
467 |
|
468 CT_ActiveRConsoleRead::CT_ActiveRConsoleRead(CDataWrapperBase& aDataWrapperBase) |
|
469 : CActiveCallbackBase(aDataWrapperBase,EPriorityStandard) |
|
470 , iColourValueBlack(0) |
|
471 , iColourValueWhite(0) |
|
472 , iEventIndex(0) |
|
473 , iEventCount(0) |
|
474 , iTimeOut(0) |
|
475 , iErrorMargin(0) |
|
476 , iHasExitKeyCode(EFalse) |
|
477 , iHasExitRectangle(EFalse) |
|
478 , iExitKeyCode(0) |
|
479 , iTestIndex(0) |
|
480 , iNumberOfTests(0) |
|
481 , iHasExpectedKeyCode(EFalse) |
|
482 , iHasExpectedRectangle(EFalse) |
|
483 , iExpectedKeyCode(0) |
|
484 { |
|
485 } |
|
486 |
|
487 |
|
488 CT_ActiveRConsoleRead::~CT_ActiveRConsoleRead() |
|
489 /** |
|
490 * Public destructor |
|
491 */ |
|
492 { |
|
493 DestroyData(); |
|
494 } |
|
495 |
|
496 void CT_ActiveRConsoleRead::DestroyData() |
|
497 { |
|
498 iEvent.Reset(); |
|
499 iEvent.Close(); |
|
500 } |
|
501 |
|
502 TBool CT_ActiveRConsoleRead::KickStartL(const TDesC& aSection, const TInt aAsyncErrorIndex, RConsole& aConsole) |
|
503 /** |
|
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 |
|
508 */ |
|
509 { |
|
510 TBuf<KMaxTestExecuteCommandLength> tempStore; |
|
511 iSection.Set(aSection); |
|
512 |
|
513 iColourValueBlack =KBlack; |
|
514 iColourValueWhite =KWhite; |
|
515 iDataWrapperBase.GetUint8FromConfig(iSection, KFldColourBlack(), iColourValueBlack); |
|
516 iDataWrapperBase.GetUint8FromConfig(iSection, KFldColourWhite(), iColourValueWhite); |
|
517 |
|
518 iTimeOut=KDefaultTimeout; |
|
519 iDataWrapperBase.GetIntFromConfig(iSection, KFldTimeout(), iTimeOut); |
|
520 |
|
521 iErrorMargin=0; |
|
522 iDataWrapperBase.GetIntFromConfig(iSection, KFldErrorMargin(), iErrorMargin); |
|
523 |
|
524 iHasExitKeyCode=iDataWrapperBase.GetHexFromConfig(iSection, KFldExitKeyCode(), iExitKeyCode); |
|
525 |
|
526 iHasExitRectangle=iDataWrapperBase.GetRectFromConfig(iSection, KFldExitRectangle(), iExitRectangle); |
|
527 if ( iHasExitRectangle ) |
|
528 { |
|
529 // Draw rectangle |
|
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); |
|
533 } |
|
534 |
|
535 iEvent.Reset(); |
|
536 |
|
537 TEventConfig config; |
|
538 TInt eventIndex=0; |
|
539 TBool dataOk=ETrue; |
|
540 TBool moreData=ETrue; |
|
541 while ( moreData ) |
|
542 { |
|
543 tempStore.Format(KFldEventType, ++eventIndex); |
|
544 moreData=iDataWrapperBase.GetEnumFromConfig(iSection, tempStore, iEnumRawEventTable, config.iEventType); |
|
545 if ( moreData ) |
|
546 { |
|
547 tempStore.Format(KFldEventOccurance, eventIndex); |
|
548 TInt eventOccurance=EEventOccuranceOnce; |
|
549 iDataWrapperBase.GetEnumFromConfig(iSection, tempStore, iEnumEventOccuranceTable, eventOccurance); |
|
550 config.iEventOccurance=(TEventOccurance)eventOccurance; |
|
551 |
|
552 tempStore.Format(KFldDataVerify, eventIndex); |
|
553 config.iDataVerify=EFalse; |
|
554 iDataWrapperBase.GetBoolFromConfig(iSection, tempStore, config.iDataVerify); |
|
555 |
|
556 tempStore.Format(KFldDataDraw, eventIndex); |
|
557 config.iDataDraw=EFalse; |
|
558 iDataWrapperBase.GetBoolFromConfig(iSection, tempStore, config.iDataDraw); |
|
559 |
|
560 iEvent.AppendL(config); |
|
561 dataOk=ETrue; |
|
562 } |
|
563 } |
|
564 |
|
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 |
|
567 iNumberOfTests=-1; |
|
568 iDataWrapperBase.GetIntFromConfig(iSection, KFldTests(), iNumberOfTests); |
|
569 |
|
570 if ( dataOk ) |
|
571 { |
|
572 iTestIndex=0; |
|
573 dataOk=KickNext(aAsyncErrorIndex, aConsole); |
|
574 } |
|
575 |
|
576 return dataOk; |
|
577 } |
|
578 |
|
579 TBool CT_ActiveRConsoleRead::KickNext(const TInt aAsyncErrorIndex, RConsole& aConsole) |
|
580 { |
|
581 TInt testing=(iTestIndex<iNumberOfTests) || (iNumberOfTests==-1); |
|
582 |
|
583 if ( testing ) |
|
584 { |
|
585 TBuf<KMaxTestExecuteCommandLength> tempStore; |
|
586 iEventIndex=0; |
|
587 iEventCount=0; |
|
588 iHasExpectedKeyCode=EFalse; |
|
589 iHasExpectedRectangle=EFalse; |
|
590 |
|
591 ++iTestIndex; |
|
592 |
|
593 tempStore.Format(KFldKeyCode, iTestIndex); |
|
594 iHasExpectedKeyCode=iDataWrapperBase.GetHexFromConfig(iSection, tempStore, iExpectedKeyCode); |
|
595 |
|
596 tempStore.Format(KFldPoint, iTestIndex); |
|
597 TPoint point; |
|
598 if ( iDataWrapperBase.GetPointFromConfig(iSection, tempStore, point) ) |
|
599 { |
|
600 iHasExpectedRectangle=ETrue; |
|
601 iExpectedRectangle.SetRect(point.iX-iErrorMargin, point.iY-iErrorMargin, point.iX+iErrorMargin, point.iY+iErrorMargin); |
|
602 } |
|
603 |
|
604 tempStore.Format(KFldRect, iTestIndex); |
|
605 TRect rect; |
|
606 if ( iDataWrapperBase.GetRectFromConfig(iSection, tempStore, rect) ) |
|
607 { |
|
608 iHasExpectedRectangle=ETrue; |
|
609 iExpectedRectangle=rect; |
|
610 } |
|
611 |
|
612 if ( iHasExpectedRectangle ) |
|
613 { |
|
614 // Draw boundary |
|
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); |
|
618 } |
|
619 |
|
620 Kick(aAsyncErrorIndex, aConsole); |
|
621 } |
|
622 |
|
623 return testing; |
|
624 } |
|
625 |
|
626 void CT_ActiveRConsoleRead::Kick(const TInt aAsyncErrorIndex, RConsole& aConsole) |
|
627 /** |
|
628 * Kick the object |
|
629 */ |
|
630 { |
|
631 iDataWrapperBase.INFO_PRINTF1(_L("issuing kick")); |
|
632 aConsole.Read(iKey, iStatus);//wait for user input |
|
633 CActiveCallbackBase::Activate(aAsyncErrorIndex, iTimeOut); |
|
634 } |
|
635 |
|
636 TBool CT_ActiveRConsoleRead::VerifyDataAndKick(const TInt aAsyncErrorIndex, RConsole& aConsole) |
|
637 { |
|
638 TInt eventType=iKey.Type(); |
|
639 iDataWrapperBase.INFO_PRINTF2(KLogEvent, eventType); |
|
640 |
|
641 // Do we ignore the event |
|
642 TBool moreToDo=!ExitEvent(); |
|
643 TBool eventOk=EFalse; |
|
644 |
|
645 TEventConfig config=iEvent[iEventIndex]; |
|
646 while ( iEventIndex<iEvent.Count() && !eventOk && moreToDo ) |
|
647 { |
|
648 config=iEvent[iEventIndex]; |
|
649 if ( eventType==config.iEventType ) |
|
650 { |
|
651 ++iEventCount; |
|
652 eventOk=ETrue; |
|
653 iDataWrapperBase.INFO_PRINTF3(_L("Events type match Expected=%d, Actual=%d"), config.iEventType,eventType); |
|
654 } |
|
655 else |
|
656 { |
|
657 switch(config.iEventOccurance) |
|
658 { |
|
659 case EEventOccuranceOnce: |
|
660 iDataWrapperBase.ERR_PRINTF4(KLogUnexpectedEvent, config.iEventType, eventType, iEventIndex); |
|
661 iDataWrapperBase.SetBlockResult(EFail); |
|
662 moreToDo=EFalse; |
|
663 break; |
|
664 case EEventOccuranceZeroOrMore: |
|
665 // If the event may not occur then go to the next one |
|
666 ++iEventIndex; |
|
667 iEventCount=0; |
|
668 break; |
|
669 case EEventOccuranceOneOrMore: |
|
670 if(iEventCount==0) |
|
671 { |
|
672 iDataWrapperBase.ERR_PRINTF4(KLogUnexpectedEvent, config.iEventType, eventType, iEventIndex); |
|
673 iDataWrapperBase.SetBlockResult(EFail); |
|
674 moreToDo=EFalse; |
|
675 } |
|
676 else |
|
677 { |
|
678 ++iEventIndex; |
|
679 iEventCount=0; |
|
680 } |
|
681 break; |
|
682 } |
|
683 } |
|
684 } |
|
685 |
|
686 if ( eventOk ) |
|
687 { |
|
688 if ( config.iDataDraw ) |
|
689 { |
|
690 DrawData(); |
|
691 } |
|
692 |
|
693 if ( config.iDataVerify ) |
|
694 { |
|
695 if ( iHasExpectedRectangle ) |
|
696 { |
|
697 TPoint point=iKey.MousePos(); |
|
698 if ( !iExpectedRectangle.Contains(point) ) |
|
699 { |
|
700 iDataWrapperBase.ERR_PRINTF3(KLogUnexpectedPoint, point.iX, point.iY); |
|
701 iDataWrapperBase.SetBlockResult(EFail); |
|
702 } |
|
703 } |
|
704 |
|
705 if ( iHasExpectedKeyCode ) |
|
706 { |
|
707 TKeyCode keyCode=iKey.Code(); |
|
708 if ( keyCode!=iExpectedKeyCode ) |
|
709 { |
|
710 iDataWrapperBase.ERR_PRINTF2(KLogUnexpectedKeyCode, keyCode); |
|
711 iDataWrapperBase.SetBlockResult(EFail); |
|
712 } |
|
713 else |
|
714 { |
|
715 iDataWrapperBase.INFO_PRINTF3(_L("keycodes match as expected:%d, actual:%d"), iExpectedKeyCode,keyCode); |
|
716 } |
|
717 } |
|
718 } |
|
719 |
|
720 if ( config.iEventOccurance==EEventOccuranceOnce ) |
|
721 { |
|
722 ++iEventIndex; |
|
723 iEventCount=0; |
|
724 } |
|
725 if ( iEventIndex>=iEvent.Count() ) |
|
726 { |
|
727 moreToDo=KickNext(aAsyncErrorIndex, aConsole); |
|
728 } |
|
729 else |
|
730 { |
|
731 // Event can occur multiple times |
|
732 Kick(aAsyncErrorIndex, aConsole); |
|
733 } |
|
734 } |
|
735 |
|
736 return moreToDo; |
|
737 } |
|
738 |
|
739 TConsoleKey CT_ActiveRConsoleRead::GetConsoleKey() |
|
740 { |
|
741 return iKey; |
|
742 } |
|
743 |
|
744 TBool CT_ActiveRConsoleRead::ExitEvent() |
|
745 /** |
|
746 * Exit the testcase if certain scenarios are hit |
|
747 * |
|
748 * |
|
749 */ |
|
750 { |
|
751 TBool exitEvent=EFalse; |
|
752 |
|
753 iDataWrapperBase.INFO_PRINTF2(_L("checking if we are an exit event:%d"),iKey.Type() ); |
|
754 |
|
755 switch (iKey.Type() ) |
|
756 { |
|
757 case TRawEvent::ENone: |
|
758 break; |
|
759 case TRawEvent::EPointerMove: |
|
760 case TRawEvent::EButton1Down: |
|
761 break; |
|
762 case TRawEvent::EButton1Up: |
|
763 if ( iHasExitRectangle ) |
|
764 { |
|
765 exitEvent=iExitRectangle.Contains(iKey.MousePos()); |
|
766 } |
|
767 break; |
|
768 case TRawEvent::EButton2Down: |
|
769 break; |
|
770 case TRawEvent::EButton2Up: |
|
771 break; |
|
772 case TRawEvent::EButton3Down: |
|
773 break; |
|
774 case TRawEvent::EButton3Up: |
|
775 break; |
|
776 case TRawEvent::EKeyDown: |
|
777 break; |
|
778 case TRawEvent::EKeyUp: |
|
779 if ( iHasExitKeyCode ) |
|
780 { |
|
781 iDataWrapperBase.INFO_PRINTF2(KLogKey, TInt (iKey.Code())); |
|
782 if ( !iKey.Code()==TKeyCode(iExitKeyCode) ) |
|
783 { |
|
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); |
|
786 } |
|
787 exitEvent=ETrue; |
|
788 } |
|
789 break; |
|
790 case TRawEvent::EKeyRepeat: |
|
791 break; |
|
792 default: |
|
793 break; |
|
794 } |
|
795 |
|
796 return exitEvent; |
|
797 } |
|
798 |
|
799 void CT_ActiveRConsoleRead::DrawData() |
|
800 { |
|
801 switch (iKey.Type() ) |
|
802 { |
|
803 case TRawEvent::ENone: |
|
804 break; |
|
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: |
|
812 // Draw the point |
|
813 CDrawUtils::ColourFillUtility(iColourValueBlack, iKey.MousePos()); |
|
814 break; |
|
815 case TRawEvent::EKeyDown: |
|
816 break; |
|
817 case TRawEvent::EKeyUp: |
|
818 break; |
|
819 case TRawEvent::EKeyRepeat: |
|
820 break; |
|
821 default: |
|
822 break; |
|
823 } |
|
824 } |