HID-over-GATT implementation with the BLE API. This library allows to create devices such as mouse, keyboard or joystick, over Bluetooth Low Energy.

Dependents:   BLENano_HID BLE_HID_MouseScrollDemo BLE_HID_KeyboardStreamDemo Shervs_TestKeyboard_TinyBLE ... more

Embed: (wiki syntax)

« Back to documentation index

KeyBuffer Class Reference

KeyBuffer Class Reference

Buffer used to store keys to send. More...

#include <KeyboardService.h>

Public Member Functions

void setPending (uint8_t data)
 Mark a character as pending.
bool getPending (uint8_t &data)
 Get pending char.
void setKeyUpPending (void)
 Signal that a keyUp report is pending.
void clearKeyUpPending (void)
 Signal that no high-priority report is pending anymore, we can go back to the normal queue.

Detailed Description

Buffer used to store keys to send.

Internally, it is a CircularBuffer, with the added capability of putting the last char back in, when we're unable to send it (ie. when BLE stack is busy)

Definition at line 85 of file KeyboardService.h.


Member Function Documentation

void clearKeyUpPending ( void   )

Signal that no high-priority report is pending anymore, we can go back to the normal queue.

Definition at line 147 of file KeyboardService.h.

bool getPending ( uint8_t &  data )

Get pending char.

Either from the high priority buffer (set with setPending), or from the circular buffer.

Parameters:
dataFilled with the pending data, when present
Returns:
true if data was filled

Definition at line 118 of file KeyboardService.h.

void setKeyUpPending ( void   )

Signal that a keyUp report is pending.

This means that a character has successfully been sent, but the subsequent keyUp report failed. This report is of highest priority than the next character.

Definition at line 139 of file KeyboardService.h.

void setPending ( uint8_t  data )

Mark a character as pending.

When a freshly popped character cannot be sent, because the underlying stack is busy, we set it as pending, and it will get popped in priority by getPending once reports can be sent again.

Parameters:
dataThe character to send in priority. The second keyUp report is implied.

Definition at line 102 of file KeyboardService.h.