Human Interface Device Service module. More...
Modules | |
Human Interface Device Service configuration | |
Data Structures | |
struct | ble_hids_char_id_t |
HID Service characteristic id. More... | |
struct | ble_hids_evt_t |
HID Service event. More... | |
struct | ble_hids_char_sec_t |
Security requirements for HID Service characteristic. More... | |
struct | ble_hids_hid_information_t |
HID Information characteristic value. More... | |
struct | ble_hids_inp_rep_init_t |
HID Service Input Report characteristic init structure. This contains all options and data needed for initialization of one Input Report characteristic. More... | |
struct | ble_hids_outp_rep_init_t |
HID Service Output Report characteristic init structure. This contains all options and data needed for initialization of one Output Report characteristic. More... | |
struct | ble_hids_feature_rep_init_t |
HID Service Feature Report characteristic init structure. This contains all options and data needed for initialization of one Feature Report characteristic. More... | |
struct | ble_hids_rep_map_init_t |
HID Service Report Map characteristic init structure. This contains all options and data needed for initialization of the Report Map characteristic. More... | |
struct | ble_hids_rep_char_t |
HID Report characteristic structure. More... | |
struct | ble_hids_client_context_t |
HID Host context structure. It keeps information relevant to a single host. More... | |
struct | ble_hids_init_t |
HID Service init structure. This contains all options and data needed for initialization of the service. More... | |
struct | ble_hids_s |
HID Service structure. This contains various status information for the service. More... | |
Macros | |
#define | BLE_HIDS_DEF(_name,_hids_max_clients,...) |
Allocate static data for keeping host connection contexts. More... | |
#define | BLE_HIDS_LINK_CTX_SIZE_CALC(...) |
Helping macro for BLE_HIDS_DEF, that calculates the link context size for BLE HIDS instance. More... | |
#define | BLE_HIDS_REPORT_ADD(_report_size) |
Helping macro for BLE_HIDS_LINK_CTX_SIZE_CALC, that adds Input/Output/Feature report lengths. More... | |
#define | BLE_HIDS_MAX_INPUT_REP 10 |
#define | BLE_HIDS_MAX_OUTPUT_REP 10 |
#define | BLE_HIDS_MAX_FEATURE_REP 10 |
#define | HID_INFO_FLAG_REMOTE_WAKE_MSK 0x01 |
#define | HID_INFO_FLAG_NORMALLY_CONNECTABLE_MSK 0x02 |
#define | BOOT_KB_INPUT_REPORT_MAX_SIZE 8 |
#define | BOOT_KB_OUTPUT_REPORT_MAX_SIZE 1 |
#define | BOOT_MOUSE_INPUT_REPORT_MIN_SIZE 3 |
#define | BOOT_MOUSE_INPUT_REPORT_MAX_SIZE 8 |
Typedefs | |
typedef struct ble_hids_s | ble_hids_t |
typedef void(* | ble_hids_evt_handler_t )(ble_hids_t *p_hids, ble_hids_evt_t *p_evt) |
HID Service event handler type. | |
Enumerations | |
enum | ble_hids_evt_type_t { BLE_HIDS_EVT_HOST_SUSP, BLE_HIDS_EVT_HOST_EXIT_SUSP, BLE_HIDS_EVT_NOTIF_ENABLED, BLE_HIDS_EVT_NOTIF_DISABLED, BLE_HIDS_EVT_REP_CHAR_WRITE, BLE_HIDS_EVT_BOOT_MODE_ENTERED, BLE_HIDS_EVT_REPORT_MODE_ENTERED, BLE_HIDS_EVT_REPORT_READ } |
HID Service event type. More... | |
Functions | |
uint32_t | ble_hids_init (ble_hids_t *p_hids, const ble_hids_init_t *p_hids_init) |
Function for initializing the HID Service. More... | |
void | ble_hids_on_ble_evt (ble_evt_t const *p_ble_evt, void *p_context) |
Function for handling the Application's BLE Stack events. More... | |
uint32_t | ble_hids_inp_rep_send (ble_hids_t *p_hids, uint8_t rep_index, uint16_t len, uint8_t *p_data, uint16_t conn_handle) |
Function for sending Input Report. More... | |
uint32_t | ble_hids_boot_kb_inp_rep_send (ble_hids_t *p_hids, uint16_t len, uint8_t *p_data, uint16_t conn_handle) |
Function for sending Boot Keyboard Input Report. More... | |
uint32_t | ble_hids_boot_mouse_inp_rep_send (ble_hids_t *p_hids, uint8_t buttons, int8_t x_delta, int8_t y_delta, uint16_t optional_data_len, uint8_t *p_optional_data, uint16_t conn_handle) |
Function for sending Boot Mouse Input Report. More... | |
uint32_t | ble_hids_outp_rep_get (ble_hids_t *p_hids, uint8_t rep_index, uint16_t len, uint8_t offset, uint16_t conn_handle, uint8_t *p_outp_rep) |
Function for getting the current value of Output Report from the stack. More... | |
Report Type values | |
#define | BLE_HIDS_REP_TYPE_INPUT 1 |
#define | BLE_HIDS_REP_TYPE_OUTPUT 2 |
#define | BLE_HIDS_REP_TYPE_FEATURE 3 |
Human Interface Device Service module.
This module implements the Human Interface Device Service with the corresponding set of characteristics. During initialization it adds the Human Interface Device Service and a set of characteristics as per the Human Interface Device Service specification and the user requirements to the BLE stack database.
If enabled, notification of Input Report characteristics is performed when the application calls the corresponding ble_hids_xx_input_report_send() function.
If an event handler is supplied by the application, the Human Interface Device Service will generate Human Interface Device Service events to the application.
#define BLE_HIDS_DEF | ( | _name, | |
_hids_max_clients, | |||
... | |||
) |
Allocate static data for keeping host connection contexts.
_name | Name of BLE HIDS instance. | |
[in] | _hids_max_clients | Maximum number of HIDS clients connected at a time. |
[in] | ... | Lengths of HIDS reports. |
Mapping of HIDS reports in the HIDS report context:
#define BLE_HIDS_LINK_CTX_SIZE_CALC | ( | ... | ) |
Helping macro for BLE_HIDS_DEF, that calculates the link context size for BLE HIDS instance.
[in] | ... | Lengths of HIDS reports |
#define BLE_HIDS_REPORT_ADD | ( | _report_size | ) |
Helping macro for BLE_HIDS_LINK_CTX_SIZE_CALC, that adds Input/Output/Feature report lengths.
[in] | _report_size | Length of the specific report. |
#define BOOT_KB_INPUT_REPORT_MAX_SIZE 8 |
Maximum size of a Boot Keyboard Input Report (as per Appendix B in Device Class Definition for Human Interface Devices (HID), Version 1.11).
#define BOOT_KB_OUTPUT_REPORT_MAX_SIZE 1 |
Maximum size of a Boot Keyboard Output Report (as per Appendix B in Device Class Definition for Human Interface Devices (HID), Version 1.11).
#define BOOT_MOUSE_INPUT_REPORT_MAX_SIZE 8 |
Maximum size of a Boot Mouse Input Report (as per Appendix B in Device Class Definition for Human Interface Devices (HID), Version 1.11).
#define BOOT_MOUSE_INPUT_REPORT_MIN_SIZE 3 |
Minimum size of a Boot Mouse Input Report (as per Appendix B in Device Class Definition for Human Interface Devices (HID), Version 1.11).
enum ble_hids_evt_type_t |
HID Service event type.
uint32_t ble_hids_boot_kb_inp_rep_send | ( | ble_hids_t * | p_hids, |
uint16_t | len, | ||
uint8_t * | p_data, | ||
uint16_t | conn_handle | ||
) |
Function for sending Boot Keyboard Input Report.
Sends data on an Boot Keyboard Input Report characteristic.
[in] | p_hids | HID Service structure. |
[in] | len | Length of data to be sent. |
[in] | p_data | Pointer to data to be sent. |
[in] | conn_handle | Connection handle, where the notification will be sent. |
uint32_t ble_hids_boot_mouse_inp_rep_send | ( | ble_hids_t * | p_hids, |
uint8_t | buttons, | ||
int8_t | x_delta, | ||
int8_t | y_delta, | ||
uint16_t | optional_data_len, | ||
uint8_t * | p_optional_data, | ||
uint16_t | conn_handle | ||
) |
Function for sending Boot Mouse Input Report.
Sends data on an Boot Mouse Input Report characteristic.
[in] | p_hids | HID Service structure. |
[in] | buttons | State of mouse buttons. |
[in] | x_delta | Horizontal movement. |
[in] | y_delta | Vertical movement. |
[in] | optional_data_len | Length of optional part of Boot Mouse Input Report. |
[in] | p_optional_data | Optional part of Boot Mouse Input Report. |
[in] | conn_handle | Connection handle. |
uint32_t ble_hids_init | ( | ble_hids_t * | p_hids, |
const ble_hids_init_t * | p_hids_init | ||
) |
Function for initializing the HID Service.
[out] | p_hids | HID Service structure. This structure will have to be supplied by the application. It will be initialized by this function, and will later be used to identify this particular service instance. |
[in] | p_hids_init | Information needed to initialize the service. |
uint32_t ble_hids_inp_rep_send | ( | ble_hids_t * | p_hids, |
uint8_t | rep_index, | ||
uint16_t | len, | ||
uint8_t * | p_data, | ||
uint16_t | conn_handle | ||
) |
Function for sending Input Report.
Sends data on an Input Report characteristic.
[in] | p_hids | HID Service structure. |
[in] | rep_index | Index of the characteristic (corresponding to the index in ble_hids_t.inp_rep_array as passed to ble_hids_init()). |
[in] | len | Length of data to be sent. |
[in] | p_data | Pointer to data to be sent. |
[in] | conn_handle | Connection handle, where the notification will be sent. |
void ble_hids_on_ble_evt | ( | ble_evt_t const * | p_ble_evt, |
void * | p_context | ||
) |
Function for handling the Application's BLE Stack events.
Handles all events from the BLE stack of interest to the HID Service.
[in] | p_ble_evt | Event received from the BLE stack. |
[in] | p_context | HID Service structure. |
uint32_t ble_hids_outp_rep_get | ( | ble_hids_t * | p_hids, |
uint8_t | rep_index, | ||
uint16_t | len, | ||
uint8_t | offset, | ||
uint16_t | conn_handle, | ||
uint8_t * | p_outp_rep | ||
) |
Function for getting the current value of Output Report from the stack.
Fetches the current value of the output report characteristic from the stack.
[in] | p_hids | HID Service structure. |
[in] | rep_index | Index of the characteristic (corresponding to the index in ble_hids_t.outp_rep_array as passed to ble_hids_init()). |
[in] | len | Length of output report needed. |
[in] | offset | Offset in bytes to read from. |
[in] | conn_handle | Connection handle. |
[out] | p_outp_rep | Pointer to the output report. |