dispatchKeyboardEvent
Dispatches a keyboard-related event to the system.
Declaration
virtual kern_return_t dispatchKeyboardEvent(uint64_t timeStamp, uint32_t usagePage, uint32_t usage, uint32_t value, IOOptionBits options, bool repeat);Parameters
- timeStamp:
The timestamp of the event. Use the timestamp of the report element that is the source of the event.
- usagePage:
The HID usage page to associate with the event. For a list of possible values, see Usage Pages Enum.
- usage:
The HID usage code indicating the specific type of the event. For a list of possible usage values, see Hid Usage Tables.
- value:
The value associated with the event.
- options:
Additional options for keyboard events. Specify
0for no options. For a list of other values, see Iohidkeyboardeventoptions. - repeat:
The autorepeat behavior to apply when the user holds down a key. Specify
trueto apply the default behavior, which repeats the key event after a user-configurable amount of time elapses. Specifyfalseto prevent the delivery of repeat events.
Return Value
kIOReturnSuccess on success, or another value if an error occurs. See Error Codes.
Discussion
Call this method from your event service to dispatch a keyboard event to the system. Typically, you call this method when handling a report from the device, after you determine that the report contains a keyboard-related event.