Architecture

This topic describes the architecture of keyboard drivers and related components on Symbian platform.

There are five components involved in this process:

  • The keyboard hardware.

  • A keyboard device driver.

    The keyboard driver is implemented as a standard kernel extension, and is loaded by the kernel at boot time. A keyboard driver must be implemented in the base port, and has no platform independent parts.

  • A keyboard mapping DLL.

    A keyboard mapping DLL provides a set of lookup tables that map codes for the hardware keys to standard logical keycodes that user-side applications can process.

    The DLL is platform specific. It must be implemented in the base port, and has no platform independent parts. It is usually called ekdata.dll.

  • The Window Server.

    The Window Server is a system server that manages access to the screen and input devices for user-side programs.

  • The keyboard translator.

    The keyboard translator DLL translates scancodes into keycodes using the data in the platform specific keyboard mapping DLL.

    It is part of Symbian platform generic code and is built as part of the Text Window Server component.

The following diagram shows how these components fit together and gives an overview of the data flow.

Figure 1. Overview of data flow

Depending on the keyboard hardware, key presses in the form of key-down and key-up events are registered by the keyboard driver, either as a result of hardware interrupts, or as a result of polling the hardware. The driver assigns a standard scancode value to the key. This is one of the values defined by the TStdScanCode enum. The value is a representation of the hardware key.

The driver creates TRawEvent objects, of type TRawEvent::EKeyUp and TRawEvent:EKeyDown, and includes the standard scancode value and modifiers as part of the object. These objects are added to the kernel's event queue, using the Kern::AddEvent() function.

The Window Server captures these events and passes the scancode value to ektran.dll, which has the responsibility for translating this value into a keycode value. A keycode value is a logical representation of the key; it is this logical representation that has meaning for the generic Symbian platform. The logical keycode is one of the values defined by the TKeyCode enum. Also, ektran.dll tells the Window Server whether a capture key has been pressed - this is explained in Dynamic Behaviour.

ekdata.dll encapsulates a set of tables that are used to map hardware scancodes to logical keycode values. This is platform specific code, and is used by the generic ektran.dll when doing the translation.