| nRF5 SDK v12.0.0 |

Choose documentation: | nRF5 SDK | S130 SoftDevice API | S132 SoftDevice API | S212 SoftDevice API | S332 SoftDevice API

All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
Modules | Data Structures | Macros | Typedefs | Enumerations | Functions
Human Interface Device Service
BLE Services

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_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_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_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

## 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_hids_t *p_hids, ble_evt_t *p_ble_evt)
| 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)
| 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)
| 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)
| 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, 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

## Detailed Description

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.

Note
  The application must propagate BLE stack events to the Human Interface Device Service module by calling ble_hids_on_ble_evt() from the SoftDevice Event Handler callback.
  Attention! To maintain compliance with Nordic Semiconductor ASA Bluetooth profile qualification listings, this section of source code must not be modified.

## Enumeration Type Documentation

enum ble_hids_evt_type_t

HID Service event type.

Enumerator
BLE_HIDS_EVT_HOST_SUSP | Suspend command received.
BLE_HIDS_EVT_HOST_EXIT_SUSP | Exit suspend command received.
BLE_HIDS_EVT_NOTIF_ENABLED | Notification enabled event.
BLE_HIDS_EVT_NOTIF_DISABLED | Notification disabled event.
BLE_HIDS_EVT_REP_CHAR_WRITE | A new value has been written to an Report characteristic.
BLE_HIDS_EVT_BOOT_MODE_ENTERED | Boot mode entered.
BLE_HIDS_EVT_REPORT_MODE_ENTERED | Report mode entered.
BLE_HIDS_EVT_REPORT_READ | Read with response

## Function Documentation

uint32_t ble_hids_boot_kb_inp_rep_send | ( | ble_hids_t * | p_hids,
|  | uint16_t | len,
|  | uint8_t * | p_data
| ) |  |

Function for sending Boot Keyboard Input Report.

Sends data on an Boot Keyboard Input Report characteristic.

Parameters

  [in] | p_hids | HID Service structure.
  [in] | len | Length of data to be sent.
  [in] | p_data | Pointer to data to be sent.

Returns
  NRF_SUCCESS on successful sending of the report, otherwise an error code.

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
| ) |  |

Function for sending Boot Mouse Input Report.

Sends data on an Boot Mouse Input Report characteristic.

Parameters

  [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.

Returns
  NRF_SUCCESS on successful sending of the report, otherwise an error code.

uint32_t ble_hids_init | ( | ble_hids_t * | p_hids,
|  | const ble_hids_init_t * | p_hids_init
| ) |  |

Function for initializing the HID Service.

Parameters

  [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.

Returns
  NRF_SUCCESS on successful initialization of service, otherwise an error code.

uint32_t ble_hids_inp_rep_send | ( | ble_hids_t * | p_hids,
|  | uint8_t | rep_index,
|  | uint16_t | len,
|  | uint8_t * | p_data
| ) |  |

Function for sending Input Report.

Sends data on an Input Report characteristic.

Parameters

  [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.

Returns
  NRF_SUCCESS on successful sending of input report, otherwise an error code.

void ble_hids_on_ble_evt | ( | ble_hids_t * | p_hids,
|  | ble_evt_t * | p_ble_evt
| ) |  |

Function for handling the Application's BLE Stack events.

Handles all events from the BLE stack of interest to the HID Service.

Parameters

  [in] | p_hids | HID Service structure.
  [in] | p_ble_evt | Event received from the BLE stack.

uint32_t ble_hids_outp_rep_get | ( | ble_hids_t * | p_hids,
|  | uint8_t | rep_index,
|  | uint16_t | len,
|  | uint8_t | offset,
|  | 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.

Parameters

  [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.
  [out] | p_outp_rep | Pointer to the output report.

Returns
  NRF_SUCCESS on successful read of the report, otherwise an error code.