ble_gattc_conn.h 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481
  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_CONN_H__
  41. #define BLE_GATTC_CONN_H__
  42. /**@file
  43. *
  44. * @defgroup ble_gatc_conn GATTC connectivity command request decoders and command response encoders
  45. * @{
  46. * @ingroup ser_conn_s130_codecs
  47. *
  48. * @brief GATTC Connectivity command request decoders and command response encoders
  49. */
  50. #include "ble_gattc.h"
  51. #include "ble.h"
  52. #ifdef __cplusplus
  53. extern "C" {
  54. #endif
  55. /**@brief Decodes @ref sd_ble_gattc_characteristics_discover command request.
  56. *
  57. * @sa @ref ble_gattc_characteristics_discover_rsp_enc for response encoding.
  58. *
  59. * @param[in] p_buf Pointer to beginning of command request packet.
  60. * @param[in] packet_len Length (in bytes) of response packet.
  61. * @param[out] p_conn_handle Pointer to connection handle.
  62. * @param[out] pp_handle_range Pointer to pointer to handle range.
  63. *
  64. * @retval NRF_SUCCESS Decoding success.
  65. * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
  66. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  67. * @retval NRF_ERROR_INVALID_DATA Decoding failure. Invalid value for handle range field present.
  68. */
  69. uint32_t ble_gattc_characteristics_discover_req_dec
  70. (uint8_t const * const p_buf,
  71. uint16_t packet_len,
  72. uint16_t * const p_conn_handle,
  73. ble_gattc_handle_range_t * * const pp_handle_range);
  74. /**@brief Encodes @ref sd_ble_gattc_characteristics_discover command response.
  75. *
  76. * @sa @ref ble_gattc_characteristics_discover_req_dec for request decoding.
  77. *
  78. * @param[in] return_code Return code indicating if command was successful or not.
  79. * @param[in] p_buf Pointer to buffer where encoded data command response will be
  80. * returned.
  81. * @param[in, out] p_buf_len \c in: size of \p p_buf buffer.
  82. * \c out: Length of encoded command response packet.
  83. *
  84. * @retval NRF_SUCCESS Encoding success.
  85. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  86. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  87. */
  88. uint32_t ble_gattc_characteristics_discover_rsp_enc(uint32_t return_code,
  89. uint8_t * const p_buf,
  90. uint32_t * const p_buf_len);
  91. /**@brief Decodes @ref sd_ble_gattc_descriptors_discover command request.
  92. *
  93. * @sa @ref ble_gattc_descriptors_discover_rsp_enc for response encoding.
  94. *
  95. * @param[in] p_buf Pointer to beginning of command request packet.
  96. * @param[in] packet_len Length (in bytes) of response packet.
  97. * @param[out] p_conn_handle Pointer to connection handle.
  98. * @param[out] pp_handle_range Pointer to pointer to handle range.
  99. *
  100. * @retval NRF_SUCCESS Decoding success.
  101. * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
  102. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  103. * @retval NRF_ERROR_INVALID_DATA Decoding failure. Invalid value for handle range field present.
  104. */
  105. uint32_t ble_gattc_descriptors_discover_req_dec(uint8_t const * const p_buf,
  106. uint16_t packet_len,
  107. uint16_t * const p_conn_handle,
  108. ble_gattc_handle_range_t * * const pp_handle_range);
  109. /**@brief Encodes @ref sd_ble_gattc_descriptors_discover command response.
  110. *
  111. * @sa @ref ble_gattc_descriptors_discover_req_dec for request decoding.
  112. *
  113. * @param[in] return_code Return code indicating if command was successful or not.
  114. * @param[in] p_buf Pointer to buffer where encoded data command response will be
  115. * returned.
  116. * @param[in, out] p_buf_len \c in: size of \p p_buf buffer.
  117. * \c out: Length of encoded command response packet.
  118. *
  119. * @retval NRF_SUCCESS Encoding success.
  120. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  121. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  122. */
  123. uint32_t ble_gattc_descriptors_discover_rsp_enc(uint32_t return_code,
  124. uint8_t * const p_buf,
  125. uint32_t * const p_buf_len);
  126. /**@brief Decodes @ref sd_ble_gattc_relationships_discover command request.
  127. *
  128. * @sa @ref ble_gattc_relationships_discover_rsp_enc for response encoding.
  129. *
  130. * @param[in] p_buf Pointer to beginning of command request packet.
  131. * @param[in] packet_len Length (in bytes) of response packet.
  132. * @param[out] p_conn_handle Pointer to connection handle.
  133. * @param[out] pp_handle_range Pointer to pointer to handle range.
  134. *
  135. * @retval NRF_SUCCESS Decoding success.
  136. * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
  137. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  138. * @retval NRF_ERROR_INVALID_DATA Decoding failure. Invalid value for handle range field present.
  139. */
  140. uint32_t ble_gattc_relationships_discover_req_dec
  141. (uint8_t const * const p_buf,
  142. uint16_t packet_len,
  143. uint16_t * const p_conn_handle,
  144. ble_gattc_handle_range_t * * const pp_handle_range);
  145. /**@brief Encodes @ref sd_ble_gattc_relationships_discover command response.
  146. *
  147. * @sa @ref ble_gattc_relationships_discover_req_dec for request decoding.
  148. *
  149. * @param[in] return_code Return code indicating if command was successful or not.
  150. * @param[in] p_buf Pointer to buffer where encoded data command response will be
  151. * returned.
  152. * @param[in, out] p_buf_len \c in: size of \p p_buf buffer.
  153. * \c out: Length of encoded command response packet.
  154. *
  155. * @retval NRF_SUCCESS Encoding success.
  156. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  157. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  158. */
  159. uint32_t ble_gattc_relationships_discover_rsp_enc(uint32_t return_code,
  160. uint8_t * const p_buf,
  161. uint32_t * const p_buf_len);
  162. /**@brief Decodes @ref sd_ble_gattc_primary_services_discover command request.
  163. *
  164. * @sa @ref ble_gattc_primary_services_discover_rsp_enc for response encoding.
  165. *
  166. * @param[in] p_buf Pointer to beginning of command request packet.
  167. * @param[in] packet_len Length (in bytes) of response packet.
  168. * @param[out] p_conn_handle Pointer to connection handle.
  169. * @param[out] p_start_handle Pointer to start handle.
  170. * @param[out] pp_srvc_uuid Pointer to pointer to service uuid.
  171. *
  172. * @retval NRF_SUCCESS Decoding success.
  173. * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
  174. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  175. * @retval NRF_ERROR_INVALID_DATA Decoding failure. Invalid value for uuid field present.
  176. */
  177. uint32_t ble_gattc_primary_services_discover_req_dec(uint8_t const * const p_buf,
  178. uint16_t packet_len,
  179. uint16_t * const p_conn_handle,
  180. uint16_t * const p_start_handle,
  181. ble_uuid_t * * const pp_srvc_uuid);
  182. /**@brief Encodes @ref sd_ble_gattc_primary_services_discover command response.
  183. *
  184. * @sa @ref ble_gattc_primary_services_discover_req_dec for request decoding.
  185. *
  186. * @param[in] return_code Return code indicating if command was successful or not.
  187. * @param[in] p_buf Pointer to buffer where encoded data command response will be
  188. * returned.
  189. * @param[in, out] p_buf_len \c in: size of \p p_buf buffer.
  190. * \c out: Length of encoded command response packet.
  191. *
  192. * @retval NRF_SUCCESS Encoding success.
  193. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  194. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  195. */
  196. uint32_t ble_gattc_primary_services_discover_rsp_enc(uint32_t return_code,
  197. uint8_t * const p_buf,
  198. uint32_t * const p_buf_len);
  199. /**@brief Decodes @ref sd_ble_gattc_read command request.
  200. *
  201. * @sa @ref ble_gattc_read_rsp_enc for response encoding.
  202. *
  203. * @param[in] p_buf Pointer to beginning of command response packet.
  204. * @param[in] packet_len Length (in bytes) of response packet.
  205. * @param[out] p_conn_handle Pointer to connection handle.
  206. * @param[out] p_handle Pointer to handle.
  207. * @param[out] p_offset Pointer to offset.
  208. *
  209. * @retval NRF_SUCCESS Decoding success.
  210. * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
  211. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  212. */
  213. uint32_t ble_gattc_read_req_dec(uint8_t const * const p_buf,
  214. uint16_t packet_len,
  215. uint16_t * const p_conn_handle,
  216. uint16_t * const p_handle,
  217. uint16_t * const p_offset);
  218. /**@brief Encodes @ref sd_ble_gattc_read command response.
  219. *
  220. * @sa @ref ble_gattc_read_req_dec for request decoding.
  221. *
  222. * @param[in] return_code Return code indicating if command was successful or not.
  223. * @param[in] p_buf Pointer to buffer where encoded data command response will be
  224. * returned.
  225. * @param[in, out] p_buf_len \c in: size of \p p_buf buffer.
  226. * \c out: Length of encoded command response packet.
  227. *
  228. * @retval NRF_SUCCESS Encoding success.
  229. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  230. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  231. */
  232. uint32_t ble_gattc_read_rsp_enc(uint32_t return_code,
  233. uint8_t * const p_buf,
  234. uint32_t * const p_buf_len);
  235. /**@brief Decodes @ref sd_ble_gattc_char_values_read command request.
  236. *
  237. * @sa @ref ble_gattc_char_values_read_rsp_enc for response encoding.
  238. *
  239. * @param[in] p_buf Pointer to beginning of command response packet.
  240. * @param[in] packet_len Length (in bytes) of response packet.
  241. * @param[out] p_conn_handle Pointer to connection handle.
  242. * @param[out] pp_handles Pointer to pointer to handle table.
  243. * @param[out] p_handle_count Pointer to handle handle table count.
  244. *
  245. * @retval NRF_SUCCESS Decoding success.
  246. * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
  247. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  248. */
  249. uint32_t ble_gattc_char_values_read_req_dec(uint8_t const * const p_buf,
  250. uint16_t packet_len,
  251. uint16_t * const p_conn_handle,
  252. uint16_t * * const pp_handles,
  253. uint16_t * const p_handle_count);
  254. /**@brief Encodes @ref sd_ble_gattc_char_values_read command response.
  255. *
  256. * @sa @ref ble_gattc_char_values_read_req_dec for request decoding.
  257. *
  258. * @param[in] return_code Return code indicating if command was successful or not.
  259. * @param[in] p_buf Pointer to buffer where encoded data command response will be
  260. * returned.
  261. * @param[in, out] p_buf_len \c in: size of \p p_buf buffer.
  262. * \c out: Length of encoded command response packet.
  263. *
  264. * @retval NRF_SUCCESS Encoding success.
  265. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  266. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  267. */
  268. uint32_t ble_gattc_char_values_read_rsp_enc(uint32_t return_code,
  269. uint8_t * const p_buf,
  270. uint32_t * const p_buf_len);
  271. /**@brief Decodes @ref sd_ble_gattc_write command request.
  272. *
  273. * @sa @ref ble_gattc_write_rsp_enc for response encoding.
  274. *
  275. * @param[in] p_buf Pointer to beginning of command response packet.
  276. * @param[in] packet_len Length (in bytes) of response packet.
  277. * @param[out] p_conn_handle Pointer to connection handle.
  278. * @param[out] pp_write_params Pointer to pointer to write parameters.
  279. *
  280. * @retval NRF_SUCCESS Decoding success.
  281. * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
  282. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  283. */
  284. uint32_t ble_gattc_write_req_dec(uint8_t const * const p_buf,
  285. uint16_t packet_len,
  286. uint16_t * const p_conn_handle,
  287. ble_gattc_write_params_t * * const pp_write_params);
  288. /**@brief Encodes @ref sd_ble_gattc_write command response.
  289. *
  290. * @sa @ref ble_gattc_write_req_dec for request decoding.
  291. *
  292. * @param[in] return_code Return code indicating if command was successful or not.
  293. * @param[in] p_buf Pointer to buffer where encoded data command response will be
  294. * returned.
  295. * @param[in, out] p_buf_len \c in: size of \p p_buf buffer.
  296. * \c out: Length of encoded command response packet.
  297. *
  298. * @retval NRF_SUCCESS Encoding success.
  299. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  300. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  301. */
  302. uint32_t ble_gattc_write_rsp_enc(uint32_t return_code,
  303. uint8_t * const p_buf,
  304. uint32_t * const p_buf_len);
  305. /**@brief Decodes @ref sd_ble_gattc_hv_confirm command request.
  306. *
  307. * @sa @ref ble_gattc_hv_confirm_rsp_enc for response encoding.
  308. *
  309. * @param[in] p_buf Pointer to beginning of command response packet.
  310. * @param[in] packet_len Length (in bytes) of response packet.
  311. * @param[out] p_conn_handle Pointer to connection handle.
  312. * @param[out] p_handle Pointer to handle of the attribute in the indication.
  313. *
  314. * @retval NRF_SUCCESS Decoding success.
  315. * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
  316. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  317. */
  318. uint32_t ble_gattc_hv_confirm_req_dec(uint8_t const * const p_buf,
  319. uint32_t packet_len,
  320. uint16_t * const p_conn_handle,
  321. uint16_t * const p_handle);
  322. /**@brief Encodes @ref sd_ble_gattc_hv_confirm command response.
  323. *
  324. * @sa @ref ble_gattc_hv_confirm_req_dec for request decoding.
  325. *
  326. * @param[in] return_code Return code indicating if command was successful or not.
  327. * @param[in] p_buf Pointer to buffer where encoded data command response will be
  328. * returned.
  329. * @param[in, out] p_buf_len \c in: size of \p p_buf buffer.
  330. * \c out: Length of encoded command response packet.
  331. *
  332. * @retval NRF_SUCCESS Encoding success.
  333. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  334. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  335. */
  336. uint32_t ble_gattc_hv_confirm_rsp_enc(uint32_t return_code,
  337. uint8_t * const p_buf,
  338. uint32_t * const p_buf_len);
  339. /**@brief Decodes @ref sd_ble_gattc_char_value_by_uuid_read command request.
  340. *
  341. * @sa @ref ble_gattc_char_value_by_uuid_read_rsp_enc for response encoding.
  342. *
  343. * @param[in] p_buf Pointer to beginning of command request packet.
  344. * @param[in] packet_len Length (in bytes) of request packet.
  345. * @param[out] p_conn_handle Pointer to connection handle of the connection.
  346. * @param[out] pp_uuid Pointer to pointer to a characteristic value UUID to read.
  347. * @param[out] pp_handle_range Pointer to pointer to the range of handles to perform this
  348. * procedure on.
  349. *
  350. * @retval NRF_SUCCESS Decoding success.
  351. * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
  352. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  353. * @retval NRF_ERROR_INVALID_DATA Decoding failure. Invalid operation type.
  354. */
  355. uint32_t ble_gattc_char_value_by_uuid_read_req_dec
  356. (uint8_t const * const p_buf,
  357. uint16_t packet_len,
  358. uint16_t * const p_conn_handle,
  359. ble_uuid_t * * const pp_uuid,
  360. ble_gattc_handle_range_t * * const pp_handle_range);
  361. /**@brief Encodes @ref sd_ble_gattc_char_value_by_uuid_read command response.
  362. *
  363. * @sa @ref ble_gattc_char_value_by_uuid_read_req_dec for request decoding.
  364. *
  365. * @param[in] return_code Return code indicating if command was successful or not.
  366. * @param[in] p_buf Pointer to buffer where encoded data command response will be
  367. * returned.
  368. * @param[in, out] p_buf_len \c in: size of \p p_buf buffer.
  369. * \c out: Length of encoded command response packet.
  370. *
  371. * @retval NRF_SUCCESS Encoding success.
  372. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  373. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  374. */
  375. uint32_t ble_gattc_char_value_by_uuid_read_rsp_enc(uint32_t return_code,
  376. uint8_t * const p_buf,
  377. uint32_t * const p_buf_len);
  378. /**@brief Decodes @ref sd_ble_gattc_attr_info_discover command request.
  379. *
  380. * @sa @ref ble_gattc_attr_info_discover_rsp_enc for response encoding.
  381. *
  382. * @param[in] p_buf Pointer to beginning of command request packet.
  383. * @param[in] buf_len Length (in bytes) of request packet.
  384. * @param[out] p_conn_handle Pointer to connection handle of the connection.
  385. * @param[out] pp_handle_range Pointer to pointer to the range of handles.
  386. *
  387. * @retval NRF_SUCCESS Decoding success.
  388. * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
  389. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  390. * @retval NRF_ERROR_INVALID_DATA Decoding failure. Invalid operation type.
  391. */
  392. uint32_t ble_gattc_attr_info_discover_req_dec(uint8_t const * const p_buf,
  393. uint16_t buf_len,
  394. uint16_t * const p_conn_handle,
  395. ble_gattc_handle_range_t * * const pp_handle_range);
  396. /**@brief Encodes @ref sd_ble_gattc_attr_info_discover command response.
  397. *
  398. * @sa @ref ble_gattc_attr_info_discover_req_dec for request decoding.
  399. *
  400. * @param[in] return_code Return code indicating if command was successful or not.
  401. * @param[in] p_buf Pointer to buffer where encoded data command response will be
  402. * returned.
  403. * @param[in, out] p_buf_len \c in: size of \p p_buf buffer.
  404. * \c out: Length of encoded command response packet.
  405. *
  406. * @retval NRF_SUCCESS Encoding success.
  407. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  408. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  409. */
  410. uint32_t ble_gattc_attr_info_discover_rsp_enc(uint32_t return_code,
  411. uint8_t * const p_buf,
  412. uint32_t * const p_buf_len);
  413. /**@brief Decodes @ref sd_ble_gattc_exchange_mtu_request command request.
  414. *
  415. * @sa @ref ble_gattc_exchange_mtu_request_rsp_enc for response encoding.
  416. *
  417. * @param[in] p_buf Pointer to beginning of command request packet.
  418. * @param[in] packet_len Length (in bytes) of request packet.
  419. * @param[out] p_conn_handle Pointer to connection handle of the connection.
  420. * @param[out] p_client_rx_mtu Pointer to Client RX MTU size.
  421. *
  422. * @retval NRF_SUCCESS Decoding success.
  423. * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
  424. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  425. * @retval NRF_ERROR_INVALID_DATA Decoding failure. Invalid operation type.
  426. */
  427. uint32_t ble_gattc_exchange_mtu_request_req_dec(uint8_t const * const p_buf,
  428. uint16_t packet_len,
  429. uint16_t * const p_conn_handle,
  430. uint16_t * const p_client_rx_mtu);
  431. /**@brief Encodes @ref sd_ble_gattc_exchange_mtu_request command response.
  432. *
  433. * @sa @ref ble_gattc_exchange_mtu_request_req_dec for request decoding.
  434. *
  435. * @param[in] return_code Return code indicating if command was successful or not.
  436. * @param[in] p_buf Pointer to buffer where encoded data command response will be
  437. * returned.
  438. * @param[in, out] p_buf_len \c in: size of \p p_buf buffer.
  439. * \c out: Length of encoded command response packet.
  440. *
  441. * @retval NRF_SUCCESS Encoding success.
  442. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  443. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  444. */
  445. uint32_t ble_gattc_exchange_mtu_request_rsp_enc(uint32_t return_code,
  446. uint8_t * const p_buf,
  447. uint32_t * const p_buf_len);
  448. /** @} */
  449. #ifdef __cplusplus
  450. }
  451. #endif
  452. #endif