Unit HIDKEYBOARD
Return to Unit Reference
Description
Ultibo HID Keyboard Consumer unit
This is a consumer for any generic HID keyboard device, it accepts HID application collections in the generic desktop page (HID_PAGE_GENERIC_DESKTOP) with the usage set to keyboard (HID_DESKTOP_KEYBOARD).
The consumer will bind to any keyboard collection that includes at a minimum an input report containing a field that provides keypress data from the keyboard / keypad page (HID_PAGE_KEYBOARD_KEYPAD) and a field providing modifier keys from the same page.
The consumer will also look for an output report containing a field from the LED page (HID_PAGE_LED) and will use this to set the keyboard LEDs if found.
Up to 16 keypresses per report can be accepted (see HID_KEYBOARD_MAX_KEYS) but most keyboards will commonly report up to 6 which is the size defined in the USB HID usage tables for boot mode keyboard reports.
Constants
HID_KEYBOARD_*
HID_KEYBOARD_CONSUMER_NAME = 'HID Keyboard Consumer';
|
Name of HID Keyboard consumer |
HID_KEYBOARD_DESCRIPTION = 'HID Keyboard';
|
Description of HID Keyboard device |
HID_KEYBOARD_MAX_KEYS = 16;
|
Maximum number of keys allowed in any report |
Type definitions
HID keyboard keys
PHIDKeyboardKeys = ^THIDKeyboardKeys;
THIDKeyboardKeys = array[0..HID_KEYBOARD_MAX_KEYS - 1] of Byte;
HID keyboard device
PHIDKeyboardDevice = ^THIDKeyboardDevice;
THIDKeyboardDevice = record
Keyboard Properties | |
Keyboard:TKeyboardDevice;
|
|
HID Properties | |
Collection:PHIDCollection;
|
The HID collection this keyboard is bound to |
Definitions:PHIDDefinition;
|
The input report definitions that can be accepted as keyboard reports |
LEDDefinition:PHIDDefinition;
|
The report definition that corresponds to the LED output |
LastCode:Word;
|
The scan code of the last key pressed |
LastCount:LongWord;
|
The repeat count of the last key pressed |
LastKeys:THIDKeyboardKeys;
|
The keys from the last keyboard report received |
Public variables
None defined
Function declarations
Initialization functions
procedure HIDKeyboardInit;
Note | Called only during system startup |
---|
HID keyboard functions
function HIDKeyboardDeviceControl(Keyboard:PKeyboardDevice; Request:Integer; Argument1:LongWord; var Argument2:LongWord):LongWord;
Note | Not intended to be called directly by applications, use KeyboardDeviceControl instead. |
---|
HID keyboard helper functions
function HIDKeyboardCheckCollection(Collection:PHIDCollection):LongWord;
Note | None documented |
---|
function HIDKeyboardCheckInputDefinition(Definition:PHIDDefinition):LongWord;
Note | None documented |
---|
function HIDKeyboardCheckOutputDefinition(Definition:PHIDDefinition):LongWord;
Note | None documented |
---|
function HIDKeyboardCheckPressed(Keyboard:PHIDKeyboardDevice; ScanCode:Byte):Boolean;
Keyboard | The HID keyboard device to check for |
---|---|
ScanCode | The keyboard scan code to check |
Note | Caller must hold the keyboard lock |
function HIDKeyboardCheckRepeated(Keyboard:PHIDKeyboardDevice; ScanCode:Byte):Boolean;
Keyboard | The HID keyboard device to check for |
---|---|
ScanCode | The keyboard scan code to check |
Note | Caller must hold the keyboard lock |
function HIDKeyboardCheckReleased(Keyboard:PHIDKeyboardDevice; Keys:PHIDKeyboardKeys; ScanCode:Byte):Boolean;
Keyboard | The HID keyboard device to check for |
---|---|
Keys | The HID keyboard keys to compare against (Current) |
ScanCode | The keyboard scan code to check |
Note | Caller must hold the keyboard lock |
function HIDKeyboardDeviceSetLEDs(Keyboard:PHIDKeyboardDevice; LEDs:Byte):LongWord;
Keyboard | The HID keyboard device to set the LEDs for |
---|---|
LEDs | The LED state to set (eg KEYBOARD_LED_NUMLOCK) |
Return | ERROR_SUCCESS if completed or another error code on failure |
function HIDKeyboardDeviceSetIdle(Keyboard:PHIDKeyboardDevice; Duration,ReportId:Byte):LongWord;
Keyboard | The HID keyboard device to set the idle duration for |
---|---|
Duration | The idle duration to set (Milliseconds divided by 4) |
ReportId | The report Id to set the idle duration for (eg HID_REPORTID_NONE) |
Return | ERROR_SUCCESS if completed or another error code on failure |
Return to Unit Reference