0
|
1 |
// Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
2 |
// All rights reserved.
|
|
3 |
// This component and the accompanying materials are made available
|
|
4 |
// under the terms of the License "Eclipse Public License v1.0"
|
|
5 |
// which accompanies this distribution, and is available
|
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
7 |
//
|
|
8 |
// Initial Contributors:
|
|
9 |
// Nokia Corporation - initial contribution.
|
|
10 |
//
|
|
11 |
// Contributors:
|
|
12 |
//
|
|
13 |
// Description:
|
|
14 |
// e32\include\e32event.h
|
|
15 |
//
|
|
16 |
//
|
|
17 |
|
|
18 |
#ifndef __E32EVENT_H__
|
|
19 |
#define __E32EVENT_H__
|
|
20 |
#include <e32cmn.h>
|
|
21 |
#include <e32btrace.h>
|
|
22 |
|
|
23 |
/**
|
|
24 |
@publishedAll
|
|
25 |
@released
|
|
26 |
*/
|
|
27 |
const TInt KUndefinedDeviceNumber = -1;
|
|
28 |
|
|
29 |
/**
|
|
30 |
@publishedAll
|
|
31 |
@released
|
|
32 |
|
|
33 |
Represents a raw hardware event as generated by hardware drivers of
|
|
34 |
a pointer device, a keyboard etc.
|
|
35 |
|
|
36 |
Raw hardware events are added to the kernel's event queue.
|
|
37 |
*/
|
|
38 |
class TRawEvent
|
|
39 |
{
|
|
40 |
public:
|
|
41 |
|
|
42 |
/**
|
|
43 |
Defines the event type.
|
|
44 |
*/
|
|
45 |
enum TType
|
|
46 |
{
|
|
47 |
|
|
48 |
/**
|
|
49 |
Represents an uninitialised event object.
|
|
50 |
*/
|
|
51 |
ENone,
|
|
52 |
|
|
53 |
/**
|
|
54 |
A pointer device (e.g. a pen) has moved. Only changes in Cartesian coordinates are tracked.
|
|
55 |
*/
|
|
56 |
EPointerMove,
|
|
57 |
|
|
58 |
/**
|
|
59 |
A switch on event caused by a screen tap using a pointer device.
|
|
60 |
*/
|
|
61 |
EPointerSwitchOn,
|
|
62 |
|
|
63 |
/**
|
|
64 |
Represents a keyboard key down event.
|
|
65 |
*/
|
|
66 |
EKeyDown,
|
|
67 |
|
|
68 |
/**
|
|
69 |
Represents a keyboard key up event.
|
|
70 |
*/
|
|
71 |
EKeyUp,
|
|
72 |
|
|
73 |
/**
|
|
74 |
Represents a redraw event.
|
|
75 |
|
|
76 |
Typically generated in an emulator environment in response
|
|
77 |
to a host OS redraw event.
|
|
78 |
*/
|
|
79 |
ERedraw,
|
|
80 |
|
|
81 |
/**
|
|
82 |
Represents a device switch on event.
|
|
83 |
*/
|
|
84 |
ESwitchOn,
|
|
85 |
|
|
86 |
/**
|
|
87 |
*/
|
|
88 |
EActive,
|
|
89 |
|
|
90 |
/**
|
|
91 |
*/
|
|
92 |
EInactive,
|
|
93 |
|
|
94 |
/**
|
|
95 |
Represents a modifier key being pressed.
|
|
96 |
*/
|
|
97 |
EUpdateModifiers,
|
|
98 |
|
|
99 |
/**
|
|
100 |
Represents a button down event.
|
|
101 |
|
|
102 |
This is typically used to represent a pointing device
|
|
103 |
coming into contact with a touch sensitive screen.
|
|
104 |
*/
|
|
105 |
EButton1Down,
|
|
106 |
|
|
107 |
/**
|
|
108 |
Represents a button up event.
|
|
109 |
|
|
110 |
This is typically used to represent a pointing device
|
|
111 |
being lifted away from a touch sensitive screen.
|
|
112 |
*/
|
|
113 |
EButton1Up,
|
|
114 |
|
|
115 |
/**
|
|
116 |
Represents a button down event.
|
|
117 |
|
|
118 |
This is typically used to represent a pointing device
|
|
119 |
coming into contact with a touch sensitive screen.
|
|
120 |
*/
|
|
121 |
EButton2Down,
|
|
122 |
|
|
123 |
/**
|
|
124 |
Represents a button up event.
|
|
125 |
|
|
126 |
This is typically used to represent a pointing device
|
|
127 |
being lifted away from a touch sensitive screen.
|
|
128 |
*/
|
|
129 |
EButton2Up,
|
|
130 |
|
|
131 |
/**
|
|
132 |
Represents a button down event.
|
|
133 |
|
|
134 |
This is typically used to represent a pointing device
|
|
135 |
coming into contact with a touch sensitive screen.
|
|
136 |
*/
|
|
137 |
EButton3Down,
|
|
138 |
|
|
139 |
/**
|
|
140 |
Represents a button up event.
|
|
141 |
|
|
142 |
This is typically used to represent a pointing device
|
|
143 |
being lifted away from a touch sensitive screen.
|
|
144 |
*/
|
|
145 |
EButton3Up,
|
|
146 |
|
|
147 |
/**
|
|
148 |
Represents a device switch off event.
|
|
149 |
*/
|
|
150 |
ESwitchOff,
|
|
151 |
|
|
152 |
/**
|
|
153 |
Represents a key being continually pressed event.
|
|
154 |
*/
|
|
155 |
EKeyRepeat,
|
|
156 |
|
|
157 |
/**
|
|
158 |
Represents a case open event.
|
|
159 |
|
|
160 |
The meaning of a case is hardware specific.
|
|
161 |
*/
|
|
162 |
ECaseOpen,
|
|
163 |
|
|
164 |
/**
|
|
165 |
Represents a case close event.
|
|
166 |
|
|
167 |
The meaning of a case is hardware specific.
|
|
168 |
*/
|
|
169 |
ECaseClose,
|
|
170 |
|
|
171 |
/**
|
|
172 |
@prototype
|
|
173 |
Represents a 3D pointer entering the detection volume event.
|
|
174 |
|
|
175 |
This is typically used to represent a pointing device
|
|
176 |
coming into detection range of a sensitive screen.
|
|
177 |
*/
|
|
178 |
EPointer3DInRange,
|
|
179 |
|
|
180 |
/**
|
|
181 |
@prototype
|
|
182 |
Represents a 3D pointer leaving the detection volume event.
|
|
183 |
|
|
184 |
This is typically used to represent a pointing device
|
|
185 |
leaving the detection range of a sensitive screen.
|
|
186 |
*/
|
|
187 |
EPointer3DOutOfRange,
|
|
188 |
|
|
189 |
/**
|
|
190 |
@prototype
|
|
191 |
Represents a 3D pointer tilt changes only event.
|
|
192 |
|
|
193 |
This is typically sent by a 3D pointer driver when it detects
|
|
194 |
a change in the pointer's polar coordinates (Theta or Phi).
|
|
195 |
*/
|
|
196 |
EPointer3DTilt,
|
|
197 |
|
|
198 |
/**
|
|
199 |
@prototype
|
|
200 |
Represents a 3D pointer rotation only event.
|
|
201 |
|
|
202 |
This is typically sent by a 3D pointer driver when it detects
|
|
203 |
a rotation of the pointing device (along ist main axis).
|
|
204 |
*/
|
|
205 |
EPointer3DRotation,
|
|
206 |
|
|
207 |
/**
|
|
208 |
@prototype
|
|
209 |
Represents a general 3D pointer changes event.
|
|
210 |
|
|
211 |
This is typically sent by a 3D pointer driver when it detects
|
|
212 |
a change in the pointer's linear and/or polar coordinates and/or rotation.
|
|
213 |
*/
|
|
214 |
EPointer3DTiltAndMove,
|
|
215 |
|
|
216 |
/**
|
|
217 |
@prototype
|
|
218 |
Reserved for a 3D pointing device button down event.
|
|
219 |
*/
|
|
220 |
EButton4Down,
|
|
221 |
|
|
222 |
/**
|
|
223 |
@prototype
|
|
224 |
Reserved for a 3D pointing device button up event.
|
|
225 |
*/
|
|
226 |
EButton4Up,
|
|
227 |
|
|
228 |
/**
|
|
229 |
@prototype
|
|
230 |
Reserved for a 3D pointing device button down event.
|
|
231 |
*/
|
|
232 |
EButton5Down,
|
|
233 |
|
|
234 |
/**
|
|
235 |
@prototype
|
|
236 |
Reserved for a 3D pointing device button up event.
|
|
237 |
*/
|
|
238 |
EButton5Up,
|
|
239 |
|
|
240 |
/**
|
|
241 |
@prototype
|
|
242 |
Reserved for a 3D pointing device button down event.
|
|
243 |
*/
|
|
244 |
EButton6Down,
|
|
245 |
|
|
246 |
/**
|
|
247 |
@prototype
|
|
248 |
Reserved for a 3D pointing device button up event.
|
|
249 |
*/
|
|
250 |
EButton6Up,
|
|
251 |
|
|
252 |
/**
|
|
253 |
Represents a device restart event.
|
|
254 |
*/
|
|
255 |
ERestartSystem
|
|
256 |
};
|
|
257 |
public:
|
|
258 |
|
|
259 |
/**
|
|
260 |
Default constructor
|
|
261 |
*/
|
|
262 |
inline TRawEvent()
|
|
263 |
{ *(TInt*)&iType=0; }
|
|
264 |
|
|
265 |
/**
|
|
266 |
Gets the event type
|
|
267 |
|
|
268 |
@return The event type.
|
|
269 |
*/
|
|
270 |
inline TType Type() const
|
|
271 |
{return TType(iType);}
|
|
272 |
|
|
273 |
/**
|
|
274 |
Gets the device number (eg. screen number)
|
|
275 |
|
|
276 |
@return The device number.
|
|
277 |
*/
|
|
278 |
inline TInt DeviceNumber() const
|
|
279 |
{return TInt(iDeviceNumber-1);}
|
|
280 |
|
|
281 |
/**
|
|
282 |
Sets the device number (eg. screen number)
|
|
283 |
|
|
284 |
@param aDeviceNumber The device number
|
|
285 |
*/
|
|
286 |
inline void SetDeviceNumber(TInt aDeviceNumber)
|
|
287 |
{iDeviceNumber = TUint8(aDeviceNumber+1);}
|
|
288 |
|
|
289 |
IMPORT_C TPoint Pos() const;
|
|
290 |
IMPORT_C TInt ScanCode() const;
|
|
291 |
IMPORT_C TInt Modifiers() const;
|
|
292 |
IMPORT_C TInt Repeats() const;
|
|
293 |
|
|
294 |
/**
|
|
295 |
Gets the Cartesian coordinates of the 3D pointer end that is closer to the screen.
|
|
296 |
|
|
297 |
@return The Cartesian coordinates of the point defined by the end of the 3D pointing device that is closer to the screen.
|
|
298 |
*/
|
|
299 |
IMPORT_C TPoint3D Pos3D() const;
|
|
300 |
|
|
301 |
|
|
302 |
/**
|
|
303 |
Gets the angular spherical polar coordinates of the 3D pointer end that is closer to the screen.
|
|
304 |
|
|
305 |
@return The angular spherical polar coordinates of the point defined by the end of the 3D pointing device that is closer to the screen.
|
|
306 |
@see TAngle3D
|
|
307 |
*/
|
|
308 |
IMPORT_C TAngle3D Tilt() const;
|
|
309 |
|
|
310 |
/**
|
|
311 |
Gets the rotation angle of 3D pointing device.
|
|
312 |
|
|
313 |
Some 3D pointing devices support information regarding the angle formed between the physical and magnetical poles,
|
|
314 |
as obtaining when rotating the pen along its main axis.
|
|
315 |
|
|
316 |
@return The rotation angle of the 3D pointing device.
|
|
317 |
*/
|
|
318 |
IMPORT_C TInt Rotation() const;
|
|
319 |
|
|
320 |
/**
|
|
321 |
Gets the tick count value associated with the event.
|
|
322 |
|
|
323 |
Note that the interval between tick counts is
|
|
324 |
hardware dependent.
|
|
325 |
|
|
326 |
@return The tick count value
|
|
327 |
*/
|
|
328 |
inline TUint Ticks() const
|
|
329 |
{return iTicks;}
|
|
330 |
/**
|
|
331 |
Gets the information on which end of the pointing device is closer to the screen
|
|
332 |
|
|
333 |
@return A Boolean indicating which end of the pointing device is closer to the screen.
|
|
334 |
*/
|
|
335 |
inline TBool IsTip() const
|
|
336 |
{return TBool(iTip);}
|
|
337 |
|
|
338 |
/**
|
|
339 |
Sets the information on which end of the pointing device is closer to the screen
|
|
340 |
|
|
341 |
@param aTip A Boolean indicating which end of the pointing device is closer to the screen.
|
|
342 |
*/
|
|
343 |
inline void SetTip(TBool aTip)
|
|
344 |
{iTip = TUint8(aTip);
|
|
345 |
#ifdef BTRACE_TRAWEVENT
|
|
346 |
BTraceContext4(BTrace::ERawEvent, BTrace::ESetTipEvent,(TUint32)aTip);
|
|
347 |
#endif
|
|
348 |
}
|
|
349 |
|
|
350 |
IMPORT_C void Set(TType aType,TInt aScanCode);
|
|
351 |
IMPORT_C void Set(TType aType,TInt aX,TInt aY);
|
|
352 |
IMPORT_C void Set(TType aType);
|
|
353 |
|
|
354 |
IMPORT_C void Set(TType aType,TInt aX,TInt aY,TInt aZ);
|
|
355 |
IMPORT_C void Set(TType aType,TInt aX,TInt aY,TInt aZ,TInt aPhi,TInt aTheta,TInt aAlpha);
|
|
356 |
|
|
357 |
IMPORT_C void SetTilt(TType aType,TInt aPhi,TInt aTheta);
|
|
358 |
IMPORT_C void SetRotation(TType aType,TInt aAlpha);
|
|
359 |
IMPORT_C void SetRepeat(TType aType,TInt aScanCode,TInt aRepeats);
|
|
360 |
|
|
361 |
/**
|
|
362 |
@return the pointer number of the the event
|
|
363 |
*/
|
|
364 |
inline TUint8 PointerNumber() const
|
|
365 |
{
|
|
366 |
return iPointerNumber;
|
|
367 |
}
|
|
368 |
|
|
369 |
|
|
370 |
/**
|
|
371 |
The pointer number for the event is set
|
|
372 |
The pointer number should be more or equal 0 and should be less than HALData::EPointerMaxPointers,
|
|
373 |
otherwise WSERV would ignore the event,ie 0 <= aPointerNumber < HALData::EPointerMaxPointers
|
|
374 |
@param aPointerNumber
|
|
375 |
Error conditions: None.
|
|
376 |
*/
|
|
377 |
inline void SetPointerNumber(const TUint8 aPointerNumber)
|
|
378 |
{
|
|
379 |
iPointerNumber=aPointerNumber;
|
|
380 |
#ifdef BTRACE_TRAWEVENT
|
|
381 |
BTraceContext4(BTrace::ERawEvent, BTrace::ESetPointerNumberEvent,(TUint32)aPointerNumber);
|
|
382 |
#endif
|
|
383 |
}
|
|
384 |
|
|
385 |
/**
|
|
386 |
Initialises the event with the supplied information
|
|
387 |
@param aType The event type.
|
|
388 |
@param aX The X position.
|
|
389 |
@param aY The Y position.
|
|
390 |
@param aZ The Z position.
|
|
391 |
@param aPointerNumber The pointer number for the event
|
|
392 |
*/
|
|
393 |
IMPORT_C void Set (TType aType, TInt aX, TInt aY, TInt aZ, TUint8 aPointerNumber);
|
|
394 |
|
|
395 |
protected:
|
|
396 |
TUint8 iType;
|
|
397 |
TUint8 iTip; /**< Indicates whether the tip or head of pointing device is closer to screen.*/
|
|
398 |
TUint8 iPointerNumber; //
|
|
399 |
TUint8 iDeviceNumber;
|
|
400 |
TUint iTicks;
|
|
401 |
union
|
|
402 |
{
|
|
403 |
struct {TInt x;TInt y;} pos;
|
|
404 |
struct {TInt x;TInt y;TInt z;TInt phi;TInt theta;TInt alpha;} pos3D;
|
|
405 |
struct {TInt scanCode;TInt repeats;} key;
|
|
406 |
TInt modifiers;
|
|
407 |
} iU;
|
|
408 |
};
|
|
409 |
|
|
410 |
|
|
411 |
|
|
412 |
|
|
413 |
/**
|
|
414 |
@publishedAll
|
|
415 |
@released
|
|
416 |
|
|
417 |
Encapsulates a hardware event object as a descriptor (package buffer) for
|
|
418 |
the purpose of data transfer.
|
|
419 |
*/
|
|
420 |
class TRawEventBuf : public TPckgBuf<TRawEvent>
|
|
421 |
{
|
|
422 |
public:
|
|
423 |
|
|
424 |
/**
|
|
425 |
Gets the hardware event object from the package buffer.
|
|
426 |
|
|
427 |
@return The hardware event object.
|
|
428 |
*/
|
|
429 |
inline TRawEvent &Event() const {return(*((TRawEvent *)&iBuf[0]));}
|
|
430 |
};
|
|
431 |
|
|
432 |
#ifndef SYMBIAN_ENABLE_SPLIT_HEADERS
|
|
433 |
#include <e32event_private.h>
|
|
434 |
#endif
|
|
435 |
|
|
436 |
#endif
|
|
437 |
|