Keyboard/keyboard_chipset_api.h
changeset 0 bb4b476bbb96
equal deleted inserted replaced
-1:000000000000 0:bb4b476bbb96
       
     1 /*
       
     2   keyboard_chipset_api.h
       
     3 
       
     4   Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
       
     5   All rights reserved.
       
     6 
       
     7   This program and the accompanying materials are made available 
       
     8   under the terms of the Eclipse Public License v1.0 which accompanies 
       
     9   this distribution, and is available at 
       
    10   http://www.eclipse.org/legal/epl-v10.html
       
    11 
       
    12   Initial Contributors:
       
    13   Nokia Corporation - initial contribution.
       
    14 
       
    15   Contributors:
       
    16 */
       
    17 
       
    18 /** @file
       
    19 @brief Keyboard Chipset API H
       
    20 
       
    21 This is the header file for Keyboard Chipset API that is used to access 
       
    22 the matrix keyboard and power key services provided by the third party chipset vendors.
       
    23 
       
    24 @publishedDeviceAbstraction
       
    25 */
       
    26 
       
    27 #ifndef __KEYBOARD_CHIPSET_API_H__
       
    28 #define __KEYBOARD_CHIPSET_API_H__
       
    29 
       
    30 
       
    31 // Include files
       
    32 
       
    33 #include <kern_priv.h>
       
    34 #include <e32event.h>
       
    35 
       
    36 
       
    37 // Constants
       
    38 
       
    39 
       
    40 // Macros
       
    41 
       
    42 
       
    43 // Data types
       
    44 
       
    45 /**
       
    46 This defines the type of a callback function which is called to 
       
    47 notify a new key event to the client. The callback function is 
       
    48 executed in the context of the calling thread.
       
    49 */
       
    50 typedef void (*TKeyboardEventCbFn)();
       
    51 
       
    52 // Function prototypes
       
    53 
       
    54 // Forward declarations
       
    55 
       
    56 // Class declaration
       
    57 
       
    58 /**
       
    59 This class defines the Chipset API that is used to access 
       
    60 the matrix keyboard service provided by the third party chipset vendors.
       
    61 */
       
    62 class KeyboardMatrix
       
    63     {
       
    64     public:
       
    65 
       
    66         /**
       
    67         This function is used to do the necessary initialization with the given matrix size 
       
    68         so that the chipset is ready to provide the matrix keyboard service. It registers 
       
    69 		a callback function which is called to notify a new key event.
       
    70 
       
    71         @param aSize The size of matrix keyboard that the client is using.
       
    72         @param aCallback The callback function which is called to notify a new key event.
       
    73 
       
    74         @return Symbian OS system wide error code, and the followings are required:
       
    75                 KErrNone – the operation is successfully executed;
       
    76                 KErrGeneral – error condition;
       
    77 
       
    78         @pre Pre-condition, it should be called before the other methods in the class are used.
       
    79         */
       
    80         IMPORT_C static TInt Init(TUint aSize, TKeyboardEventCbFn aCallback);
       
    81 
       
    82         /**
       
    83         This function is used to enable the matrix keyboard service.  
       
    84 
       
    85         @return Symbian OS system wide error code, and the followings are required:
       
    86                 KErrNone – the operation is successfully executed;
       
    87                 KErrGeneral – error condition;
       
    88 
       
    89         @pre Pre-condition, the matrix keyboard service has been initialized successfully.
       
    90         */
       
    91         IMPORT_C static TInt Enable();
       
    92 
       
    93         /**
       
    94         This function is used to disable the matrix keyboard service.
       
    95 
       
    96         @return Symbian OS system wide error code, and the followings are required:
       
    97                 KErrNone – the operation is successfully executed;
       
    98                 KErrGeneral – error condition;
       
    99 
       
   100         @pre Pre-condition, the matrix keyboard service has been enabled.
       
   101         */
       
   102         IMPORT_C static TInt Disable();
       
   103 
       
   104         /**
       
   105         This function is used to read the key state of the matrix keyboard.
       
   106 
       
   107         @param aKeys   Reference to the number of keys that are currently pressed. 
       
   108                        If the return value is 0 then it means all the previously pressed keys are released.
       
   109         @param aBuffer Pointer to the buffer where all the key presses shall be reported.
       
   110 
       
   111         @return Symbian OS system wide error code, and the followings are required:
       
   112 				KErrNone – the operation is successfully executed;
       
   113                 KErrGeneral – error condition;
       
   114 
       
   115         @pre Pre-condition, the matrix keyboard service has been enabled.
       
   116         */
       
   117         IMPORT_C static TInt Read(TInt& aKeys, TInt* aBuffer);
       
   118 
       
   119     };
       
   120 
       
   121 
       
   122 /**
       
   123 This class defines the Chipset API that is used to access 
       
   124 the power key service provided by the third party chipset vendors.
       
   125 */
       
   126 class KeyboardPowerKey
       
   127     {
       
   128     public:
       
   129 
       
   130         /**
       
   131         This function is used to do the necessary initialization so that 
       
   132         the chipset is ready to provide the power key service. It registers 
       
   133         a callback function which is called to notify a new power key event.
       
   134 
       
   135         @param aCallback The callback function which is called to notify a new power key event.
       
   136 
       
   137         @return Symbian OS system wide error code, and the followings are required:
       
   138                 KErrNone – the operation is successfully executed;
       
   139                 KErrGeneral – error condition;
       
   140         */
       
   141         IMPORT_C static TInt Init(TKeyboardEventCbFn aCallback);
       
   142 
       
   143         /**
       
   144         This function is used to read the key state of the power key.
       
   145 
       
   146         @param aState Reference to the variable that contains the power key state.
       
   147 
       
   148         @return Symbian OS system wide error code, and the followings are required:
       
   149                 KErrNone – the operation is successfully executed;
       
   150                 KErrGeneral – error condition;
       
   151         */
       
   152         IMPORT_C static TInt Read(TRawEvent::TType& aState);
       
   153 
       
   154     };
       
   155 
       
   156 #endif // __KEYBOARD_CHIPSET_API_H__