Resources | developer.brewmp.com Resources | developer.brewmp.com

Developer

resources

Standardizing key events

To standardize key events, follow these steps:

  1. All extended keys, including alphabet keys, special symbols, and modifiers such as the SHIFT key, generate EVT_KEY_PRESS, EVT_KEY, and EVT_KEY_RELEASE events.
  2. New virtual key codes from AVK_A to AVK_Z are defined for alphabet keys from A to Z. The key codes have a numeric value equal to the Unicode value of the corresponding lower case letter. For example, AVK_A has the value 97 decimal, which is the Unicode value for lowercase "a" character.
  3. Alphabet keys from A to Z generate EVT_KEY events with wParam equal to the Unicode value of the lower case letter. As an example, pressing the Q key generates EVT_KEY_PRESS, EVT_KEY, EVT_KEY_RELEASE events with wParam of AVK_Q (or 113 decimal).
  4. OEMs should not interpret key code combinations – combinations always send EVT_KEY events with the same wParam where the dwParam contains the modifier value. This means that if the user presses SHIFT and A together, the OEM sends EVT_KEY events with wParam still equal to the Unicode value of lowercase "a" (AVK_A , or 97 decimal), and dwParam equal to KB_LSHIFT or KB_RSHIFT, as appropriate.
  5. Extra modifiers, KB_SYMBOL, KB_FUNCTION, are defined to support the SYMBOL and FUNCTION keys. These keys are often used to overload extended keys. For example, pressing [Symbol] + [A] can mean the character #.

To support this standardization, OEMs are expected to call AEE_Event, using the correct values of wParam and dwParam, depending on the key(s) pressed. OEMs should check the key modifier state (such as the Shift key state), and send the state data together with the key value to Brew MP. For example, if the user presses [Shift] + [A], this sample sequence of calls is expected:

/* User pressed left SHIFT */
AEE_Event(EVT_KEY_PRESS, AVK_LSHIFT, 0);
AEE_Event(EVT_KEY, AVK_LSHIFT, 0);

/* User pressed A (and is still holding SHIFT) */
AEE_Event(EVT_KEY_PRESS, AVK_A, KB_LSHIFT);
AEE_Event(EVT_KEY, AVK_A, KB_LSHIFT);

/* User released A */
AEE_Event(EVT_KEY_RELEASE, AVK_A, KB_LSHIFT);

/* User released left SHIFT */
AEE_Event(EVT_KEY_RELEASE, AVK_LSHIFT, 0);