ble_hids.h 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439
  1. /**
  2. * Copyright (c) 2012 - 2020, Nordic Semiconductor ASA
  3. *
  4. * All rights reserved.
  5. *
  6. * Redistribution and use in source and binary forms, with or without modification,
  7. * are permitted provided that the following conditions are met:
  8. *
  9. * 1. Redistributions of source code must retain the above copyright notice, this
  10. * list of conditions and the following disclaimer.
  11. *
  12. * 2. Redistributions in binary form, except as embedded into a Nordic
  13. * Semiconductor ASA integrated circuit in a product or a software update for
  14. * such product, must reproduce the above copyright notice, this list of
  15. * conditions and the following disclaimer in the documentation and/or other
  16. * materials provided with the distribution.
  17. *
  18. * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
  19. * contributors may be used to endorse or promote products derived from this
  20. * software without specific prior written permission.
  21. *
  22. * 4. This software, with or without modification, must only be used with a
  23. * Nordic Semiconductor ASA integrated circuit.
  24. *
  25. * 5. Any software provided in binary form under this license must not be reverse
  26. * engineered, decompiled, modified and/or disassembled.
  27. *
  28. * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
  29. * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  30. * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
  31. * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
  32. * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  33. * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
  34. * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  35. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  36. * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  37. * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  38. *
  39. */
  40. /** @file
  41. *
  42. * @defgroup ble_hids Human Interface Device Service
  43. * @{
  44. * @ingroup ble_sdk_srv
  45. * @brief Human Interface Device Service module.
  46. *
  47. * @details This module implements the Human Interface Device Service with the corresponding set of
  48. * characteristics. During initialization it adds the Human Interface Device Service and
  49. * a set of characteristics as per the Human Interface Device Service specification and
  50. * the user requirements to the BLE stack database.
  51. *
  52. * If enabled, notification of Input Report characteristics is performed when the
  53. * application calls the corresponding ble_hids_xx_input_report_send() function.
  54. *
  55. * If an event handler is supplied by the application, the Human Interface Device Service
  56. * will generate Human Interface Device Service events to the application.
  57. *
  58. * @note The application must register this module as BLE event observer using the
  59. * NRF_SDH_BLE_OBSERVER macro. Example:
  60. * @code
  61. * ble_hids_t instance;
  62. * NRF_SDH_BLE_OBSERVER(anything, BLE_HIDS_BLE_OBSERVER_PRIO,
  63. * ble_hids_on_ble_evt, &instance);
  64. * @endcode
  65. *
  66. * @note Attention!
  67. * To maintain compliance with Nordic Semiconductor ASA Bluetooth profile
  68. * qualification listings, this section of source code must not be modified.
  69. */
  70. #ifndef BLE_HIDS_H__
  71. #define BLE_HIDS_H__
  72. #include <stdint.h>
  73. #include <stdbool.h>
  74. #include "ble.h"
  75. #include "ble_srv_common.h"
  76. #include "ble_link_ctx_manager.h"
  77. #include "nrf_sdh_ble.h"
  78. #ifdef __cplusplus
  79. extern "C" {
  80. #endif
  81. /**@brief Allocate static data for keeping host connection contexts.
  82. *
  83. * @param _name Name of BLE HIDS instance.
  84. * @param[in] _hids_max_clients Maximum number of HIDS clients connected at a time.
  85. * @param[in] ... Lengths of HIDS reports.
  86. *
  87. * @details
  88. * Mapping of HIDS reports in the HIDS report context:
  89. * - Structure of type @ref ble_hids_client_context_t
  90. * - Boot keyboard input report
  91. * - Boot keyboard output report
  92. * - Boot mouse input report
  93. * - Input reports
  94. * - Output reports
  95. * - Feature reports
  96. * @hideinitializer
  97. */
  98. #define BLE_HIDS_DEF(_name, \
  99. _hids_max_clients, \
  100. ...) \
  101. BLE_LINK_CTX_MANAGER_DEF(CONCAT_2(_name, _link_ctx_storage), \
  102. (_hids_max_clients), \
  103. BLE_HIDS_LINK_CTX_SIZE_CALC(__VA_ARGS__)); \
  104. static ble_hids_t _name = \
  105. { \
  106. .p_link_ctx_storage = &CONCAT_2(_name, _link_ctx_storage) \
  107. }; \
  108. NRF_SDH_BLE_OBSERVER(_name ## _obs, \
  109. BLE_HIDS_BLE_OBSERVER_PRIO, \
  110. ble_hids_on_ble_evt, \
  111. &_name)
  112. /**@brief Helping macro for @ref BLE_HIDS_DEF, that calculates the link context size for BLE HIDS
  113. * instance.
  114. *
  115. * @param[in] ... Lengths of HIDS reports
  116. * @hideinitializer
  117. */
  118. #define BLE_HIDS_LINK_CTX_SIZE_CALC(...) \
  119. (sizeof(ble_hids_client_context_t) + \
  120. MACRO_MAP_REC(BLE_HIDS_REPORT_ADD, __VA_ARGS__) \
  121. (BOOT_KB_INPUT_REPORT_MAX_SIZE) + \
  122. (BOOT_KB_OUTPUT_REPORT_MAX_SIZE) + \
  123. (BOOT_MOUSE_INPUT_REPORT_MAX_SIZE)) \
  124. /**@brief Helping macro for @ref BLE_HIDS_LINK_CTX_SIZE_CALC, that adds Input/Output/Feature report
  125. * lengths.
  126. *
  127. * @param[in] _report_size Length of the specific report.
  128. * @hideinitializer
  129. */
  130. #define BLE_HIDS_REPORT_ADD(_report_size) (_report_size) +
  131. /** @name Report Type values
  132. * @anchor BLE_HIDS_REPORT_TYPE @{
  133. */
  134. // Report Type values
  135. #define BLE_HIDS_REP_TYPE_INPUT 1
  136. #define BLE_HIDS_REP_TYPE_OUTPUT 2
  137. #define BLE_HIDS_REP_TYPE_FEATURE 3
  138. /** @} */
  139. // Maximum number of the various Report Types
  140. #define BLE_HIDS_MAX_INPUT_REP 10
  141. #define BLE_HIDS_MAX_OUTPUT_REP 10
  142. #define BLE_HIDS_MAX_FEATURE_REP 10
  143. // Information Flags
  144. #define HID_INFO_FLAG_REMOTE_WAKE_MSK 0x01
  145. #define HID_INFO_FLAG_NORMALLY_CONNECTABLE_MSK 0x02
  146. #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). */
  147. #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). */
  148. #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). */
  149. #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). */
  150. /**@brief HID Service characteristic id. */
  151. typedef struct
  152. {
  153. uint16_t uuid; /**< UUID of characteristic. */
  154. uint8_t rep_type; /**< Type of report (only used for BLE_UUID_REPORT_CHAR, see @ref BLE_HIDS_REPORT_TYPE). */
  155. uint8_t rep_index; /**< Index of the characteristic (only used for BLE_UUID_REPORT_CHAR). */
  156. } ble_hids_char_id_t;
  157. /**@brief HID Service event type. */
  158. typedef enum
  159. {
  160. BLE_HIDS_EVT_HOST_SUSP, /**< Suspend command received. */
  161. BLE_HIDS_EVT_HOST_EXIT_SUSP, /**< Exit suspend command received. */
  162. BLE_HIDS_EVT_NOTIF_ENABLED, /**< Notification enabled event. */
  163. BLE_HIDS_EVT_NOTIF_DISABLED, /**< Notification disabled event. */
  164. BLE_HIDS_EVT_REP_CHAR_WRITE, /**< A new value has been written to an Report characteristic. */
  165. BLE_HIDS_EVT_BOOT_MODE_ENTERED, /**< Boot mode entered. */
  166. BLE_HIDS_EVT_REPORT_MODE_ENTERED, /**< Report mode entered. */
  167. BLE_HIDS_EVT_REPORT_READ /**< Read with response */
  168. } ble_hids_evt_type_t;
  169. /**@brief HID Service event. */
  170. typedef struct
  171. {
  172. ble_hids_evt_type_t evt_type; /**< Type of event. */
  173. union
  174. {
  175. struct
  176. {
  177. ble_hids_char_id_t char_id; /**< Id of characteristic for which notification has been started. */
  178. } notification;
  179. struct
  180. {
  181. ble_hids_char_id_t char_id; /**< Id of characteristic having been written. */
  182. uint16_t offset; /**< Offset for the write operation. */
  183. uint16_t len; /**< Length of the incoming data. */
  184. uint8_t const * data; /**< Incoming data, variable length */
  185. } char_write;
  186. struct
  187. {
  188. ble_hids_char_id_t char_id; /**< Id of characteristic being read. */
  189. } char_auth_read;
  190. } params;
  191. ble_evt_t const * p_ble_evt; /**< corresponding received ble event, NULL if not relevant */
  192. } ble_hids_evt_t;
  193. // Forward declaration of the ble_hids_t type.
  194. typedef struct ble_hids_s ble_hids_t;
  195. /**@brief HID Service event handler type. */
  196. typedef void (*ble_hids_evt_handler_t) (ble_hids_t * p_hids, ble_hids_evt_t * p_evt);
  197. /**@brief Security requirements for HID Service characteristic. */
  198. typedef struct
  199. {
  200. security_req_t rd; /**< Security requirement for reading HID Service characteristic value. */
  201. security_req_t wr; /**< Security requirement for writing HID Service characteristic value. */
  202. security_req_t cccd_wr; /**< Security requirement for writing HID Service characteristic CCCD. */
  203. } ble_hids_char_sec_t;
  204. /**@brief HID Information characteristic value. */
  205. typedef struct
  206. {
  207. uint16_t bcd_hid; /**< 16-bit unsigned integer representing version number of base USB HID Specification implemented by HID Device */
  208. uint8_t b_country_code; /**< Identifies which country the hardware is localized for. Most hardware is not localized and thus this value would be zero (0). */
  209. uint8_t flags; /**< See http://developer.bluetooth.org/gatt/characteristics/Pages/CharacteristicViewer.aspx?u=org.bluetooth.characteristic.hid_information.xml */
  210. security_req_t rd_sec; /**< Security requirement for reading HID Information characteristic value. */
  211. } ble_hids_hid_information_t;
  212. /**@brief HID Service Input Report characteristic init structure. This contains all options and
  213. * data needed for initialization of one Input Report characteristic. */
  214. typedef struct
  215. {
  216. uint16_t max_len; /**< Maximum length of characteristic value. */
  217. ble_srv_report_ref_t rep_ref; /**< Value of the Report Reference descriptor. */
  218. ble_hids_char_sec_t sec; /**< Security requirements for HID Service Input Report characteristic. */
  219. } ble_hids_inp_rep_init_t;
  220. /**@brief HID Service Output Report characteristic init structure. This contains all options and
  221. * data needed for initialization of one Output Report characteristic. */
  222. typedef struct
  223. {
  224. uint16_t max_len; /**< Maximum length of characteristic value. */
  225. ble_srv_report_ref_t rep_ref; /**< Value of the Report Reference descriptor. */
  226. ble_hids_char_sec_t sec; /**< Security requirements for HID Service Output Report characteristic. */
  227. } ble_hids_outp_rep_init_t;
  228. /**@brief HID Service Feature Report characteristic init structure. This contains all options and
  229. * data needed for initialization of one Feature Report characteristic. */
  230. typedef struct
  231. {
  232. uint16_t max_len; /**< Maximum length of characteristic value. */
  233. ble_srv_report_ref_t rep_ref; /**< Value of the Report Reference descriptor. */
  234. ble_hids_char_sec_t sec; /**< Security requirements for HID Service Feature Report characteristic. */
  235. } ble_hids_feature_rep_init_t;
  236. /**@brief HID Service Report Map characteristic init structure. This contains all options and data
  237. * needed for initialization of the Report Map characteristic. */
  238. typedef struct
  239. {
  240. uint8_t * p_data; /**< Report map data. */
  241. uint16_t data_len; /**< Length of report map data. */
  242. uint8_t ext_rep_ref_num; /**< Number of Optional External Report Reference descriptors. */
  243. ble_uuid_t const * p_ext_rep_ref; /**< Optional External Report Reference descriptor (will be added if != NULL). */
  244. security_req_t rd_sec; /**< Security requirement for HID Service Report Map characteristic. */
  245. } ble_hids_rep_map_init_t;
  246. /**@brief HID Report characteristic structure. */
  247. typedef struct
  248. {
  249. ble_gatts_char_handles_t char_handles; /**< Handles related to the Report characteristic. */
  250. uint16_t ref_handle; /**< Handle of the Report Reference descriptor. */
  251. } ble_hids_rep_char_t;
  252. /**@brief HID Host context structure. It keeps information relevant to a single host. */
  253. typedef struct
  254. {
  255. uint8_t protocol_mode; /**< Protocol mode. */
  256. uint8_t ctrl_pt; /**< HID Control Point. */
  257. } ble_hids_client_context_t;
  258. /**@brief HID Service init structure. This contains all options and data needed for initialization
  259. * of the service. */
  260. typedef struct
  261. {
  262. ble_hids_evt_handler_t evt_handler; /**< Event handler to be called for handling events in the HID Service. */
  263. ble_srv_error_handler_t error_handler; /**< Function to be called in case of an error. */
  264. bool is_kb; /**< TRUE if device is operating as a keyboard, FALSE if it is not. */
  265. bool is_mouse; /**< TRUE if device is operating as a mouse, FALSE if it is not. */
  266. uint8_t inp_rep_count; /**< Number of Input Report characteristics. */
  267. ble_hids_inp_rep_init_t const * p_inp_rep_array; /**< Information about the Input Report characteristics. */
  268. uint8_t outp_rep_count; /**< Number of Output Report characteristics. */
  269. ble_hids_outp_rep_init_t const * p_outp_rep_array; /**< Information about the Output Report characteristics. */
  270. uint8_t feature_rep_count; /**< Number of Feature Report characteristics. */
  271. ble_hids_feature_rep_init_t const * p_feature_rep_array; /**< Information about the Feature Report characteristics. */
  272. ble_hids_rep_map_init_t rep_map; /**< Information nedeed for initialization of the Report Map characteristic. */
  273. ble_hids_hid_information_t hid_information; /**< Value of the HID Information characteristic. */
  274. uint8_t included_services_count; /**< Number of services to include in HID service. */
  275. uint16_t * p_included_services_array; /**< Array of services to include in HID service. */
  276. security_req_t protocol_mode_rd_sec; /**< Security requirement for reading HID service Protocol Mode characteristic. */
  277. security_req_t protocol_mode_wr_sec; /**< Security requirement for writing HID service Protocol Mode characteristic. */
  278. security_req_t ctrl_point_wr_sec; /**< Security requirement for writing HID service Control Point characteristic. */
  279. ble_hids_char_sec_t boot_mouse_inp_rep_sec; /**< Security requirements for HID Boot Keyboard Input Report characteristic. */
  280. ble_hids_char_sec_t boot_kb_inp_rep_sec; /**< Security requirements for HID Boot Keyboard Input Report characteristic. */
  281. ble_hids_char_sec_t boot_kb_outp_rep_sec; /**< Security requirements for HID Boot Keyboard Output Report characteristic. */
  282. } ble_hids_init_t;
  283. /**@brief HID Service structure. This contains various status information for the service. */
  284. struct ble_hids_s
  285. {
  286. ble_hids_evt_handler_t evt_handler; /**< Event handler to be called for handling events in the HID Service. */
  287. ble_srv_error_handler_t error_handler; /**< Function to be called in case of an error. */
  288. uint16_t service_handle; /**< Handle of HID Service (as provided by the BLE stack). */
  289. ble_gatts_char_handles_t protocol_mode_handles; /**< Handles related to the Protocol Mode characteristic (will only be created if ble_hids_init_t.is_kb or ble_hids_init_t.is_mouse is set). */
  290. uint8_t inp_rep_count; /**< Number of Input Report characteristics. */
  291. ble_hids_rep_char_t inp_rep_array[BLE_HIDS_MAX_INPUT_REP]; /**< Information about the Input Report characteristics. */
  292. uint8_t outp_rep_count; /**< Number of Output Report characteristics. */
  293. ble_hids_rep_char_t outp_rep_array[BLE_HIDS_MAX_OUTPUT_REP]; /**< Information about the Output Report characteristics. */
  294. uint8_t feature_rep_count; /**< Number of Feature Report characteristics. */
  295. ble_hids_rep_char_t feature_rep_array[BLE_HIDS_MAX_FEATURE_REP]; /**< Information about the Feature Report characteristics. */
  296. ble_gatts_char_handles_t rep_map_handles; /**< Handles related to the Report Map characteristic. */
  297. uint16_t rep_map_ext_rep_ref_handle; /**< Handle of the Report Map External Report Reference descriptor. */
  298. ble_gatts_char_handles_t boot_kb_inp_rep_handles; /**< Handles related to the Boot Keyboard Input Report characteristic (will only be created if ble_hids_init_t.is_kb is set). */
  299. ble_gatts_char_handles_t boot_kb_outp_rep_handles; /**< Handles related to the Boot Keyboard Output Report characteristic (will only be created if ble_hids_init_t.is_kb is set). */
  300. ble_gatts_char_handles_t boot_mouse_inp_rep_handles; /**< Handles related to the Boot Mouse Input Report characteristic (will only be created if ble_hids_init_t.is_mouse is set). */
  301. ble_gatts_char_handles_t hid_information_handles; /**< Handles related to the Report Map characteristic. */
  302. ble_gatts_char_handles_t hid_control_point_handles; /**< Handles related to the Report Map characteristic. */
  303. blcm_link_ctx_storage_t * const p_link_ctx_storage; /**< Link context storage with handles of all current connections and its data context. */
  304. ble_hids_inp_rep_init_t const * p_inp_rep_init_array; /**< Pointer to information about the Input Report characteristics. */
  305. ble_hids_outp_rep_init_t const * p_outp_rep_init_array; /**< Pointer to information about the Output Report characteristics. */
  306. ble_hids_feature_rep_init_t const * p_feature_rep_init_array; /**< Pointer to information about the Feature Report characteristics. */
  307. };
  308. /**@brief Function for initializing the HID Service.
  309. *
  310. * @param[out] p_hids HID Service structure. This structure will have to be supplied by the
  311. * application. It will be initialized by this function, and will later be
  312. * used to identify this particular service instance.
  313. * @param[in] p_hids_init Information needed to initialize the service.
  314. *
  315. * @return NRF_SUCCESS on successful initialization of service, otherwise an error code.
  316. */
  317. uint32_t ble_hids_init(ble_hids_t * p_hids, const ble_hids_init_t * p_hids_init);
  318. /**@brief Function for handling the Application's BLE Stack events.
  319. *
  320. * @details Handles all events from the BLE stack of interest to the HID Service.
  321. *
  322. * @param[in] p_ble_evt Event received from the BLE stack.
  323. * @param[in] p_context HID Service structure.
  324. */
  325. void ble_hids_on_ble_evt(ble_evt_t const * p_ble_evt, void * p_context);
  326. /**@brief Function for sending Input Report.
  327. *
  328. * @details Sends data on an Input Report characteristic.
  329. *
  330. * @param[in] p_hids HID Service structure.
  331. * @param[in] rep_index Index of the characteristic (corresponding to the index in
  332. * ble_hids_t.inp_rep_array as passed to ble_hids_init()).
  333. * @param[in] len Length of data to be sent.
  334. * @param[in] p_data Pointer to data to be sent.
  335. * @param[in] conn_handle Connection handle, where the notification will be sent.
  336. *
  337. * @return NRF_SUCCESS on successful sending of input report, otherwise an error code.
  338. */
  339. uint32_t ble_hids_inp_rep_send(ble_hids_t * p_hids,
  340. uint8_t rep_index,
  341. uint16_t len,
  342. uint8_t * p_data,
  343. uint16_t conn_handle);
  344. /**@brief Function for sending Boot Keyboard Input Report.
  345. *
  346. * @details Sends data on an Boot Keyboard Input Report characteristic.
  347. *
  348. * @param[in] p_hids HID Service structure.
  349. * @param[in] len Length of data to be sent.
  350. * @param[in] p_data Pointer to data to be sent.
  351. * @param[in] conn_handle Connection handle, where the notification will be sent.
  352. *
  353. * @return NRF_SUCCESS on successful sending of the report, otherwise an error code.
  354. */
  355. uint32_t ble_hids_boot_kb_inp_rep_send(ble_hids_t * p_hids,
  356. uint16_t len,
  357. uint8_t * p_data,
  358. uint16_t conn_handle);
  359. /**@brief Function for sending Boot Mouse Input Report.
  360. *
  361. * @details Sends data on an Boot Mouse Input Report characteristic.
  362. *
  363. * @param[in] p_hids HID Service structure.
  364. * @param[in] buttons State of mouse buttons.
  365. * @param[in] x_delta Horizontal movement.
  366. * @param[in] y_delta Vertical movement.
  367. * @param[in] optional_data_len Length of optional part of Boot Mouse Input Report.
  368. * @param[in] p_optional_data Optional part of Boot Mouse Input Report.
  369. * @param[in] conn_handle Connection handle.
  370. *
  371. * @return NRF_SUCCESS on successful sending of the report, otherwise an error code.
  372. */
  373. uint32_t ble_hids_boot_mouse_inp_rep_send(ble_hids_t * p_hids,
  374. uint8_t buttons,
  375. int8_t x_delta,
  376. int8_t y_delta,
  377. uint16_t optional_data_len,
  378. uint8_t * p_optional_data,
  379. uint16_t conn_handle);
  380. /**@brief Function for getting the current value of Output Report from the stack.
  381. *
  382. * @details Fetches the current value of the output report characteristic from the stack.
  383. *
  384. * @param[in] p_hids HID Service structure.
  385. * @param[in] rep_index Index of the characteristic (corresponding to the index in
  386. * ble_hids_t.outp_rep_array as passed to ble_hids_init()).
  387. * @param[in] len Length of output report needed.
  388. * @param[in] offset Offset in bytes to read from.
  389. * @param[in] conn_handle Connection handle.
  390. * @param[out] p_outp_rep Pointer to the output report.
  391. *
  392. * @return NRF_SUCCESS on successful read of the report, otherwise an error code.
  393. */
  394. uint32_t ble_hids_outp_rep_get(ble_hids_t * p_hids,
  395. uint8_t rep_index,
  396. uint16_t len,
  397. uint8_t offset,
  398. uint16_t conn_handle,
  399. uint8_t * p_outp_rep);
  400. #ifdef __cplusplus
  401. }
  402. #endif
  403. #endif // BLE_HIDS_H__
  404. /** @} */