ble_gattc_app.h 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491
  1. /**
  2. * Copyright (c) 2013 - 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. #ifndef BLE_GATTC_APP_H__
  41. #define BLE_GATTC_APP_H__
  42. /**@file
  43. *
  44. * @defgroup ble_gattc_app GATTC Application command request encoders and command response decoders
  45. * @{
  46. * @ingroup ser_app_s130_codecs
  47. *
  48. * @brief GATTC Application command request encoders and command response decoders.
  49. */
  50. #include "ble_gattc.h"
  51. #include "ble.h"
  52. #ifdef __cplusplus
  53. extern "C" {
  54. #endif
  55. /**@brief Encodes @ref sd_ble_gattc_primary_services_discover command request.
  56. *
  57. * @sa @ref ble_gattc_primary_services_discover_rsp_dec for command response decoder.
  58. *
  59. * @param[in] conn_handle Connection handle of the connection.
  60. * @param[in] start_handle Handle to start searching from.
  61. * @param[in] p_srvc_uuid Pointer to a @ref ble_uuid_t which indicates the service UUID to
  62. * be found. If it is NULL, all primary services will be returned.
  63. * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
  64. * @param[in, out] p_buf_len \c in: size of \p p_buf buffer.
  65. * \c out: Length of encoded command packet.
  66. *
  67. * @retval NRF_SUCCESS Encoding success.
  68. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  69. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  70. */
  71. uint32_t ble_gattc_primary_services_discover_req_enc(uint16_t conn_handle,
  72. uint16_t start_handle,
  73. ble_uuid_t const * const p_srvc_uuid,
  74. uint8_t * const p_buf,
  75. uint32_t * p_buf_len);
  76. /**@brief Decodes response to @ref sd_ble_gattc_primary_services_discover command.
  77. *
  78. * @sa @ref ble_gattc_primary_services_discover_req_enc for command request encoder.
  79. *
  80. * @param[in] p_buf Pointer to beginning of command response packet.
  81. * @param[in] packet_len Length (in bytes) of response packet.
  82. * @param[out] p_result_code Command response result code.
  83. *
  84. * @retval NRF_SUCCESS Decoding success.
  85. * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
  86. * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length.
  87. * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected
  88. * operation code.
  89. */
  90. uint32_t ble_gattc_primary_services_discover_rsp_dec(uint8_t const * const p_buf,
  91. uint32_t packet_len,
  92. uint32_t * const p_result_code);
  93. /**@brief Encodes @ref sd_ble_gattc_descriptors_discover command request.
  94. *
  95. * @sa @ref ble_gattc_descriptors_discover_rsp_dec for command response decoder.
  96. *
  97. * @param[in] conn_handle Connection handle of the connection.
  98. * @param[in] p_handle_range A pointer to the range of handles of the Service to perform
  99. * this procedure on.
  100. * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
  101. * @param[in, out] p_buf_len \c in: size of \p p_buf buffer.
  102. * \c out: Length of encoded command packet.
  103. *
  104. * @retval NRF_SUCCESS Encoding success.
  105. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  106. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  107. */
  108. uint32_t ble_gattc_descriptors_discover_req_enc(
  109. uint16_t conn_handle,
  110. ble_gattc_handle_range_t const * const p_handle_range,
  111. uint8_t * const p_buf,
  112. uint32_t * p_buf_len);
  113. /**@brief Decodes response to @ref sd_ble_gattc_descriptors_discover command.
  114. *
  115. * @sa @ref ble_gattc_primary_services_discover_rsp_dec for command request encoder.
  116. *
  117. * @param[in] p_buf Pointer to beginning of command response packet.
  118. * @param[in] packet_len Length (in bytes) of response packet.
  119. * @param[out] p_result_code Command response result code.
  120. *
  121. * @retval NRF_SUCCESS Decoding success.
  122. * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
  123. * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length.
  124. * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected
  125. * operation code.
  126. */
  127. uint32_t ble_gattc_descriptors_discover_rsp_dec(uint8_t const * const p_buf,
  128. uint32_t packet_len,
  129. uint32_t * const p_result_code);
  130. /**@brief Encodes @ref sd_ble_gattc_relationships_discover command request.
  131. *
  132. * @sa @ref ble_gattc_relationships_discover_rsp_dec for command response decoder.
  133. *
  134. * @param[in] conn_handle Connection handle of the connection.
  135. * @param[in] p_handle_range A pointer to the range of handles of the Service to perform
  136. * this procedure on.
  137. * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
  138. * @param[in, out] p_buf_len \c in: size of \p p_buf buffer.
  139. * \c out: Length of encoded command packet.
  140. *
  141. * @retval NRF_SUCCESS Encoding success.
  142. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  143. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  144. */
  145. uint32_t ble_gattc_relationships_discover_req_enc(
  146. uint16_t conn_handle,
  147. ble_gattc_handle_range_t const * const p_handle_range,
  148. uint8_t * const p_buf,
  149. uint32_t * p_buf_len);
  150. /**@brief Decodes response to @ref sd_ble_gattc_relationships_discover command.
  151. *
  152. * @sa @ref ble_gattc_relationships_discover_req_enc for command request encoder.
  153. *
  154. * @param[in] p_buf Pointer to beginning of command response packet.
  155. * @param[in] packet_len Length (in bytes) of response packet.
  156. * @param[out] p_result_code Command response result code.
  157. *
  158. * @retval NRF_SUCCESS Decoding success.
  159. * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
  160. * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length.
  161. * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected
  162. * operation code.
  163. */
  164. uint32_t ble_gattc_relationships_discover_rsp_dec(uint8_t const * const p_buf,
  165. uint32_t packet_len,
  166. uint32_t * const p_result_code);
  167. /**@brief Encodes @ref sd_ble_gattc_characteristics_discover command request.
  168. *
  169. * @sa @ref ble_gattc_characteristics_discover_rsp_dec for command response decoder.
  170. *
  171. * @param[in] conn_handle Connection handle of the connection.
  172. * @param[in] p_handle_range A pointer to the range of handles of the Service to perform
  173. * this procedure on.
  174. * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
  175. * @param[in, out] p_buf_len \c in: size of \p p_buf buffer.
  176. * \c out: Length of encoded command packet.
  177. *
  178. * @retval NRF_SUCCESS Encoding success.
  179. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  180. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  181. */
  182. uint32_t ble_gattc_characteristics_discover_req_enc
  183. (uint16_t conn_handle,
  184. ble_gattc_handle_range_t const * const p_handle_range,
  185. uint8_t * const p_buf,
  186. uint32_t * p_buf_len);
  187. /**@brief Decodes response to @ref sd_ble_gattc_characteristics_discover command.
  188. *
  189. * @sa @ref ble_gattc_primary_services_discover_rsp_dec for command request encoder.
  190. *
  191. * @param[in] p_buf Pointer to beginning of command response packet.
  192. * @param[in] packet_len Length (in bytes) of response packet.
  193. * @param[out] p_result_code Command response result code.
  194. *
  195. * @retval NRF_SUCCESS Decoding success.
  196. * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
  197. * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length.
  198. * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected
  199. * operation code.
  200. */
  201. uint32_t ble_gattc_characteristics_discover_rsp_dec(uint8_t const * const p_buf,
  202. uint32_t packet_len,
  203. uint32_t * const p_result_code);
  204. /**@brief Encodes @ref sd_ble_gattc_read command request.
  205. *
  206. * @sa @ref ble_gattc_read_rsp_dec for command response decoder.
  207. *
  208. * @param[in] conn_handle Connection handle of the connection.
  209. * @param[in] handle The handle of the attribute to be read.
  210. * @param[in] offset Offset into the attribute value to be read.
  211. * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
  212. * @param[in, out] p_buf_len \c in: size of \p p_buf buffer.
  213. * \c out: Length of encoded command packet.
  214. *
  215. * @retval NRF_SUCCESS Encoding success.
  216. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  217. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  218. */
  219. uint32_t ble_gattc_read_req_enc(uint16_t conn_handle,
  220. uint16_t handle,
  221. uint16_t offset,
  222. uint8_t * const p_buf,
  223. uint32_t * p_buf_len);
  224. /**@brief Decodes response to @ref sd_ble_gattc_read command.
  225. *
  226. * @sa @ref ble_gattc_read_req_enc for command request encoder.
  227. *
  228. * @param[in] p_buf Pointer to beginning of command response packet.
  229. * @param[in] packet_len Length (in bytes) of response packet.
  230. * @param[out] p_result_code Command response result code.
  231. *
  232. * @retval NRF_SUCCESS Decoding success.
  233. * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
  234. * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length.
  235. * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected
  236. * operation code.
  237. */
  238. uint32_t ble_gattc_read_rsp_dec(uint8_t const * const p_buf,
  239. uint32_t packet_len,
  240. uint32_t * const p_result_code);
  241. /**@brief Encodes @ref sd_ble_gattc_char_values_read command request.
  242. *
  243. * @sa @ref ble_gattc_char_values_read_rsp_dec for command response decoder.
  244. *
  245. * @param[in] conn_handle Connection handle of the connection.
  246. * @param[in] p_handles A pointer to the handle(s) of the attribute(s) to be read.
  247. * @param[in] handle_count The number of handles in p_handles.
  248. * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
  249. * @param[in, out] p_buf_len \c in: size of \p p_buf buffer.
  250. * \c out: Length of encoded command packet.
  251. *
  252. * @retval NRF_SUCCESS Encoding success.
  253. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  254. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  255. */
  256. uint32_t ble_gattc_char_values_read_req_enc(uint16_t conn_handle,
  257. uint16_t const * const p_handles,
  258. uint16_t handle_count,
  259. uint8_t * const p_buf,
  260. uint32_t * p_buf_len);
  261. /**@brief Decodes response to @ref sd_ble_gattc_char_values_read command.
  262. *
  263. * @sa @ref ble_gattc_char_values_read_req_enc for command request encoder.
  264. *
  265. * @param[in] p_buf Pointer to beginning of command response packet.
  266. * @param[in] packet_len Length (in bytes) of response packet.
  267. * @param[out] p_result_code Command response result code.
  268. *
  269. * @retval NRF_SUCCESS Decoding success.
  270. * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
  271. * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length.
  272. * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected
  273. * operation code.
  274. */
  275. uint32_t ble_gattc_char_values_read_rsp_dec(uint8_t const * const p_buf,
  276. uint32_t packet_len,
  277. uint32_t * const p_result_code);
  278. /**@brief Encodes @ref sd_ble_gattc_write command request.
  279. *
  280. * @sa @ref ble_gattc_write_rsp_dec for command response decoder.
  281. *
  282. * @param[in] conn_handle Connection handle of the connection.
  283. * @param[in] p_write_params Pointer to \ref sd_ble_gattc_write params.
  284. * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
  285. * @param[in, out] p_buf_len \c in: size of \p p_buf buffer.
  286. * \c out: Length of encoded command packet.
  287. *
  288. * @retval NRF_SUCCESS Encoding success.
  289. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  290. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  291. */
  292. uint32_t ble_gattc_write_req_enc(uint16_t conn_handle,
  293. ble_gattc_write_params_t const * const p_write_params,
  294. uint8_t * const p_buf,
  295. uint32_t * p_buf_len);
  296. /**@brief Decodes response to @ref sd_ble_gattc_write command.
  297. *
  298. * @sa @ref ble_gattc_write_req_enc for command request encoder.
  299. *
  300. * @param[in] p_buf Pointer to beginning of command response packet.
  301. * @param[in] packet_len Length (in bytes) of response packet.
  302. * @param[out] p_result_code Command response result code.
  303. *
  304. * @retval NRF_SUCCESS Decoding success.
  305. * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
  306. * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length.
  307. * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected
  308. * operation code.
  309. */
  310. uint32_t ble_gattc_write_rsp_dec(uint8_t const * const p_buf,
  311. uint32_t packet_len,
  312. uint32_t * const p_result_code);
  313. /**@brief Encodes @ref sd_ble_gattc_hv_confirm command request.
  314. *
  315. * @sa @ref ble_gattc_hv_confirm_rsp_dec for command response decoder.
  316. *
  317. * @param[in] conn_handle Connection handle of the connection.
  318. * @param[in] handle Handle of the attribute in the indication.
  319. * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
  320. * @param[in, out] p_buf_len \c in: size of \p p_buf buffer.
  321. * \c out: Length of encoded command packet.
  322. *
  323. * @retval NRF_SUCCESS Encoding success.
  324. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  325. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  326. */
  327. uint32_t ble_gattc_hv_confirm_req_enc(uint16_t conn_handle,
  328. uint16_t handle,
  329. uint8_t * const p_buf,
  330. uint32_t * const p_buf_len);
  331. /**@brief Decodes response to @ref sd_ble_gattc_hv_confirm command.
  332. *
  333. * @sa @ref ble_gattc_hv_confirm_req_enc for command request encoder.
  334. *
  335. * @param[in] p_buf Pointer to beginning of command response packet.
  336. * @param[in] packet_len Length (in bytes) of response packet.
  337. * @param[out] p_result_code Pointer to command response result code.
  338. *
  339. * @retval NRF_SUCCESS Decoding success.
  340. * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
  341. * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length.
  342. * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected
  343. * operation code.
  344. */
  345. uint32_t ble_gattc_hv_confirm_rsp_dec(uint8_t const * const p_buf,
  346. uint32_t packet_len,
  347. uint32_t * const p_result_code);
  348. /**@brief Encodes @ref sd_ble_gattc_char_value_by_uuid_read command request.
  349. *
  350. * @sa @ref ble_gattc_char_value_by_uuid_read_rsp_dec for command response decoder.
  351. *
  352. * @param[in] conn_handle Connection handle of the connection.
  353. * @param[in] p_uuid Pointer to a characteristic value UUID to read.
  354. * @param[in] p_handle_range Pointer to the range of handles to perform this procedure on.
  355. * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
  356. * @param[in, out] p_buf_len \c in: size of \p p_buf buffer.
  357. * \c out: Length of encoded command packet.
  358. *
  359. * @retval NRF_SUCCESS Encoding success.
  360. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  361. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  362. */
  363. uint32_t ble_gattc_char_value_by_uuid_read_req_enc
  364. (uint16_t conn_handle,
  365. ble_uuid_t const * const p_uuid,
  366. ble_gattc_handle_range_t const * const p_handle_range,
  367. uint8_t * const p_buf,
  368. uint32_t * const p_buf_len);
  369. /**@brief Decodes response to @ref sd_ble_gattc_char_value_by_uuid_read command.
  370. *
  371. * @sa @ref ble_gattc_char_value_by_uuid_read_req_enc for command request encoder.
  372. *
  373. * @param[in] p_buf Pointer to beginning of command response packet.
  374. * @param[in] packet_len Length (in bytes) of response packet.
  375. * @param[out] p_result_code Pointer to command response result code.
  376. *
  377. * @retval NRF_SUCCESS Decoding success.
  378. * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
  379. * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length.
  380. * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected
  381. * operation code.
  382. */
  383. uint32_t ble_gattc_char_value_by_uuid_read_rsp_dec(uint8_t const * const p_buf,
  384. uint32_t packet_len,
  385. uint32_t * const p_result_code);
  386. /**@brief Encodes @ref sd_ble_gattc_attr_info_discover command request.
  387. *
  388. * @sa @ref ble_gattc_attr_info_discover_rsp_dec for command response decoder.
  389. *
  390. * @param[in] conn_handle Connection handle of the connection.
  391. * @param[in] p_handle_range Pointer to the range of handles
  392. * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
  393. * @param[in, out] p_buf_len \c in: size of \p p_buf buffer.
  394. * \c out: Length of encoded command packet.
  395. *
  396. * @retval NRF_SUCCESS Encoding success.
  397. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  398. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  399. */
  400. uint32_t ble_gattc_attr_info_discover_req_enc(uint16_t conn_handle,
  401. ble_gattc_handle_range_t const * const p_handle_range,
  402. uint8_t * const p_buf,
  403. uint32_t * p_buf_len);
  404. /**@brief Decodes response to @ref sd_ble_gattc_attr_info_discover command.
  405. *
  406. * @sa @ref ble_gattc_attr_info_discover_req_enc for command request encoder.
  407. *
  408. * @param[in] p_buf Pointer to beginning of command response packet.
  409. * @param[in] packet_len Length (in bytes) of response packet.
  410. * @param[out] p_result_code Pointer to command response result code.
  411. *
  412. * @retval NRF_SUCCESS Decoding success.
  413. * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
  414. * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length.
  415. * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected
  416. * operation code.
  417. */
  418. uint32_t ble_gattc_attr_info_discover_rsp_dec(uint8_t const * const p_buf,
  419. uint32_t packet_len,
  420. uint32_t * const p_result_code);
  421. /**@brief Encodes @ref sd_ble_gattc_exchange_mtu_request command request.
  422. *
  423. * @sa @ref ble_gattc_exchange_mtu_request_rsp_dec for command response decoder.
  424. *
  425. * @param[in] conn_handle Connection handle of the connection.
  426. * @param[in] client_rx_mtu Client MTU Size.
  427. * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
  428. * @param[in, out] p_buf_len \c in: size of \p p_buf buffer.
  429. * \c out: Length of encoded command packet.
  430. *
  431. * @retval NRF_SUCCESS Encoding success.
  432. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  433. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  434. */
  435. uint32_t ble_gattc_exchange_mtu_request_req_enc(uint16_t conn_handle,
  436. uint16_t client_rx_mtu,
  437. uint8_t * const p_buf,
  438. uint32_t * const p_buf_len);
  439. /**@brief Decodes response to @ref sd_ble_gattc_exchange_mtu_request command.
  440. *
  441. * @sa @ref ble_gattc_exchange_mtu_request_req_enc for command request encoder.
  442. *
  443. * @param[in] p_buf Pointer to beginning of command response packet.
  444. * @param[in] packet_len Length (in bytes) of response packet.
  445. * @param[out] p_result_code Pointer to command response result code.
  446. *
  447. * @retval NRF_SUCCESS Decoding success.
  448. * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
  449. * @retval NRF_ERROR_DATA_SIZE Decoding failure. Incorrect buffer length.
  450. * @retval NRF_ERROR_INVALID_DATA Decoding failure. Decoded operation code does not match expected
  451. * operation code.
  452. */
  453. uint32_t ble_gattc_exchange_mtu_request_rsp_dec(uint8_t const * const p_buf,
  454. uint32_t packet_len,
  455. uint32_t * const p_result_code);
  456. /** @} */
  457. #ifdef __cplusplus
  458. }
  459. #endif
  460. #endif