bluetoothengine/bthid/keyboard/inc/keyboard.h
branchRCL_3
changeset 39 5a89845f78e2
parent 16 b23265fb36da
child 53 eede1356aa52
equal deleted inserted replaced
35:95674584745d 39:5a89845f78e2
    20 #define __KEYBOARD_H
    20 #define __KEYBOARD_H
    21 
    21 
    22 #include <e32std.h>
    22 #include <e32std.h>
    23 #include <w32std.h>
    23 #include <w32std.h>
    24 #include <e32event.h>
    24 #include <e32event.h>
       
    25 //#include <aknkeylock.h>
    25 
    26 
    26 #include "hidinterfaces.h"
    27 #include "hidinterfaces.h"
    27 #include "hidkeys.h"
    28 #include "hidkeys.h"
    28 #include "layoutmgr.h"
    29 #include "layoutmgr.h"
    29 #include "timeoutnotifier.h"
    30 #include "timeoutnotifier.h"
    30 #include <e32msgqueue.h>
       
    31 #include <e32cmn.h>
       
    32 #include "pointmsgqueue.h"
       
    33 #include "bthidsettings.h"
    31 #include "bthidsettings.h"
    34 
    32 
    35 class CField;
    33 class CField;
    36 class CHidKeyboardDriver;
    34 class CHidKeyboardDriver;
    37 class CTimeOutTimer;
    35 class CTimeOutTimer;
    65         EMediaKeys = 2,
    63         EMediaKeys = 2,
    66         EPowerKeys = 3,
    64         EPowerKeys = 3,
    67         KNumInputFieldTypes
    65         KNumInputFieldTypes
    68         };
    66         };
    69 
    67 
    70     // The types of keyboard input report fields that we handle:
       
    71     enum TMouseFieldType
       
    72         {
       
    73         EMouseButtons = 0,
       
    74         EMouseXY = 1,
       
    75         EMouseWheel = 2,
       
    76         EMouseMediaKeys = 3,
       
    77         EMousePowerKeys = 4,
       
    78         KMouseInputFieldTypes
       
    79         };
       
    80 public:
    68 public:
    81     // Constructors and destructor
    69     // Constructors and destructor
    82     /*!
    70     /*!
    83      Creates an instantiated CHidKeyboardDriver object.
    71      Creates an instantiated CHidKeyboardDriver object.
    84      @param aHid The generic HID layer that requested the driver
    72      @param aHid The generic HID layer that requested the driver
   208     inline void KeyUp(TInt aHidKey, TInt aUsagePage);
   196     inline void KeyUp(TInt aHidKey, TInt aUsagePage);
   209     inline void KeyDown(TInt aHidKey, TInt aUsagePage);
   197     inline void KeyDown(TInt aHidKey, TInt aUsagePage);
   210 
   198 
   211     // Handles the states of the modifier keys
   199     // Handles the states of the modifier keys
   212     void UpdateModifiers(TInt aFieldIndex, const TDesC8& aReport);
   200     void UpdateModifiers(TInt aFieldIndex, const TDesC8& aReport);
   213     // Handles the states of the XY (mouse up, down, left, right)
       
   214     void UpdateXY(TInt aFieldIndex, const TDesC8& aReport);
       
   215 
       
   216     // Handles the states of the Buttons (left & right button)
       
   217     void UpdateButtons(TInt aFieldIndex, const TDesC8& aReport);
       
   218 
       
   219     // Handles the states of the wheel
       
   220     void UpdateWheel(TInt aFieldIndex, const TDesC8& aReport);
       
   221 
   201 
   222     // Handle key presses
   202     // Handle key presses
   223     void ProcessKeys(TInt aFieldIndex, const TDesC8& aReport);
   203     void ProcessKeys(TInt aFieldIndex, const TDesC8& aReport);
   224 
   204 
   225     // Determines whether too many keys have been pressed on the device
   205     // Determines whether too many keys have been pressed on the device
   263      * @param aAppUid Application UID
   243      * @param aAppUid Application UID
   264      */
   244      */
   265     void LaunchApplicationL(TInt aAppUid);
   245     void LaunchApplicationL(TInt aAppUid);
   266 
   246 
   267     // Checks if multimedia-key (play,stop,..) and sends to RemCon
   247     // Checks if multimedia-key (play,stop,..) and sends to RemCon
   268     TBool HandleMultimediaKeys(TUint16 aScancodeKey, TBool aIsKeyDown,
   248     TBool HandleKeyMapping(TDecodedKeyInfo& aKey, TBool aIsKeyDown,
   269             TUint8 aModifiers);
   249             TUint8 aModifiers);
   270     TBool HandleMultimediaKeysForNokia(TUint16 aScancodeKey,
   250     TBool HandleKeyMappingUp(TDecodedKeyInfo& aKey, TBool aIsKeyDown,
   271             TBool aIsKeyDown, TUint8 aModifiers);
   251             TUint8 aModifiers);
   272     TBool HandleMultimediaKeysForStandard(TUint16 aScancodeKey,
   252     TBool HandleKeyMappingDown(TDecodedKeyInfo& aKey, TBool aIsKeyDown,
   273             TBool aIsKeyDown, TUint8 aModifiers);
   253             TUint8 aModifiers);
       
   254     TBool HandleKeyMappingLeft(TDecodedKeyInfo& aKey, TBool aIsKeyDown,
       
   255             TUint8 aModifiers);
       
   256     TBool HandleKeyMappingRight(TDecodedKeyInfo& aKey, TBool aIsKeyDown,
       
   257             TUint8 aModifiers);
       
   258     TBool HandleKeyMappingOther(TDecodedKeyInfo& aKey, TBool aIsKeyDown,
       
   259             TUint8 aModifiers);
   274 
   260 
   275     TInt AppMenuId();
   261     TInt AppMenuId();
   276     TInt PhoneAppId();
   262     TInt PhoneAppId();
   277     TInt IdleAppId();
   263     TInt IdleAppId();
   278     TBool IsApplicationMenuTopMost();
   264     TBool IsApplicationMenuTopMost();
   279     TBool IsPhoneAppTopMost();
   265     TBool IsPhoneAppTopMost();
   280 
   266 
   281     // bitmap for Multimedia key states
   267     // bitmap for Multimedia key states
   282     enum TMmKeyDown
   268     enum TMmKeyDown
   283         {
   269         {
   284         EVolUp = 1,
   270         ENone       = 0x00,
   285         EVolDown = 2,
   271         EVolUp      = 0x01,
   286         EPlay = 4,
   272         EVolDown    = 0x02,
   287         EStop = 8,
   273         EPlay       = 0x04,
   288         ENext = 16,
   274         EStop       = 0x08,
   289         EPrev = 32
   275         ENext       = 0x10,
       
   276         EPrev       = 0x20,
       
   277         };
       
   278     
       
   279     // bitmap for navigation keys
       
   280     enum TNavKeyDown
       
   281         {
       
   282         ELsk        = 0x01,
       
   283         ERsk        = 0x02,
       
   284         ESend       = 0x04,
       
   285         EEnd        = 0x08,
       
   286         EEsc        = 0x10
   290         };
   287         };
   291 
   288 
   292     void ResetBitmap(TBool aIsKeyDown, TMmKeyDown aBitmapToReset);
   289     void ResetBitmap(TBool aIsKeyDown, TMmKeyDown aBitmapToReset);
   293 
   290 
   294     /**
   291     /**
   300     TInt SendRawEvent(TInt aScancode, TBool aIsKeyDown, TUint aModifier);
   297     TInt SendRawEvent(TInt aScancode, TBool aIsKeyDown, TUint aModifier);
   301 
   298 
   302     // ----------------------------------------
   299     // ----------------------------------------
   303 
   300 
   304     static TInt ResetArrayToSize(RArray<TInt>& aArray, TInt aSize);
   301     static TInt ResetArrayToSize(RArray<TInt>& aArray, TInt aSize);
   305     void MoveCursor(const TPoint& aPoint);
       
   306     TInt PostPointer(const TPoint& aPoint);
       
   307     TInt SendButtonEvent(TBool aButtonDown);
       
   308 
   302 
   309     TBool IsDigitKey(TInt aScanCode);
   303     TBool IsDigitKey(TInt aScanCode);
   310     TBool IsSpecialHandleKey(TInt aUniCode);
   304     TBool IsSpecialHandleKey(TInt aUniCode);
   311 
   305 
   312     void LaunchApplicationL(const TDesC& aName);
       
   313     
       
   314     //Redraw cursor
       
   315     void CursorRedraw();
       
   316 private:
   306 private:
   317 
   307 
   318     TKeyboardDriverState iDriverState;
   308     TKeyboardDriverState iDriverState;
   319 
   309 
   320     // Application UIDs
   310     // Application UIDs
   331 
   321 
   332     // Pointers to the fields in the report descriptor containing the
   322     // Pointers to the fields in the report descriptor containing the
   333     // various types of key:
   323     // various types of key:
   334     const CField* iField[KNumInputFieldTypes];
   324     const CField* iField[KNumInputFieldTypes];
   335 
   325 
   336     // Pointers to the fields in the report descriptor containing the
       
   337     // various types of key:
       
   338     const CField* iMouseField[KMouseInputFieldTypes];
       
   339     // Pointer to the field in the report descriptor containing the LEDs:
   326     // Pointer to the field in the report descriptor containing the LEDs:
   340     const CField* iLedField;
   327     const CField* iLedField;
   341 
   328 
   342     // The current modifier state
   329     // The current modifier state
   343     TUint8 iModifiers;
   330     TUint8 iModifiers;
   369 
   356 
   370     CHidInputDataHandlingReg* iInputHandlingReg;
   357     CHidInputDataHandlingReg* iInputHandlingReg;
   371 
   358 
   372     // This timer stops key repeating after defined time to prevent endless key repeats in error cases. Fix for EMKD-7FBB9H
   359     // This timer stops key repeating after defined time to prevent endless key repeats in error cases. Fix for EMKD-7FBB9H
   373     CTimeOutTimer* iRepeatEndTimer;
   360     CTimeOutTimer* iRepeatEndTimer;
   374 
   361     
   375     TBool iComboDevice;
   362     TUint8 iNavKeyDown;
   376 
   363 //    RAknKeyLock iKeyLock;
   377     RMsgQueue<TPointBuffer> iPointBufQueue;
       
   378     TPointBuffer iPointerBuffer;
       
   379     TBool iButtonDown;
       
   380     TBool iButton2Down;
       
   381     };
   364     };
   382 
   365 
   383 // ----------------------------------------------------------------------
   366 // ----------------------------------------------------------------------
   384 // Helpers for sending key events:
   367 // Helpers for sending key events:
   385 
   368