1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/kernelhwsrv/kernel/eka/include/e32event.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,439 @@
1.4 +// Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of the License "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +// e32\include\e32event.h
1.18 +//
1.19 +//
1.20 +
1.21 +#ifndef __E32EVENT_H__
1.22 +#define __E32EVENT_H__
1.23 +#include <e32cmn.h>
1.24 +#ifdef BTRACE_TRAWEVENT
1.25 +#include <e32btrace.h>
1.26 +#endif
1.27 +
1.28 +/**
1.29 +@publishedAll
1.30 +@released
1.31 +*/
1.32 +const TInt KUndefinedDeviceNumber = -1;
1.33 +
1.34 +/**
1.35 +@publishedAll
1.36 +@released
1.37 +
1.38 +Represents a raw hardware event as generated by hardware drivers of
1.39 +a pointer device, a keyboard etc.
1.40 +
1.41 +Raw hardware events are added to the kernel's event queue.
1.42 +*/
1.43 +class TRawEvent
1.44 + {
1.45 +public:
1.46 +
1.47 + /**
1.48 + Defines the event type.
1.49 + */
1.50 + enum TType
1.51 + {
1.52 +
1.53 + /**
1.54 + Represents an uninitialised event object.
1.55 + */
1.56 + ENone,
1.57 +
1.58 + /**
1.59 + A pointer device (e.g. a pen) has moved. Only changes in Cartesian coordinates are tracked.
1.60 + */
1.61 + EPointerMove,
1.62 +
1.63 + /**
1.64 + A switch on event caused by a screen tap using a pointer device.
1.65 + */
1.66 + EPointerSwitchOn,
1.67 +
1.68 + /**
1.69 + Represents a keyboard key down event.
1.70 + */
1.71 + EKeyDown,
1.72 +
1.73 + /**
1.74 + Represents a keyboard key up event.
1.75 + */
1.76 + EKeyUp,
1.77 +
1.78 + /**
1.79 + Represents a redraw event.
1.80 +
1.81 + Typically generated in an emulator environment in response
1.82 + to a host OS redraw event.
1.83 + */
1.84 + ERedraw,
1.85 +
1.86 + /**
1.87 + Represents a device switch on event.
1.88 + */
1.89 + ESwitchOn,
1.90 +
1.91 + /**
1.92 + */
1.93 + EActive,
1.94 +
1.95 + /**
1.96 + */
1.97 + EInactive,
1.98 +
1.99 + /**
1.100 + Represents a modifier key being pressed.
1.101 + */
1.102 + EUpdateModifiers,
1.103 +
1.104 + /**
1.105 + Represents a button down event.
1.106 +
1.107 + This is typically used to represent a pointing device
1.108 + coming into contact with a touch sensitive screen.
1.109 + */
1.110 + EButton1Down,
1.111 +
1.112 + /**
1.113 + Represents a button up event.
1.114 +
1.115 + This is typically used to represent a pointing device
1.116 + being lifted away from a touch sensitive screen.
1.117 + */
1.118 + EButton1Up,
1.119 +
1.120 + /**
1.121 + Represents a button down event.
1.122 +
1.123 + This is typically used to represent a pointing device
1.124 + coming into contact with a touch sensitive screen.
1.125 + */
1.126 + EButton2Down,
1.127 +
1.128 + /**
1.129 + Represents a button up event.
1.130 +
1.131 + This is typically used to represent a pointing device
1.132 + being lifted away from a touch sensitive screen.
1.133 + */
1.134 + EButton2Up,
1.135 +
1.136 + /**
1.137 + Represents a button down event.
1.138 +
1.139 + This is typically used to represent a pointing device
1.140 + coming into contact with a touch sensitive screen.
1.141 + */
1.142 + EButton3Down,
1.143 +
1.144 + /**
1.145 + Represents a button up event.
1.146 +
1.147 + This is typically used to represent a pointing device
1.148 + being lifted away from a touch sensitive screen.
1.149 + */
1.150 + EButton3Up,
1.151 +
1.152 + /**
1.153 + Represents a device switch off event.
1.154 + */
1.155 + ESwitchOff,
1.156 +
1.157 + /**
1.158 + Represents a key being continually pressed event.
1.159 + */
1.160 + EKeyRepeat,
1.161 +
1.162 + /**
1.163 + Represents a case open event.
1.164 +
1.165 + The meaning of a case is hardware specific.
1.166 + */
1.167 + ECaseOpen,
1.168 +
1.169 + /**
1.170 + Represents a case close event.
1.171 +
1.172 + The meaning of a case is hardware specific.
1.173 + */
1.174 + ECaseClose,
1.175 +
1.176 + /**
1.177 + @prototype
1.178 + Represents a 3D pointer entering the detection volume event.
1.179 +
1.180 + This is typically used to represent a pointing device
1.181 + coming into detection range of a sensitive screen.
1.182 + */
1.183 + EPointer3DInRange,
1.184 +
1.185 + /**
1.186 + @prototype
1.187 + Represents a 3D pointer leaving the detection volume event.
1.188 +
1.189 + This is typically used to represent a pointing device
1.190 + leaving the detection range of a sensitive screen.
1.191 + */
1.192 + EPointer3DOutOfRange,
1.193 +
1.194 + /**
1.195 + @prototype
1.196 + Represents a 3D pointer tilt changes only event.
1.197 +
1.198 + This is typically sent by a 3D pointer driver when it detects
1.199 + a change in the pointer's polar coordinates (Theta or Phi).
1.200 + */
1.201 + EPointer3DTilt,
1.202 +
1.203 + /**
1.204 + @prototype
1.205 + Represents a 3D pointer rotation only event.
1.206 +
1.207 + This is typically sent by a 3D pointer driver when it detects
1.208 + a rotation of the pointing device (along ist main axis).
1.209 + */
1.210 + EPointer3DRotation,
1.211 +
1.212 + /**
1.213 + @prototype
1.214 + Represents a general 3D pointer changes event.
1.215 +
1.216 + This is typically sent by a 3D pointer driver when it detects
1.217 + a change in the pointer's linear and/or polar coordinates and/or rotation.
1.218 + */
1.219 + EPointer3DTiltAndMove,
1.220 +
1.221 + /**
1.222 + @prototype
1.223 + Reserved for a 3D pointing device button down event.
1.224 + */
1.225 + EButton4Down,
1.226 +
1.227 + /**
1.228 + @prototype
1.229 + Reserved for a 3D pointing device button up event.
1.230 + */
1.231 + EButton4Up,
1.232 +
1.233 + /**
1.234 + @prototype
1.235 + Reserved for a 3D pointing device button down event.
1.236 + */
1.237 + EButton5Down,
1.238 +
1.239 + /**
1.240 + @prototype
1.241 + Reserved for a 3D pointing device button up event.
1.242 + */
1.243 + EButton5Up,
1.244 +
1.245 + /**
1.246 + @prototype
1.247 + Reserved for a 3D pointing device button down event.
1.248 + */
1.249 + EButton6Down,
1.250 +
1.251 + /**
1.252 + @prototype
1.253 + Reserved for a 3D pointing device button up event.
1.254 + */
1.255 + EButton6Up,
1.256 +
1.257 + /**
1.258 + Represents a device restart event.
1.259 + */
1.260 + ERestartSystem
1.261 + };
1.262 +public:
1.263 +
1.264 + /**
1.265 + Default constructor
1.266 + */
1.267 + inline TRawEvent()
1.268 + { *(TInt*)&iType=0; }
1.269 +
1.270 + /**
1.271 + Gets the event type
1.272 +
1.273 + @return The event type.
1.274 + */
1.275 + inline TType Type() const
1.276 + {return TType(iType);}
1.277 +
1.278 + /**
1.279 + Gets the device number (eg. screen number)
1.280 +
1.281 + @return The device number.
1.282 + */
1.283 + inline TInt DeviceNumber() const
1.284 + {return TInt(iDeviceNumber-1);}
1.285 +
1.286 + /**
1.287 + Sets the device number (eg. screen number)
1.288 +
1.289 + @param aDeviceNumber The device number
1.290 + */
1.291 + inline void SetDeviceNumber(TInt aDeviceNumber)
1.292 + {iDeviceNumber = TUint8(aDeviceNumber+1);}
1.293 +
1.294 + IMPORT_C TPoint Pos() const;
1.295 + IMPORT_C TInt ScanCode() const;
1.296 + IMPORT_C TInt Modifiers() const;
1.297 + IMPORT_C TInt Repeats() const;
1.298 +
1.299 + /**
1.300 + Gets the Cartesian coordinates of the 3D pointer end that is closer to the screen.
1.301 +
1.302 + @return The Cartesian coordinates of the point defined by the end of the 3D pointing device that is closer to the screen.
1.303 + */
1.304 + IMPORT_C TPoint3D Pos3D() const;
1.305 +
1.306 +
1.307 + /**
1.308 + Gets the angular spherical polar coordinates of the 3D pointer end that is closer to the screen.
1.309 +
1.310 + @return The angular spherical polar coordinates of the point defined by the end of the 3D pointing device that is closer to the screen.
1.311 + @see TAngle3D
1.312 + */
1.313 + IMPORT_C TAngle3D Tilt() const;
1.314 +
1.315 + /**
1.316 + Gets the rotation angle of 3D pointing device.
1.317 +
1.318 + Some 3D pointing devices support information regarding the angle formed between the physical and magnetical poles,
1.319 + as obtaining when rotating the pen along its main axis.
1.320 +
1.321 + @return The rotation angle of the 3D pointing device.
1.322 + */
1.323 + IMPORT_C TInt Rotation() const;
1.324 +
1.325 + /**
1.326 + Gets the tick count value associated with the event.
1.327 +
1.328 + Note that the interval between tick counts is
1.329 + hardware dependent.
1.330 +
1.331 + @return The tick count value
1.332 + */
1.333 + inline TUint Ticks() const
1.334 + {return iTicks;}
1.335 + /**
1.336 + Gets the information on which end of the pointing device is closer to the screen
1.337 +
1.338 + @return A Boolean indicating which end of the pointing device is closer to the screen.
1.339 + */
1.340 + inline TBool IsTip() const
1.341 + {return TBool(iTip);}
1.342 +
1.343 + /**
1.344 + Sets the information on which end of the pointing device is closer to the screen
1.345 +
1.346 + @param aTip A Boolean indicating which end of the pointing device is closer to the screen.
1.347 + */
1.348 + inline void SetTip(TBool aTip)
1.349 + {iTip = TUint8(aTip);
1.350 +#ifdef BTRACE_TRAWEVENT
1.351 + BTraceContext4(BTrace::ERawEvent, BTrace::ESetTipEvent,(TUint32)aTip);
1.352 +#endif
1.353 + }
1.354 +
1.355 + IMPORT_C void Set(TType aType,TInt aScanCode);
1.356 + IMPORT_C void Set(TType aType,TInt aX,TInt aY);
1.357 + IMPORT_C void Set(TType aType);
1.358 +
1.359 + IMPORT_C void Set(TType aType,TInt aX,TInt aY,TInt aZ);
1.360 + IMPORT_C void Set(TType aType,TInt aX,TInt aY,TInt aZ,TInt aPhi,TInt aTheta,TInt aAlpha);
1.361 +
1.362 + IMPORT_C void SetTilt(TType aType,TInt aPhi,TInt aTheta);
1.363 + IMPORT_C void SetRotation(TType aType,TInt aAlpha);
1.364 + IMPORT_C void SetRepeat(TType aType,TInt aScanCode,TInt aRepeats);
1.365 +
1.366 + /**
1.367 + @return the pointer number of the the event
1.368 + */
1.369 + inline TUint8 PointerNumber() const
1.370 + {
1.371 + return iPointerNumber;
1.372 + }
1.373 +
1.374 +
1.375 + /**
1.376 + The pointer number for the event is set
1.377 + The pointer number should be more or equal 0 and should be less than HALData::EPointerMaxPointers,
1.378 + otherwise WSERV would ignore the event,ie 0 <= aPointerNumber < HALData::EPointerMaxPointers
1.379 + @param aPointerNumber
1.380 + Error conditions: None.
1.381 + */
1.382 + inline void SetPointerNumber(const TUint8 aPointerNumber)
1.383 + {
1.384 + iPointerNumber=aPointerNumber;
1.385 +#ifdef BTRACE_TRAWEVENT
1.386 + BTraceContext4(BTrace::ERawEvent, BTrace::ESetPointerNumberEvent,(TUint32)aPointerNumber);
1.387 +#endif
1.388 + }
1.389 +
1.390 + /**
1.391 + Initialises the event with the supplied information
1.392 + @param aType The event type.
1.393 + @param aX The X position.
1.394 + @param aY The Y position.
1.395 + @param aZ The Z position.
1.396 + @param aPointerNumber The pointer number for the event
1.397 + */
1.398 + IMPORT_C void Set (TType aType, TInt aX, TInt aY, TInt aZ, TUint8 aPointerNumber);
1.399 +
1.400 +protected:
1.401 + TUint8 iType;
1.402 + TUint8 iTip; /**< Indicates whether the tip or head of pointing device is closer to screen.*/
1.403 + TUint8 iPointerNumber; //
1.404 + TUint8 iDeviceNumber;
1.405 + TUint iTicks;
1.406 + union
1.407 + {
1.408 + struct {TInt x;TInt y;} pos;
1.409 + struct {TInt x;TInt y;TInt z;TInt phi;TInt theta;TInt alpha;} pos3D;
1.410 + struct {TInt scanCode;TInt repeats;} key;
1.411 + TInt modifiers;
1.412 + } iU;
1.413 + };
1.414 +
1.415 +
1.416 +
1.417 +
1.418 +/**
1.419 +@publishedAll
1.420 +@released
1.421 +
1.422 +Encapsulates a hardware event object as a descriptor (package buffer) for
1.423 +the purpose of data transfer.
1.424 +*/
1.425 +class TRawEventBuf : public TPckgBuf<TRawEvent>
1.426 + {
1.427 +public:
1.428 +
1.429 + /**
1.430 + Gets the hardware event object from the package buffer.
1.431 +
1.432 + @return The hardware event object.
1.433 + */
1.434 + inline TRawEvent &Event() const {return(*((TRawEvent *)&iBuf[0]));}
1.435 + };
1.436 +
1.437 +#ifndef SYMBIAN_ENABLE_SPLIT_HEADERS
1.438 +#include <e32event_private.h>
1.439 +#endif
1.440 +
1.441 +#endif
1.442 +