bluetoothengine/bthid/layouts/src/su8russian.cpp
changeset 0 f63038272f30
equal deleted inserted replaced
-1:000000000000 0:f63038272f30
       
     1 /*
       
     2 * Copyright (c) 2008 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:  This is the implementation of application class
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "su8russian.h"
       
    20 #include "hiddebug.h"
       
    21 #include "hidlayoutids.h"
       
    22 
       
    23 // CONSTANTS
       
    24 
       
    25 // Look-up tables to translate HID keyboard usage codes (usage page 7)
       
    26 // to the corresponding Symbian "TKeyCode" (Unicode) values:
       
    27 
       
    28 const TInt CSu8RussianLayout::KColumnMap[] =
       
    29     {
       
    30     THidModifier::EUnmodified,  // ----
       
    31     THidModifier::EShift        // ---S
       
    32     };
       
    33 
       
    34 const TUint16 CSu8RussianLayout::KKeyCodes[] = 
       
    35     {
       
    36     //----    ---S   // Hex  Dec  Usage name (UK)
       
    37          0,      0,  // 0x00   0  Reserved (no event)
       
    38          0,      0,  // 0x01   1  Rollover error
       
    39          0,      0,  // 0x02   2  POST Fail
       
    40          0,      0,  // 0x03   3  Undefined error
       
    41        0x444,    0x424,  // 0x04   4  a
       
    42        0x438,    0x418,  // 0x05   5  b
       
    43        'c',    'C',  // 0x06   6  c
       
    44        0x432,    0x412,  // 0x07   7  d
       
    45        0x443,    0x423,  // 0x08   8  e
       
    46        0x430,    0x410,  // 0x09   9  f
       
    47        0x43f,    0x41f,  // 0x0a  10  g
       
    48        0x440,    0x420,  // 0x0b  11  h
       
    49        0x448,    0x428,  // 0x0c  12  i
       
    50        0x43e,    0x41e,  // 0x0d  13  j
       
    51        0x43b,    0x41b,  // 0x0e  14  k
       
    52        0x434,    0x414,  // 0x0f  15  l
       
    53        0x44c,    0x42c,  // 0x10  16  m
       
    54        0x442,    0x422,  // 0x11  17  n
       
    55        0x449,    0x429,  // 0x12  18  o
       
    56        0x437,    0x417,  // 0x13  19  p
       
    57        0x439,    0x419,  // 0x14  20  q
       
    58        0x43a,    0x41a,  // 0x15  21  r
       
    59        0x44b,    0x42b,  // 0x16  22  s
       
    60        0x435,    0x415,  // 0x17  23  t
       
    61        0x433,    0x413,  // 0x18  24  u
       
    62        0x43c,    0x41c,  // 0x19  25  v
       
    63        0x446,    0x426,  // 0x1a  26  w
       
    64        0x447,    0x427,  // 0x1b  27  x
       
    65        0x43d,    0x41d,  // 0x1c  28  y
       
    66        0x44f,    0x42f,  // 0x1d  29  z
       
    67        '1',    '!',  // 0x1e  30  1
       
    68        '2',    '@',  // 0x1f  31  2
       
    69        '3',    '#',  // 0x20  32  3
       
    70        '4',    '$',  // 0x21  33  4
       
    71        '5',    '%',  // 0x22  34  5
       
    72        '6',    '^',  // 0x23  35  6
       
    73        '7',    '&',  // 0x24  36  7
       
    74        '8',    '*',  // 0x25  37  8
       
    75        '9',    '(',  // 0x26  38  9
       
    76        '0',    ')',  // 0x27  39  0
       
    77     0x000d, 0xf845,  // 0x28  40  Enter
       
    78     0x001b, 0x001b,  // 0x29  41  Escape
       
    79     0x0008, 0x0008,  // 0x2a  42  Backspace
       
    80     0x0009, 0x0009,  // 0x2b  43  Tab
       
    81        ' ',    ' ',  // 0x2c  44  Space
       
    82        '-',    '_',  // 0x2d  45
       
    83        '=',    '+',  // 0x2e  46
       
    84        0x445,    0x425,  // 0x2f  47
       
    85        0x44a,    0x42a,  // 0x30  48
       
    86       '\\',    '|',  // 0x31  49
       
    87          0,      0,  // 0x32  50
       
    88        0x436,    0x416,  // 0x33  51
       
    89        0x44d,    0x42d,  // 0x34  52
       
    90        0x451,    0x401,  // 0x35  53
       
    91        0x431,    0x411,  // 0x36  54
       
    92        0x44e,    0x42e,  // 0x37  55
       
    93        '/',    '?'   // 0x38  56
       
    94     };
       
    95 
       
    96 // ----------------------------------------------------------------------
       
    97 
       
    98 const CStandardKeyboardLayout::TSpecialKey 
       
    99     CSu8RussianLayout::KSpecialCases[] =
       
   100     {
       
   101     // HID usage, modifiers, Unicode
       
   102     { 0x28, THidModifier::ECtrl,       0xf845 }, // Ctrl-enter (Return)
       
   103     { 0x2c, THidModifier::ECtrl,       0x0020 }, // Ctrl-spacebar
       
   104     { 0x2b, THidModifier::EAlt,        0xf852 }, // Alt-tab
       
   105     { 0x4c, THidModifier::EUnmodified, 0x007f }, // Delete
       
   106     { 0x4c, THidModifier::EShift,      0x007f }, // Shift-Delete
       
   107     { 0x4c, THidModifier::EAltCtrl,    0xf844 }, // Alt-ctrl-delete
       
   108     { 0x4f, THidModifier::EUnmodified, 0xf808 }, // Right arrow
       
   109     { 0x4f, THidModifier::EShift,      0xf808 }, // Shift-right arrow
       
   110     { 0x50, THidModifier::EUnmodified, 0xf807 }, // Left arrow
       
   111     { 0x50, THidModifier::EShift,      0xf807 }, // Shift-left arrow
       
   112     { 0x51, THidModifier::EUnmodified, 0xf80a }, // Down arrow
       
   113     { 0x51, THidModifier::EShift,      0xf80a }, // Shift-down arrow
       
   114     { 0x52, THidModifier::EUnmodified, 0xf809 }, // Up arrow
       
   115     { 0x52, THidModifier::EShift,      0xf809 }, // Shift-up arrow
       
   116     { 0xe3, THidModifier::EFunc,       0xf842 }, // Left GUI key
       
   117     { 0xe7, THidModifier::EFunc,       0xf843 }, // Right GUI key
       
   118     { 0xe3, THidModifier::EFuncShift,  0xf862 }, // Shift-left GUI key
       
   119     { 0xe7, THidModifier::EFuncShift,  0xf863 }, // Shift-right GUI key
       
   120     { 0x76, THidModifier::EUnmodified, 0xf852 }, // App switch
       
   121     { 0x76, THidModifier::EShift,      0xf852 }, // Shift-app switch
       
   122     { 0x77, THidModifier::EUnmodified, 0xf845 }, // MSK to OK
       
   123     { 0x77, THidModifier::EShift,      0xf845 }, // Shift-MSK to OK
       
   124     //
       
   125     { 0x00 } // end of table
       
   126     };
       
   127 
       
   128 // ----------------------------------------------------------------------
       
   129 
       
   130 CSu8RussianLayout::CSu8RussianLayout()
       
   131     : CStandardKeyboardLayout(KColumnMap, sizeof (KColumnMap),
       
   132         KKeyCodes, sizeof (KKeyCodes), KSpecialCases)
       
   133     {
       
   134     // nothing else to do
       
   135     }
       
   136 
       
   137 // ----------------------------------------------------------------------
       
   138 
       
   139 TInt CSu8RussianLayout::RawScanCode(TInt aHidKey, 
       
   140     TInt aUsagePage, THidModifier aModifiers) const
       
   141     {
       
   142     TInt result = EStdKeyNull;
       
   143 
       
   144     const TInt KKeyboardUsagePage = 0x07;
       
   145     if (aUsagePage == KKeyboardUsagePage)
       
   146         {
       
   147         // Application switch key is HID "Keyboard Menu" usage:
       
   148         //
       
   149         const TInt KHidKeyboardMenu = 0x76;
       
   150         if (aHidKey == KHidKeyboardMenu)
       
   151             {
       
   152             result = EStdKeyApplication0;
       
   153             }
       
   154         
       
   155         // Middle soft key is HID "Keyboard Select" usage:
       
   156         //
       
   157         const TInt KHidKeyboardSelect = 0x77;
       
   158         if (aHidKey == KHidKeyboardSelect)
       
   159             {
       
   160             result = EStdKeyDevice3;
       
   161             }
       
   162         }
       
   163     
       
   164     if (result == EStdKeyNull)
       
   165         {
       
   166         result = CStandardKeyboardLayout::RawScanCode(aHidKey,
       
   167             aUsagePage, aModifiers);
       
   168         }
       
   169     
       
   170     return result;
       
   171     }
       
   172 
       
   173 TInt CSu8RussianLayout::LayoutId() const
       
   174     {
       
   175     DBG(RDebug::Print(_L("[HID]\tCSu8RussianLayout::LayoutId()")));
       
   176     return ESu8Russian;
       
   177     }
       
   178 
       
   179 CKeyboardLayout* CSu8RussianLayout::NewL()
       
   180     {
       
   181     DBG(RDebug::Print(_L("[HID]\tCSu8RussianLayout::NewL()")));
       
   182     CKeyboardLayout* layout = new (ELeave) CSu8RussianLayout;
       
   183     return layout;
       
   184     }
       
   185 
       
   186 // End of file
       
   187