ble_gap_conn.h 80 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532
  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_GAP_CONN_H__
  41. #define BLE_GAP_CONN_H__
  42. /**@file
  43. *
  44. * @defgroup ble_gap_conn GAP Connectivity command request decoders and command response encoders
  45. * @{
  46. * @ingroup ser_conn_s130_codecs
  47. *
  48. * @brief GAP Connectivity command request decoders and command response encoders
  49. */
  50. #include "ble_gap.h"
  51. #ifdef __cplusplus
  52. extern "C" {
  53. #endif
  54. /**@brief Decodes @ref sd_ble_gap_authenticate command request.
  55. *
  56. * @sa @ref ble_gap_authenticate_rsp_enc for response encoding.
  57. *
  58. * @param[in] p_buf Pointer to beginning of command request packet.
  59. * @param[in] packet_len Length (in bytes) of response packet.
  60. * @param[out] p_conn_handle Pointer to connection handle
  61. * @param[out] pp_sec_params Pointer to pointer to security parameters.
  62. *
  63. * @retval NRF_SUCCESS Decoding success.
  64. * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
  65. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  66. * @retval NRF_ERROR_INVALID_PARAM Decoding failure. Invalid operation type.
  67. */
  68. uint32_t ble_gap_authenticate_req_dec(uint8_t const * const p_buf,
  69. uint32_t packet_len,
  70. uint16_t * const p_conn_handle,
  71. ble_gap_sec_params_t * * const pp_sec_params);
  72. /**@brief Encodes @ref sd_ble_gap_authenticate command response.
  73. *
  74. * @sa @ref ble_gap_authenticate_req_dec for request decoding.
  75. *
  76. * @param[in] return_code Return code indicating if command was successful or not.
  77. * @param[out] p_buf Pointer to buffer where encoded data command response will be
  78. * returned.
  79. * @param[in,out] p_buf_len \c in: size of \p p_buf buffer.
  80. * \c out: Length of encoded command response packet.
  81. *
  82. * @retval NRF_SUCCESS Encoding success.
  83. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  84. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  85. */
  86. uint32_t ble_gap_authenticate_rsp_enc(uint32_t return_code,
  87. uint8_t * const p_buf,
  88. uint32_t * const p_buf_len);
  89. #if defined(NRF_SD_BLE_API_VERSION) && (NRF_SD_BLE_API_VERSION <= 5)
  90. /**@brief Decodes @ref sd_ble_gap_adv_data_set command request.
  91. *
  92. * @sa @ref ble_gap_adv_data_set_rsp_enc for response encoding.
  93. *
  94. * @param[in] p_buf Pointer to beginning of command request packet.
  95. * @param[in] packet_len Length (in bytes) of request packet.
  96. * @param[out] pp_data Pointer to the buffer raw data to be placed in advertisement packet.
  97. * @param[out] p_dlen Pointer to data length for p_data.
  98. * @param[out] pp_sr_data Pointer to the buffer raw data to be placed in scan response packet.
  99. * @param[out] p_srdlen Pointer to data length for p_sr_data.
  100. *
  101. * @retval NRF_SUCCESS Decoding success.
  102. * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
  103. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  104. */
  105. uint32_t ble_gap_adv_data_set_req_dec(uint8_t const * const p_buf,
  106. uint32_t packet_len,
  107. uint8_t * * const pp_data,
  108. uint8_t * p_dlen,
  109. uint8_t * * const pp_sr_data,
  110. uint8_t * p_srdlen);
  111. /**@brief Encodes @ref sd_ble_gap_adv_data_set command response.
  112. *
  113. * @sa @ref ble_gap_adv_data_set_req_dec for request decoding.
  114. *
  115. * @param[in] return_code Return code indicating if command was successful or not.
  116. * @param[out] p_buf Pointer to buffer where encoded data command response will be
  117. * returned.
  118. * @param[in,out] p_buf_len \c in: size of \p p_buf buffer.
  119. * \c out: Length of encoded command response packet.
  120. *
  121. * @retval NRF_SUCCESS Encoding success.
  122. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  123. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  124. */
  125. uint32_t ble_gap_adv_data_set_rsp_enc(uint32_t return_code,
  126. uint8_t * const p_buf,
  127. uint32_t * const p_buf_len);
  128. #endif
  129. /**@brief Decodes @ref sd_ble_gap_adv_start command request.
  130. *
  131. * @sa @ref ble_gap_adv_start_rsp_enc for response encoding.
  132. *
  133. * @param[in] p_buf Pointer to beginning of command request packet.
  134. * @param[in] packet_len Length (in bytes) of response packet.
  135. * @param[out] pp_adv_params Pointer to pointer to advertising parameters.
  136. *
  137. * @retval NRF_SUCCESS Decoding success.
  138. * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
  139. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  140. * @retval NRF_ERROR_INVALID_PARAM Decoding failure. Invalid operation type.
  141. */
  142. uint32_t ble_gap_adv_start_req_dec(uint8_t const * const p_buf,
  143. uint32_t packet_len,
  144. #if NRF_SD_BLE_API_VERSION > 5
  145. uint8_t * p_adv_handle
  146. #else
  147. ble_gap_adv_params_t * * const pp_adv_params
  148. #endif
  149. #if NRF_SD_BLE_API_VERSION >= 4
  150. ,uint8_t * p_conn_cfg_tag
  151. #endif
  152. );
  153. /**@brief Encodes @ref sd_ble_gap_adv_start command response.
  154. *
  155. * @sa @ref ble_gap_adv_start_req_dec for request decoding.
  156. *
  157. * @param[in] return_code Return code indicating if command was successful or not.
  158. * @param[out] p_buf Pointer to buffer where encoded data command response will be
  159. * returned.
  160. * @param[in,out] p_buf_len \c in: size of \p p_buf buffer.
  161. * \c out: Length of encoded command response packet.
  162. *
  163. * @retval NRF_SUCCESS Encoding success.
  164. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  165. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  166. */
  167. uint32_t ble_gap_adv_start_rsp_enc(uint32_t return_code,
  168. uint8_t * const p_buf,
  169. uint32_t * const p_buf_len);
  170. /**@brief Decodes @ref sd_ble_gap_device_name_get command request.
  171. *
  172. * @sa @ref ble_gap_device_name_get_rsp_enc for response encoding.
  173. *
  174. * @param[in] p_buf Pointer to beginning of command request packet.
  175. * @param[in] packet_len Length (in bytes) of response packet.
  176. * @param[out] pp_dev_name Pointer to pointer to device name buffer.
  177. * @param[out] pp_dev_name_len Pointer to pointer to device name length location.
  178. *
  179. * @retval NRF_SUCCESS Decoding success.
  180. * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
  181. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  182. */
  183. uint32_t ble_gap_device_name_get_req_dec(uint8_t const * const p_buf,
  184. uint32_t packet_len,
  185. uint8_t * * pp_dev_name,
  186. uint16_t * * pp_dev_name_len);
  187. /**@brief Encodes @ref sd_ble_gap_device_name_get command response.
  188. *
  189. * @param[in] return_code Return code indicating if command was successful or not.
  190. * @param[in] p_dev_name Pointer to device name buffer.
  191. * @param[in] p_dev_name_len Length of device name buffer.
  192. * @param[in] cpy_len Amount of data to be copied to device name buffer.
  193. * @param[in] p_buf Pointer to buffer where encoded data command response will be
  194. * returned.
  195. * @param[in, out] p_buf_len \c in: size of \p p_buf buffer.
  196. * \c out: Length of encoded command response packet.
  197. *
  198. * @retval NRF_SUCCESS Encoding success.
  199. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  200. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  201. */
  202. uint32_t ble_gap_device_name_get_rsp_enc(uint32_t return_code,
  203. uint8_t const * const p_dev_name,
  204. uint16_t * p_dev_name_len,
  205. uint16_t cpy_len,
  206. uint8_t * const p_buf,
  207. uint32_t * const p_buf_len);
  208. /**@brief Decodes @ref sd_ble_gap_conn_param_update command request.
  209. *
  210. * @sa @ref ble_gap_conn_param_update_rsp_enc for response encoding.
  211. *
  212. * @param[in] p_buf Pointer to beginning of command request packet.
  213. * @param[in] packet_len Length (in bytes) of response packet.
  214. * @param[out] p_conn_handle Pointer to connection handle.
  215. * @param[out] pp_conn_params Pointer to pointer to connection parameters.
  216. *
  217. * @retval NRF_SUCCESS Decoding success.
  218. * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
  219. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  220. * @retval NRF_ERROR_INVALID_PARAM Decoding failure. Invalid operation type.
  221. * @retval NRF_ERROR_INVALID_DATA Decoding failure. Invalid value for connection
  222. * parameters field present.
  223. */
  224. uint32_t ble_gap_conn_param_update_req_dec(uint8_t const * const p_buf,
  225. uint32_t packet_len,
  226. uint16_t * p_conn_handle,
  227. ble_gap_conn_params_t * * const pp_conn_params);
  228. /**@brief Encodes @ref sd_ble_gap_conn_param_update command response.
  229. *
  230. * @param[in] return_code Return code indicating if command was successful or not.
  231. * @param[in] p_buf Pointer to buffer where encoded data command response will be
  232. * returned.
  233. * @param[in, out] p_buf_len \c in: size of \p p_buf buffer.
  234. * \c out: Length of encoded command response packet.
  235. *
  236. * @retval NRF_SUCCESS Encoding success.
  237. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  238. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  239. */
  240. uint32_t ble_gap_conn_param_update_rsp_enc(uint32_t return_code,
  241. uint8_t * const p_buf,
  242. uint32_t * const p_buf_len);
  243. /**@brief Decodes @ref sd_ble_gap_disconnect command request.
  244. *
  245. * @sa @ref ble_gap_disconnect_rsp_enc for response encoding.
  246. *
  247. * @param[in] p_buf Pointer to beginning of command request packet.
  248. * @param[in] packet_len Length (in bytes) of response packet.
  249. * @param[in] p_conn_handle Pointer to Connection Handle.
  250. * @param[in] p_hci_status Pointer to HCI Status Code.
  251. *
  252. * @retval NRF_SUCCESS Decoding success.
  253. * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
  254. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  255. * @retval NRF_ERROR_INVALID_PARAM Decoding failure. Invalid operation type.
  256. */
  257. uint32_t ble_gap_disconnect_req_dec(uint8_t const * const p_buf,
  258. uint32_t packet_len,
  259. uint16_t * const p_conn_handle,
  260. uint8_t * const p_hci_status);
  261. /**@brief Encodes @ref sd_ble_gap_disconnect command response.
  262. *
  263. * @param[in] return_code Return code indicating if command was successful or not.
  264. * @param[in] p_buf Pointer to buffer where encoded data command response will be
  265. * returned.
  266. * @param[in, out] p_buf_len \c in: size of \p p_buf buffer.
  267. * \c out: Length of encoded command response packet.
  268. *
  269. * @retval NRF_SUCCESS Encoding success.
  270. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  271. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  272. */
  273. uint32_t ble_gap_disconnect_rsp_enc(uint32_t return_code,
  274. uint8_t * const p_buf,
  275. uint32_t * const p_buf_len);
  276. /**@brief Decodes @ref sd_ble_gap_tx_power_set command request.
  277. *
  278. * @sa @ref ble_gap_tx_power_set_rsp_enc for response encoding.
  279. *
  280. * @param[in] p_buf Pointer to beginning of command request packet.
  281. * @param[in] packet_len Length (in bytes) of response packet.
  282. * @param[in] p_tx_power Pointer to TX power value.
  283. *
  284. * @retval NRF_SUCCESS Decoding success.
  285. * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
  286. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  287. * @retval NRF_ERROR_INVALID_PARAM Decoding failure. Invalid operation type.
  288. */
  289. uint32_t ble_gap_tx_power_set_req_dec(uint8_t const * const p_buf,
  290. uint32_t packet_len,
  291. #if NRF_SD_BLE_API_VERSION > 5
  292. uint8_t * p_role, uint16_t * p_handle,
  293. #endif
  294. int8_t * p_tx_power);
  295. /**@brief Encodes @ref sd_ble_gap_tx_power_set command response.
  296. *
  297. * @param[in] return_code Return code indicating if command was successful or not.
  298. * @param[in] p_buf Pointer to buffer where encoded data command response will be
  299. * returned.
  300. * @param[in, out] p_buf_len \c in: size of \p p_buf buffer.
  301. * \c out: Length of encoded command response packet.
  302. *
  303. * @retval NRF_SUCCESS Encoding success.
  304. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  305. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  306. */
  307. uint32_t ble_gap_tx_power_set_rsp_enc(uint32_t return_code,
  308. uint8_t * const p_buf,
  309. uint32_t * const p_buf_len);
  310. /**@brief Decodes @ref sd_ble_gap_ppcp_set command request.
  311. *
  312. * @sa @ref ble_gap_ppcp_set_rsp_enc for response encoding.
  313. *
  314. * @param[in] p_buf Pointer to beginning of command request packet.
  315. * @param[in] packet_len Length (in bytes) of response packet.
  316. * @param[out] pp_conn_params Pointer to pointer to connection parameters to be set.
  317. *
  318. * @retval NRF_SUCCESS Decoding success.
  319. * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
  320. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  321. * @retval NRF_ERROR_INVALID_PARAM Decoding failure. Invalid operation type.
  322. * @retval NRF_ERROR_INVALID_DATA Decoding failure. Invalid value for connection
  323. * parameters field present.
  324. */
  325. uint32_t ble_gap_ppcp_set_req_dec(uint8_t const * const p_buf,
  326. uint32_t packet_len,
  327. ble_gap_conn_params_t * * const pp_conn_params);
  328. /**@brief Encodes @ref sd_ble_gap_ppcp_set command response.
  329. *
  330. * @param[in] return_code Return code indicating if command was successful or not.
  331. * @param[in] p_buf Pointer to buffer where encoded data command response will be
  332. * returned.
  333. * @param[in, out] p_buf_len \c in: size of \p p_buf buffer.
  334. * \c out: Length of encoded command response packet.
  335. *
  336. * @retval NRF_SUCCESS Encoding success.
  337. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  338. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  339. */
  340. uint32_t ble_gap_ppcp_set_rsp_enc(uint32_t return_code,
  341. uint8_t * const p_buf,
  342. uint32_t * const p_buf_len);
  343. /**@brief Decodes @ref sd_ble_gap_ppcp_get command request.
  344. *
  345. * @sa @ref ble_gap_ppcp_get_rsp_enc for response encoding.
  346. *
  347. * @param[in] p_buf Pointer to beginning of command request packet.
  348. * @param[in] packet_len Length (in bytes) of response packet.
  349. * @param[out] pp_conn_params Pointer to pointer to ble_gap_conn_params_t.
  350. *
  351. * @retval NRF_SUCCESS Decoding success.
  352. * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
  353. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  354. * @retval NRF_ERROR_INVALID_PARAM Decoding failure. Invalid operation type.
  355. */
  356. uint32_t ble_gap_ppcp_get_req_dec(uint8_t const * const p_buf,
  357. uint16_t packet_len,
  358. ble_gap_conn_params_t * * const pp_conn_params);
  359. /**@brief Encodes @ref sd_ble_gap_ppcp_get command response.
  360. *
  361. * @sa @ref ble_gap_ppcp_get_req_dec for request decoding.
  362. *
  363. * @param[in] return_code Return code indicating if command was successful or not.
  364. * @param[out] p_buf Pointer to buffer where encoded data command response will be
  365. * returned.
  366. * @param[in,out] p_buf_len \c in: size of \p p_buf buffer.
  367. * \c out: Length of encoded command response packet.
  368. * @param[in] p_conn_params Pointer to ble_gap_conn_params_t.
  369. *
  370. * @retval NRF_SUCCESS Encoding success.
  371. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  372. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  373. */
  374. uint32_t ble_gap_ppcp_get_rsp_enc(uint32_t return_code,
  375. uint8_t * const p_buf,
  376. uint32_t * const p_buf_len,
  377. ble_gap_conn_params_t const * const p_conn_params);
  378. uint32_t ble_gap_adv_stop_req_dec(uint8_t const * const p_buf,
  379. uint16_t packet_len,
  380. uint8_t * p_adv_handle);
  381. /**@brief Encodes @ref sd_ble_gap_adv_stop command response.
  382. *
  383. * @param[in] return_code Return code indicating if command was successful or not.
  384. * @param[in] p_buf Pointer to buffer where encoded data command response will be
  385. * returned.
  386. * @param[in, out] p_buf_len \c in: size of \p p_buf buffer.
  387. * \c out: Length of encoded command response packet.
  388. *
  389. * @retval NRF_SUCCESS Encoding success.
  390. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  391. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  392. */
  393. uint32_t ble_gap_adv_stop_rsp_enc(uint32_t return_code,
  394. uint8_t * const p_buf,
  395. uint32_t * const p_buf_len);
  396. /**@brief Decodes @ref sd_ble_gap_auth_key_reply command request.
  397. *
  398. * @sa @ref ble_gap_auth_key_reply_rsp_enc for response encoding.
  399. *
  400. * @param[in] p_buf Pointer to beginning of command request packet.
  401. * @param[in] packet_len Length (in bytes) of response packet.
  402. * @param[out] p_conn_handle Pointer to connection handle.
  403. * @param[out] p_key_type Pointer to key type.
  404. * @param[out] pp_key Pointer to pointer to buffer for incoming key.
  405. *
  406. * @retval NRF_SUCCESS Decoding success.
  407. * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
  408. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  409. * @retval NRF_ERROR_INVALID_PARAM Decoding failure. Invalid operation type.
  410. */
  411. uint32_t ble_gap_auth_key_reply_req_dec(uint8_t const * const p_buf,
  412. uint16_t packet_len,
  413. uint16_t * p_conn_handle,
  414. uint8_t * p_key_type,
  415. uint8_t * * const pp_key);
  416. /**@brief Encodes @ref sd_ble_gap_auth_key_reply command response.
  417. *
  418. * @param[in] return_code Return code indicating if command was successful or not.
  419. * @param[in] p_buf Pointer to buffer where encoded data command response will be
  420. * returned.
  421. * @param[in, out] p_buf_len \c in: size of \p p_buf buffer.
  422. * \c out: Length of encoded command response packet.
  423. *
  424. * @retval NRF_SUCCESS Encoding success.
  425. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  426. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  427. */
  428. uint32_t ble_gap_auth_key_reply_rsp_enc(uint32_t return_code,
  429. uint8_t * const p_buf,
  430. uint32_t * const p_buf_len);
  431. /**@brief Decodes @ref sd_ble_gap_sec_params_reply command request.
  432. *
  433. * @sa @ref ble_gap_sec_params_reply_rsp_enc for response encoding.
  434. *
  435. * @param[in] p_buf Pointer to beginning of command request packet.
  436. * @param[in] packet_len Length (in bytes) of response packet.
  437. * @param[out] p_conn_handle Pointer to connection handle.
  438. * @param[out] p_sec_status Pointer to security status.
  439. * @param[out] pp_sec_params Pointer to pointer to security parameters structure.
  440. * @param[out] pp_sec_keyset Pointer to pointer to security keyset structure.
  441. *
  442. * @retval NRF_SUCCESS Decoding success.
  443. * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
  444. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  445. * @retval NRF_ERROR_INVALID_PARAM Decoding failure. Invalid operation type.
  446. * @retval NRF_ERROR_INVALID_DATA Decoding failure. Invalid value for connection
  447. * parameters field present.
  448. */
  449. uint32_t ble_gap_sec_params_reply_req_dec(uint8_t const * const p_buf,
  450. uint32_t packet_len,
  451. uint16_t * p_conn_handle,
  452. uint8_t * p_sec_status,
  453. ble_gap_sec_params_t * * const pp_sec_params,
  454. ble_gap_sec_keyset_t * * const pp_sec_keyset);
  455. /**@brief Encodes @ref sd_ble_gap_sec_params_reply command response.
  456. *
  457. * @param[in] return_code Return code indicating if command was successful or not.
  458. * @param[in] p_buf Pointer to buffer where encoded data command response will be
  459. * returned.
  460. * @param[in] p_sec_keyset Pointer to security keyset structure.
  461. * @param[in, out] p_buf_len \c in: size of \p p_buf buffer.
  462. * \c out: Length of encoded command response packet.
  463. *
  464. * @retval NRF_SUCCESS Encoding success.
  465. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  466. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  467. */
  468. uint32_t ble_gap_sec_params_reply_rsp_enc(uint32_t return_code,
  469. uint8_t * const p_buf,
  470. uint32_t * const p_buf_len,
  471. ble_gap_sec_keyset_t * const p_sec_keyset);
  472. /**@brief Decodes @ref sd_ble_gap_rssi_start command request.
  473. *
  474. * @sa @ref ble_gap_rssi_start_rsp_enc for response encoding.
  475. *
  476. * @param[in] p_buf Pointer to beginning of command request packet.
  477. * @param[in] packet_len Length (in bytes) of response packet.
  478. * @param[out] p_conn_handle Pointer to connection handle.
  479. * @param[out] p_threshold_dbm Pointer to threshold in dBm.
  480. * @param[out] p_skip_count Pointer to sample skip count.
  481. *
  482. * @retval NRF_SUCCESS Decoding success.
  483. * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
  484. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  485. * @retval NRF_ERROR_INVALID_PARAM Decoding failure. Invalid operation type.
  486. */
  487. uint32_t ble_gap_rssi_start_req_dec(uint8_t const * const p_buf,
  488. uint32_t packet_len,
  489. uint16_t * p_conn_handle,
  490. uint8_t * p_threshold_dbm,
  491. uint8_t * p_skip_count);
  492. /**@brief Encodes @ref sd_ble_gap_rssi_start command response.
  493. *
  494. * @param[in] return_code Return code indicating if command was successful or not.
  495. * @param[in] p_buf Pointer to buffer where encoded data command response will be
  496. * returned.
  497. * @param[in, out] p_buf_len \c in: size of \p p_buf buffer.
  498. * \c out: Length of encoded command response packet.
  499. *
  500. * @retval NRF_SUCCESS Encoding success.
  501. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  502. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  503. */
  504. uint32_t ble_gap_rssi_start_rsp_enc(uint32_t return_code,
  505. uint8_t * const p_buf,
  506. uint32_t * const p_buf_len);
  507. /**@brief Decodes @ref sd_ble_gap_rssi_stop command request.
  508. *
  509. * @sa @ref ble_gap_rssi_stop_rsp_enc for response encoding.
  510. *
  511. * @param[in] p_buf Pointer to beginning of command request packet.
  512. * @param[in] packet_len Length (in bytes) of response packet.
  513. * @param[out] conn_handle Pointer to connection handle.
  514. *
  515. * @retval NRF_SUCCESS Decoding success.
  516. * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
  517. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  518. * @retval NRF_ERROR_INVALID_PARAM Decoding failure. Invalid operation type.
  519. */
  520. uint32_t ble_gap_rssi_stop_req_dec(uint8_t const * const p_buf,
  521. uint32_t packet_len,
  522. uint16_t * conn_handle);
  523. /**@brief Encodes @ref sd_ble_gap_rssi_stop command response.
  524. *
  525. * @param[in] return_code Return code indicating if command was successful or not.
  526. * @param[in] p_buf Pointer to buffer where encoded data command response will be
  527. * returned.
  528. * @param[in, out] p_buf_len \c in: size of \p p_buf buffer.
  529. * \c out: Length of encoded command response packet.
  530. *
  531. * @retval NRF_SUCCESS Encoding success.
  532. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  533. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  534. */
  535. uint32_t ble_gap_rssi_stop_rsp_enc(uint32_t return_code,
  536. uint8_t * const p_buf,
  537. uint32_t * const p_buf_len);
  538. /**@brief Decodes @ref sd_ble_gap_appearance_get command request.
  539. *
  540. * @sa @ref ble_gap_appearance_get_rsp_enc for response encoding.
  541. *
  542. * @param[in] p_buf Pointer to beginning of command request packet.
  543. * @param[in] packet_len Length (in bytes) of response packet.
  544. * @param[out] pp_appearance Pointer to pointer to uint16_t appearance.
  545. *
  546. * @retval NRF_SUCCESS Decoding success.
  547. * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
  548. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  549. * @retval NRF_ERROR_INVALID_PARAM Decoding failure. Invalid operation type.
  550. */
  551. uint32_t ble_gap_appearance_get_req_dec(uint8_t const * const p_buf,
  552. uint16_t packet_len,
  553. uint16_t * * const pp_appearance);
  554. /**@brief Encodes @ref sd_ble_gap_appearance_get command response.
  555. *
  556. * @sa @ref ble_gap_appearance_get_req_dec for request decoding.
  557. *
  558. * @param[in] return_code Return code indicating if command was successful or not.
  559. * @param[out] p_buf Pointer to buffer where encoded data command response will be
  560. * returned.
  561. * @param[in,out] p_buf_len \c in: size of \p p_buf buffer.
  562. * \c out: Length of encoded command response packet.
  563. * @param[in] p_appearance Pointer to uint16_t appearance.
  564. *
  565. * @retval NRF_SUCCESS Encoding success.
  566. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  567. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  568. */
  569. uint32_t ble_gap_appearance_get_rsp_enc(uint32_t return_code,
  570. uint8_t * const p_buf,
  571. uint32_t * const p_buf_len,
  572. uint16_t const * const p_appearance);
  573. /**@brief Decodes @ref sd_ble_gap_appearance_set command request.
  574. *
  575. * @sa @ref ble_gap_tx_power_set_rsp_enc for response encoding.
  576. *
  577. * @param[in] p_buf Pointer to beginning of command request packet.
  578. * @param[in] buf_len Length (in bytes) of the packet.
  579. * @param[out] p_appearance Pointer to the appearance.
  580. *
  581. * @retval NRF_SUCCESS Decoding success.
  582. * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
  583. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  584. */
  585. uint32_t ble_gap_appearance_set_req_dec(uint8_t const * const p_buf,
  586. uint32_t buf_len,
  587. uint16_t * const p_appearance);
  588. /**@brief Encodes @ref sd_ble_gap_appearance_set command response.
  589. *
  590. * @param[in] return_code Return code indicating if command was successful or not.
  591. * @param[in] p_buf Pointer to buffer where encoded data command response will be
  592. * returned.
  593. * @param[in, out] p_buf_len \c in: size of \p p_buf buffer.
  594. * \c out: Length of encoded command response packet.
  595. *
  596. * @retval NRF_SUCCESS Encoding success.
  597. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  598. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  599. */
  600. uint32_t ble_gap_appearance_set_rsp_enc(uint32_t return_code,
  601. uint8_t * const p_buf,
  602. uint32_t * const p_buf_len);
  603. /**@brief Decodes @ref sd_ble_gap_sec_info_reply command request.
  604. *
  605. * @sa @ref ble_gap_sec_info_reply_rsp_enc for response encoding.
  606. *
  607. * @param[in] p_buf Pointer to beginning of command request packet.
  608. * @param[in] packet_len Length (in bytes) of the packet.
  609. * @param[out] p_conn_handle Pointer to the Connection Handle.
  610. * @param[out] pp_enc_info Pointer to pointer to Encryption Information.
  611. * @param[out] pp_id_info Pointer to pointer to ID Information.
  612. * @param[out] pp_sign_info Pointer to pointer to Signing Information.
  613. *
  614. * @retval NRF_SUCCESS Decoding success.
  615. * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
  616. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  617. */
  618. uint32_t ble_gap_sec_info_reply_req_dec(uint8_t const * const p_buf,
  619. uint16_t packet_len,
  620. uint16_t * p_conn_handle,
  621. ble_gap_enc_info_t * * const pp_enc_info,
  622. ble_gap_irk_t * * const pp_id_info,
  623. ble_gap_sign_info_t * * const pp_sign_info);
  624. /**@brief Encodes @ref sd_ble_gap_sec_info_reply command response.
  625. *
  626. * @param[in] return_code Return code indicating if command was successful or not.
  627. * @param[in] p_buf Pointer to buffer where encoded data command response will be
  628. * returned.
  629. * @param[in, out] p_buf_len \c in: size of \p p_buf buffer.
  630. * \c out: Length of encoded command response packet.
  631. *
  632. * @retval NRF_SUCCESS Encoding success.
  633. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  634. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  635. */
  636. uint32_t ble_gap_sec_info_reply_rsp_enc(uint32_t return_code,
  637. uint8_t * const p_buf,
  638. uint32_t * const p_buf_len);
  639. /**@brief Decodes @ref sd_ble_gap_device_name_set command request.
  640. *
  641. * @sa @ref ble_gap_device_name_set_rsp_enc for response encoding.
  642. *
  643. * @param[in] p_buf Pointer to beginning of command request packet.
  644. * @param[in] packet_len Length (in bytes) of the packet.
  645. * @param[out] pp_write_perm Pointer to pointer to write permissions filed.
  646. * @param[out] pp_dev_name Pointer to pointer to device name string.
  647. * @param[out] p_dev_name_len Pointer to device name string length.
  648. *
  649. * @retval NRF_SUCCESS Decoding success.
  650. * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
  651. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  652. */
  653. uint32_t ble_gap_device_name_set_req_dec(uint8_t const * const p_buf,
  654. uint32_t packet_len,
  655. ble_gap_conn_sec_mode_t * * const pp_write_perm,
  656. uint8_t * * const pp_dev_name,
  657. uint16_t * const p_dev_name_len);
  658. /**@brief Encodes @ref sd_ble_gap_device_name_set command response.
  659. *
  660. * @param[in] return_code Return code indicating if command was successful or not.
  661. * @param[in] p_buf Pointer to buffer where encoded data command response will be
  662. * returned.
  663. * @param[in, out] p_buf_len \c in: size of \p p_buf buffer.
  664. * \c out: Length of encoded command response packet.
  665. *
  666. * @retval NRF_SUCCESS Encoding success.
  667. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  668. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  669. */
  670. uint32_t ble_gap_device_name_set_rsp_enc(uint32_t return_code,
  671. uint8_t * const p_buf,
  672. uint32_t * const p_buf_len);
  673. /**@brief Decodes @ref sd_ble_gap_conn_sec_get command request.
  674. *
  675. * @sa @ref ble_gap_conn_sec_get_rsp_enc for response encoding.
  676. *
  677. * @param[in] p_buf Pointer to beginning of command request packet.
  678. * @param[in] packet_len Length (in bytes) of response packet.
  679. * @param[out] p_conn_handle Pointer to Connection Handle.
  680. * @param[out] pp_conn_sec Pointer to pointer to @ref ble_gap_conn_sec_t to be filled by
  681. * the SoftDevice.
  682. *
  683. * @retval NRF_SUCCESS Decoding success.
  684. * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
  685. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  686. * @retval NRF_ERROR_INVALID_PARAM Decoding failure. Invalid operation type.
  687. */
  688. uint32_t ble_gap_conn_sec_get_req_dec(uint8_t const * const p_buf,
  689. uint32_t packet_len,
  690. uint16_t * p_conn_handle,
  691. ble_gap_conn_sec_t * * const pp_conn_sec);
  692. /**@brief Encodes @ref sd_ble_gap_conn_sec_get command response.
  693. *
  694. * @sa @ref ble_gap_conn_sec_get_req_dec for request decoding.
  695. *
  696. * @param[in] return_code Return code indicating if command was successful or not.
  697. * @param[in] p_conn_sec Pointer to @ref ble_gap_conn_sec_t to be encoded.
  698. * @param[out] p_buf Pointer to buffer where encoded data command response will be
  699. * returned.
  700. * @param[in, out] p_buf_len \c in: size of \p p_buf buffer.
  701. * \c out: Length of encoded command response packet.
  702. *
  703. * @retval NRF_SUCCESS Encoding success.
  704. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  705. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  706. */
  707. uint32_t ble_gap_conn_sec_get_rsp_enc(uint32_t return_code,
  708. ble_gap_conn_sec_t * const p_conn_sec,
  709. uint8_t * const p_buf,
  710. uint32_t * const p_buf_len);
  711. #ifndef S112
  712. /**@brief Encodes @ref sd_ble_gap_scan_stop command response.
  713. *
  714. * @param[in] return_code Return code indicating if command was successful or not.
  715. * @param[in] p_buf Pointer to buffer where encoded data command response will be
  716. * returned.
  717. * @param[in, out] p_buf_len \c in: size of \p p_buf buffer.
  718. * \c out: Length of encoded command response packet.
  719. *
  720. * @retval NRF_SUCCESS Encoding success.
  721. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  722. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  723. */
  724. uint32_t ble_gap_scan_stop_rsp_enc(uint32_t return_code,
  725. uint8_t * const p_buf,
  726. uint32_t * const p_buf_len);
  727. /**@brief Decodes @ref sd_ble_gap_connect command request.
  728. *
  729. * @sa @ref ble_gap_connect_rsp_enc for response encoding.
  730. *
  731. * @param[in] p_buf Pointer to beginning of command request packet.
  732. * @param[in] packet_len Length (in bytes) of response packet.
  733. * @param[out] pp_addr Pointer to pointer to peer address @ref ble_gap_addr_t.
  734. * @param[out] pp_scan_params Pointer to pointer to @ref ble_gap_scan_params_t.
  735. * @param[out] pp_conn_params Pointer to pointer to @ref ble_gap_conn_params_t.
  736. *
  737. * @retval NRF_SUCCESS Decoding success.
  738. * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
  739. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  740. * @retval NRF_ERROR_INVALID_PARAM Decoding failure. Invalid operation type.
  741. */
  742. uint32_t ble_gap_connect_req_dec(uint8_t const * const p_buf,
  743. uint32_t packet_len,
  744. ble_gap_addr_t * * const pp_addr,
  745. ble_gap_scan_params_t * * const pp_scan_params,
  746. ble_gap_conn_params_t * * const pp_conn_params
  747. #if NRF_SD_BLE_API_VERSION >= 4
  748. ,uint8_t * p_conn_cfg_tag
  749. #endif
  750. );
  751. /**@brief Encodes @ref sd_ble_gap_connect command response.
  752. *
  753. * @sa @ref ble_gap_connect_req_dec for request decoding.
  754. *
  755. * @param[in] return_code Return code indicating if command was successful or not.
  756. * @param[out] p_buf Pointer to buffer where encoded data command response will be
  757. * returned.
  758. * @param[in, out] p_buf_len \c in: size of \p p_buf buffer.
  759. * \c out: Length of encoded command response packet.
  760. *
  761. * @retval NRF_SUCCESS Encoding success.
  762. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  763. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  764. */
  765. uint32_t ble_gap_connect_rsp_enc(uint32_t return_code,
  766. uint8_t * const p_buf,
  767. uint32_t * const p_buf_len);
  768. /**@brief Decodes @ref sd_ble_gap_scan_start command request.
  769. *
  770. * @sa @ref ble_gap_scan_start_rsp_enc for response encoding.
  771. *
  772. * @param[in] p_buf Pointer to beginning of command request packet.
  773. * @param[in] packet_len Length (in bytes) of response packet.
  774. * @param[out] pp_scan_params Pointer to pointer to @ref ble_gap_scan_params_t.
  775. *
  776. * @retval NRF_SUCCESS Decoding success.
  777. * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
  778. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  779. * @retval NRF_ERROR_INVALID_PARAM Decoding failure. Invalid operation type.
  780. */
  781. uint32_t ble_gap_scan_start_req_dec(uint8_t const * const p_buf,
  782. uint32_t packet_len,
  783. ble_gap_scan_params_t * * const pp_scan_params
  784. #if defined(NRF_SD_BLE_API_VERSION) && NRF_SD_BLE_API_VERSION > 5
  785. ,ble_data_t * * const pp_adv_report_buffer
  786. #endif
  787. );
  788. /**@brief Encodes @ref sd_ble_gap_scan_start command response.
  789. *
  790. * @sa @ref ble_gap_scan_start_req_dec for request decoding.
  791. *
  792. * @param[in] return_code Return code indicating if command was successful or not.
  793. * @param[out] p_buf Pointer to buffer where encoded data command response will be
  794. * returned.
  795. * @param[in, out] p_buf_len \c in: size of \p p_buf buffer.
  796. * \c out: Length of encoded command response packet.
  797. *
  798. * @retval NRF_SUCCESS Encoding success.
  799. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  800. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  801. */
  802. uint32_t ble_gap_scan_start_rsp_enc(uint32_t return_code,
  803. #if defined(NRF_SD_BLE_API_VERSION) && NRF_SD_BLE_API_VERSION > 5
  804. ble_data_t *p_ble_data,
  805. #endif
  806. uint8_t * const p_buf,
  807. uint32_t * const p_buf_len);
  808. /**@brief Encodes @ref sd_ble_gap_connect_cancel command response.
  809. *
  810. * @param[in] return_code Return code indicating if command was successful or not.
  811. * @param[out] p_buf Pointer to buffer where encoded data command response will be
  812. * returned.
  813. * @param[in, out] p_buf_len \c in: size of \p p_buf buffer.
  814. * \c out: Length of encoded command response packet.
  815. *
  816. * @retval NRF_SUCCESS Encoding success.
  817. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  818. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  819. */
  820. uint32_t ble_gap_connect_cancel_rsp_enc(uint32_t return_code,
  821. uint8_t * const p_buf,
  822. uint32_t * const p_buf_len);
  823. /**@brief Decodes @ref sd_ble_gap_encrypt command request.
  824. *
  825. * @sa @ref ble_gap_encrypt_rsp_enc for response encoding.
  826. *
  827. * @param[in] p_buf Pointer to beginning of command request packet.
  828. * @param[in] packet_len Length (in bytes) of response packet.
  829. * @param[out] p_conn_handle Pointer connection_handle.
  830. * @param[out] pp_master_id Pointer to pointer to @ref ble_gap_master_id_t.
  831. * @param[out] pp_enc_info Pointer to pointer to @ref ble_gap_enc_info_t.
  832. *
  833. * @retval NRF_SUCCESS Decoding success.
  834. * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
  835. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  836. * @retval NRF_ERROR_INVALID_PARAM Decoding failure. Invalid operation type.
  837. */
  838. uint32_t ble_gap_encrypt_req_dec(uint8_t const * const p_buf,
  839. uint16_t packet_len,
  840. uint16_t * const p_conn_handle,
  841. ble_gap_master_id_t ** const pp_master_id,
  842. ble_gap_enc_info_t ** const pp_enc_info);
  843. /**@brief Encodes @ref sd_ble_gap_encrypt command response.
  844. *
  845. * @param[in] return_code Return code indicating if command was successful or not.
  846. * @param[out] p_buf Pointer to buffer where encoded data command response will be
  847. * returned.
  848. * @param[in, out] p_buf_len \c in: size of \p p_buf buffer.
  849. * \c out: Length of encoded command response packet.
  850. *
  851. * @retval NRF_SUCCESS Encoding success.
  852. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  853. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  854. */
  855. uint32_t ble_gap_encrypt_rsp_enc(uint32_t return_code,
  856. uint8_t * const p_buf,
  857. uint32_t * const p_buf_len);
  858. #endif
  859. /**@brief Decodes @ref sd_ble_gap_rssi_get command request.
  860. *
  861. * @sa @ref ble_gap_rssi_get_rsp_enc for response encoding.
  862. *
  863. * @param[in] p_buf Pointer to beginning of command request packet.
  864. * @param[in] packet_len Length (in bytes) of response packet.
  865. * @param[in] p_conn_handle Connection handle.
  866. * @param[out] pp_rssi Pointer to pointer to RSSI value.
  867. *
  868. * @retval NRF_SUCCESS Decoding success.
  869. * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
  870. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  871. * @retval NRF_ERROR_INVALID_PARAM Decoding failure. Invalid operation type.
  872. */
  873. uint32_t ble_gap_rssi_get_req_dec(uint8_t const * const p_buf,
  874. uint16_t packet_len,
  875. uint16_t * p_conn_handle,
  876. int8_t * * const pp_rssi
  877. #if NRF_SD_BLE_API_VERSION > 5
  878. ,uint8_t * * const pp_ch_index
  879. #endif
  880. );
  881. /**@brief Encodes @ref sd_ble_gap_rssi_get command response.
  882. *
  883. * @sa @ref ble_gap_rssi_get_req_dec for request decoding.
  884. *
  885. * @param[in] return_code Return code indicating if command was successful or not.
  886. * @param[out] p_buf Pointer to buffer where encoded data command response will be
  887. * returned.
  888. * @param[in,out] p_buf_len \c in: size of \p p_buf buffer.
  889. * \c out: Length of encoded command response packet.
  890. * @param[in] p_rssi RSSI value.
  891. *
  892. * @retval NRF_SUCCESS Encoding success.
  893. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  894. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  895. */
  896. uint32_t ble_gap_rssi_get_rsp_enc(uint32_t return_code,
  897. uint8_t * const p_buf,
  898. uint32_t * const p_buf_len,
  899. int8_t * p_rssi
  900. #if NRF_SD_BLE_API_VERSION > 5
  901. ,uint8_t * p_ch_index
  902. #endif
  903. );
  904. /**@brief Decodes @ref sd_ble_gap_keypress_notify command request.
  905. *
  906. * @sa @ref ble_gap_keypress_notify_rsp_enc for response encoding.
  907. *
  908. * @param[in] p_buf Pointer to beginning of command request packet.
  909. * @param[in] packet_len Length (in bytes) of response packet.
  910. * @param[out] p_conn_handle Connection handle.
  911. * @param[out] p_kp_not Pointer kp_not value.
  912. *
  913. * @retval NRF_SUCCESS Decoding success.
  914. * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
  915. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  916. * @retval NRF_ERROR_INVALID_PARAM Decoding failure. Invalid operation type.
  917. */
  918. uint32_t ble_gap_keypress_notify_req_dec(uint8_t const * const p_buf,
  919. uint32_t packet_len,
  920. uint16_t * p_conn_handle,
  921. uint8_t * p_kp_not);
  922. /**@brief Encodes @ref sd_ble_gap_keypress_notify command response.
  923. *
  924. * @sa @ref ble_gap_keypress_notify_req_dec for request decoding.
  925. *
  926. * @param[in] return_code Return code indicating if command was successful or not.
  927. * @param[out] p_buf Pointer to buffer where encoded data command response will be
  928. * returned.
  929. * @param[in,out] p_buf_len \c in: size of \p p_buf buffer.
  930. * \c out: Length of encoded command response packet.
  931. *
  932. * @retval NRF_SUCCESS Encoding success.
  933. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  934. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  935. */
  936. uint32_t ble_gap_keypress_notify_rsp_enc(uint32_t return_code,
  937. uint8_t * const p_buf,
  938. uint32_t * const p_buf_len);
  939. /**@brief Decodes @ref sd_ble_gap_lesc_dhkey_reply command request.
  940. *
  941. * @sa @ref ble_gap_lesc_dhkey_reply_rsp_enc for response encoding.
  942. *
  943. * @param[in] p_buf Pointer to beginning of command request packet.
  944. * @param[in] packet_len Length (in bytes) of response packet.
  945. * @param[out] p_conn_handle Connection handle.
  946. * @param[out] pp_dhkey Pointer to pointer to dhkey struct.
  947. *
  948. * @retval NRF_SUCCESS Decoding success.
  949. * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
  950. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  951. * @retval NRF_ERROR_INVALID_PARAM Decoding failure. Invalid operation type.
  952. */
  953. uint32_t ble_gap_lesc_dhkey_reply_req_dec(uint8_t const * const p_buf,
  954. uint32_t packet_len,
  955. uint16_t * p_conn_handle,
  956. ble_gap_lesc_dhkey_t * * pp_dhkey);
  957. /**@brief Encodes @ref sd_ble_gap_lesc_dhkey_reply command response.
  958. *
  959. * @sa @ref ble_gap_lesc_dhkey_reply_req_dec for request decoding.
  960. *
  961. * @param[in] return_code Return code indicating if command was successful or not.
  962. * @param[out] p_buf Pointer to buffer where encoded data command response will be
  963. * returned.
  964. * @param[in,out] p_buf_len \c in: size of \p p_buf buffer.
  965. * \c out: Length of encoded command response packet.
  966. *
  967. * @retval NRF_SUCCESS Encoding success.
  968. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  969. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  970. */
  971. uint32_t ble_gap_lesc_dhkey_reply_rsp_enc(uint32_t return_code,
  972. uint8_t * const p_buf,
  973. uint32_t * const p_buf_len);
  974. /**@brief Decodes @ref sd_ble_gap_lesc_oob_data_set command request.
  975. *
  976. * @sa @ref ble_gap_lesc_oob_data_set_rsp_enc for response encoding.
  977. *
  978. * @param[in] p_buf Pointer to beginning of command request packet.
  979. * @param[in] packet_len Length (in bytes) of response packet.
  980. * @param[out] p_conn_handle Connection handle.
  981. * @param[out] pp_oobd_own Pointer to pointer to own OOB data struct.
  982. * @param[out] pp_oobd_peer Pointer to pointer to peer OOB data struct.
  983. *
  984. * @retval NRF_SUCCESS Decoding success.
  985. * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
  986. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  987. * @retval NRF_ERROR_INVALID_PARAM Decoding failure. Invalid operation type.
  988. */
  989. uint32_t ble_gap_lesc_oob_data_set_req_dec(uint8_t const * const p_buf,
  990. uint32_t packet_len,
  991. uint16_t * p_conn_handle,
  992. ble_gap_lesc_oob_data_t * * pp_oobd_own,
  993. ble_gap_lesc_oob_data_t * * pp_oobd_peer);
  994. /**@brief Encodes @ref sd_ble_gap_lesc_oob_data_set command response.
  995. *
  996. * @sa @ref ble_gap_lesc_oob_data_set_req_dec for request decoding.
  997. *
  998. * @param[in] return_code Return code indicating if command was successful or not.
  999. * @param[out] p_buf Pointer to buffer where encoded data command response will be
  1000. * returned.
  1001. * @param[in,out] p_buf_len \c in: size of \p p_buf buffer.
  1002. * \c out: Length of encoded command response packet.
  1003. *
  1004. * @retval NRF_SUCCESS Encoding success.
  1005. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  1006. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  1007. */
  1008. uint32_t ble_gap_lesc_oob_data_set_rsp_enc(uint32_t return_code,
  1009. uint8_t * const p_buf,
  1010. uint32_t * const p_buf_len);
  1011. /**@brief Decodes @ref sd_ble_gap_lesc_oob_data_get command request.
  1012. *
  1013. * @sa @ref ble_gap_lesc_oob_data_get_rsp_enc for response encoding.
  1014. *
  1015. * @param[in] p_buf Pointer to beginning of command request packet.
  1016. * @param[in] packet_len Length (in bytes) of response packet.
  1017. * @param[out] p_conn_handle Connection handle.
  1018. * @param[out] pp_pk_own Pointer to pointer to PK.
  1019. * @param[out] pp_oobd_own Pointer to pointer to own OOB data struct.
  1020. *
  1021. * @retval NRF_SUCCESS Decoding success.
  1022. * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
  1023. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  1024. * @retval NRF_ERROR_INVALID_PARAM Decoding failure. Invalid operation type.
  1025. */
  1026. uint32_t ble_gap_lesc_oob_data_get_req_dec(uint8_t const * const p_buf,
  1027. uint32_t packet_len,
  1028. uint16_t * p_conn_handle,
  1029. ble_gap_lesc_p256_pk_t * * pp_pk_own,
  1030. ble_gap_lesc_oob_data_t * * pp_oobd_own);
  1031. /**@brief Encodes @ref sd_ble_gap_lesc_oob_data_get command response.
  1032. *
  1033. * @sa @ref ble_gap_lesc_oob_data_get_req_dec for request decoding.
  1034. *
  1035. * @param[in] return_code Return code indicating if command was successful or not.
  1036. * @param[in] p_oobd_own Pointer to OOB data.
  1037. * @param[out] p_buf Pointer to buffer where encoded data command response will be
  1038. * returned.
  1039. * @param[in,out] p_buf_len \c in: size of \p p_buf buffer.
  1040. * \c out: Length of encoded command response packet.
  1041. *
  1042. * @retval NRF_SUCCESS Encoding success.
  1043. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  1044. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  1045. */
  1046. uint32_t ble_gap_lesc_oob_data_get_rsp_enc(uint32_t return_code,
  1047. ble_gap_lesc_oob_data_t * p_oobd_own,
  1048. uint8_t * const p_buf,
  1049. uint32_t * const p_buf_len);
  1050. /**@brief Decodes @ref sd_ble_gap_addr_get command request.
  1051. *
  1052. * @sa @ref ble_gap_addr_get_rsp_enc for response encoding.
  1053. *
  1054. * @param[in] p_buf Pointer to beginning of command request packet.
  1055. * @param[in] packet_len Length (in bytes) of response packet.
  1056. * @param[out] pp_address Pointer to pointer to address.
  1057. *
  1058. * @retval NRF_SUCCESS Decoding success.
  1059. * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
  1060. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  1061. * @retval NRF_ERROR_INVALID_PARAM Decoding failure. Invalid operation type.
  1062. */
  1063. uint32_t ble_gap_addr_get_req_dec(uint8_t const * const p_buf,
  1064. uint16_t packet_len,
  1065. ble_gap_addr_t * * const pp_address);
  1066. /**@brief Encodes @ref sd_ble_gap_addr_get command response.
  1067. *
  1068. * @sa @ref ble_gap_addr_get_req_dec for request decoding.
  1069. *
  1070. * @param[in] return_code Return code indicating if command was successful or not.
  1071. * @param[out] p_buf Pointer to buffer where encoded data command response will be
  1072. * returned.
  1073. * @param[in,out] p_buf_len \c in: size of \p p_buf buffer.
  1074. * \c out: Length of encoded command response packet.
  1075. * @param[in] p_address Pointer to @ref ble_gap_addr_t address
  1076. *
  1077. * @retval NRF_SUCCESS Encoding success.
  1078. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  1079. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  1080. */
  1081. uint32_t ble_gap_addr_get_rsp_enc(uint32_t return_code,
  1082. uint8_t * const p_buf,
  1083. uint32_t * const p_buf_len,
  1084. ble_gap_addr_t const * const p_address);
  1085. /** @brief Decodes @ref sd_ble_gap_addr_set command request.
  1086. *
  1087. * @sa @ref ble_gap_addr_set_rsp_enc for response encoding.
  1088. *
  1089. * @param[in] p_buf Pointer to beginning of command request packet.
  1090. * @param[in] packet_len Length (in bytes) of request packet.
  1091. * @param[out] pp_addr Pointer to pointer to the address structure.
  1092. * @retval NRF_SUCCESS Decoding success.
  1093. * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
  1094. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  1095. */
  1096. uint32_t ble_gap_addr_set_req_dec(uint8_t const * const p_buf,
  1097. uint32_t packet_len,
  1098. ble_gap_addr_t * * const pp_addr);
  1099. /**@brief Encodes @ref sd_ble_gap_addr_set command response.
  1100. *
  1101. * @sa @ref ble_gap_addr_set_req_dec for request decoding.
  1102. *
  1103. * @param[in] return_code Return code indicating if command was successful or not.
  1104. * @param[out] p_buf Pointer to buffer where encoded data command response will be
  1105. * returned.
  1106. * @param[in,out] p_buf_len \c in: size of \p p_buf buffer.
  1107. * \c out: Length of encoded command response packet.
  1108. *
  1109. * @retval NRF_SUCCESS Encoding success.
  1110. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  1111. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  1112. */
  1113. uint32_t ble_gap_addr_set_rsp_enc(uint32_t return_code,
  1114. uint8_t * const p_buf,
  1115. uint32_t * const p_buf_len);
  1116. /** @brief Decodes @ref sd_ble_gap_privacy_set command request.
  1117. *
  1118. * @sa @ref ble_gap_privacy_set_rsp_enc for response encoding.
  1119. *
  1120. * @param[in] p_buf Pointer to beginning of command request packet.
  1121. * @param[in] packet_len Length (in bytes) of request packet.
  1122. * @param[out] pp_privacy_params Pointer to pointer to the privacy settings structure.
  1123. * @retval NRF_SUCCESS Decoding success.
  1124. * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
  1125. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  1126. */
  1127. uint32_t ble_gap_privacy_set_req_dec(uint8_t const * const p_buf,
  1128. uint32_t packet_len,
  1129. ble_gap_privacy_params_t * * const pp_privacy_params);
  1130. /**@brief Encodes @ref sd_ble_gap_privacy_set command response.
  1131. *
  1132. * @sa @ref ble_gap_privacy_set_req_dec for request decoding.
  1133. *
  1134. * @param[in] return_code Return code indicating if command was successful or not.
  1135. * @param[out] p_buf Pointer to buffer where encoded data command response will be
  1136. * returned.
  1137. * @param[in,out] p_buf_len \c in: size of \p p_buf buffer.
  1138. * \c out: Length of encoded command response packet.
  1139. *
  1140. * @retval NRF_SUCCESS Encoding success.
  1141. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  1142. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  1143. */
  1144. uint32_t ble_gap_privacy_set_rsp_enc(uint32_t return_code,
  1145. uint8_t * const p_buf,
  1146. uint32_t * const p_buf_len);
  1147. /** @brief Decodes @ref sd_ble_gap_privacy_get command request.
  1148. *
  1149. * @sa @ref ble_gap_privacy_get_rsp_enc for response encoding.
  1150. *
  1151. * @param[in] p_buf Pointer to beginning of command request packet.
  1152. * @param[in] packet_len Length (in bytes) of request packet.
  1153. * @param[out] pp_privacy_params Pointer to pointer to the privacy settings structure.
  1154. * @retval NRF_SUCCESS Decoding success.
  1155. * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
  1156. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  1157. */
  1158. uint32_t ble_gap_privacy_get_req_dec(uint8_t const * const p_buf,
  1159. uint16_t packet_len,
  1160. ble_gap_privacy_params_t * * const pp_privacy_params);
  1161. /**@brief Encodes @ref sd_ble_gap_privacy_set command response.
  1162. *
  1163. * @sa @ref ble_gap_privacy_set_req_dec for request decoding.
  1164. *
  1165. * @param[in] return_code Return code indicating if command was successful or not.
  1166. * @param[out] p_buf Pointer to buffer where encoded data command response will be
  1167. * returned.
  1168. * @param[in,out] p_buf_len \c in: size of \p p_buf buffer.
  1169. * \c out: Length of encoded command response packet.
  1170. * @param[out] p_privacy_params Pointer to privacy settings structure.
  1171. *
  1172. * @retval NRF_SUCCESS Encoding success.
  1173. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  1174. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  1175. */
  1176. uint32_t ble_gap_privacy_get_rsp_enc(uint32_t return_code,
  1177. uint8_t * const p_buf,
  1178. uint32_t * const p_buf_len,
  1179. ble_gap_privacy_params_t const * const p_privacy_params);
  1180. /** @brief Decodes @ref sd_ble_gap_whitelist_set command request.
  1181. *
  1182. * @sa @ref ble_gap_whitelist_set_rsp_enc for response encoding.
  1183. *
  1184. * @param[in] p_buf Pointer to beginning of command request packet.
  1185. * @param[in] packet_len Length (in bytes) of request packet.
  1186. * @param[out] ppp_wl_addrs Pointer to a whitelist of peer addresses.
  1187. * @param[out] p_len Pointer to a length of the whitelist.
  1188. *
  1189. * @retval NRF_SUCCESS Decoding success.
  1190. * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
  1191. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  1192. */
  1193. uint32_t ble_gap_whitelist_set_req_dec(uint8_t const * const p_buf,
  1194. uint32_t packet_len,
  1195. ble_gap_addr_t * * * const ppp_wl_addrs,
  1196. uint8_t * const p_len);
  1197. /**@brief Encodes @ref sd_ble_gap_whitelist_set command response.
  1198. *
  1199. * @sa @ref ble_gap_whitelist_set_req_dec for request decoding.
  1200. *
  1201. * @param[in] return_code Return code indicating if command was successful or not.
  1202. * @param[out] p_buf Pointer to buffer where encoded data command response will be
  1203. * returned.
  1204. * @param[in,out] p_buf_len \c in: size of \p p_buf buffer.
  1205. * \c out: Length of encoded command response packet.
  1206. *
  1207. * @retval NRF_SUCCESS Encoding success.
  1208. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  1209. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  1210. */
  1211. uint32_t ble_gap_whitelist_set_rsp_enc(uint32_t return_code,
  1212. uint8_t * const p_buf,
  1213. uint32_t * const p_buf_len);
  1214. /** @brief Decodes @ref sd_ble_gap_device_identities_set command request.
  1215. *
  1216. * @sa @ref ble_gap_device_identities_set_rsp_enc for response encoding.
  1217. *
  1218. * @param[in] p_buf Pointer to beginning of command request packet.
  1219. * @param[in] packet_len Length (in bytes) of request packet.
  1220. * @param[out] ppp_id_keys Pointer to an array of peer identity addresses and peer IRKs.
  1221. * @param[out] ppp_local_irks Pointer to an array of local IRKs.
  1222. * @param[out] p_len Pointer to a length of the device identity list.
  1223. *
  1224. * @retval NRF_SUCCESS Decoding success.
  1225. * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
  1226. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  1227. */
  1228. uint32_t ble_gap_device_identities_set_req_dec(uint8_t const * const p_buf,
  1229. uint32_t packet_len,
  1230. ble_gap_id_key_t * * * const ppp_id_keys,
  1231. ble_gap_irk_t * * * const ppp_local_irks,
  1232. uint8_t * const p_len);
  1233. /**@brief Encodes @ref sd_ble_gap_device_identities_set command response.
  1234. *
  1235. * @sa @ref ble_gap_device_identities_set_req_dec for request decoding.
  1236. *
  1237. * @param[in] return_code Return code indicating if command was successful or not.
  1238. * @param[out] p_buf Pointer to buffer where encoded data command response will be
  1239. * returned.
  1240. * @param[in,out] p_buf_len \c in: size of \p p_buf buffer.
  1241. * \c out: Length of encoded command response packet.
  1242. *
  1243. * @retval NRF_SUCCESS Encoding success.
  1244. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  1245. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  1246. */
  1247. uint32_t ble_gap_device_identities_set_rsp_enc(uint32_t return_code,
  1248. uint8_t * const p_buf,
  1249. uint32_t * const p_buf_len);
  1250. #if NRF_SD_BLE_API_VERSION >= 4 && !defined(S112)
  1251. /** @brief Decodes @ref sd_bble_gap_data_length_update command request.
  1252. *
  1253. * @sa @ref ble_gap_data_length_update_rsp_enc for response encoding.
  1254. *
  1255. * @param[in] p_buf Pointer to beginning of command request packet.
  1256. * @param[in] packet_len Length (in bytes) of request packet.
  1257. * @param[out] p_conn_handle Pointer to a connection handle.
  1258. * @param[out] pp_dl_params Pointer to pointer to a data length params structure.
  1259. * @param[out] pp_dl_limitation Pointer to pointer to a data length limitation structure.
  1260. *
  1261. * @retval NRF_SUCCESS Decoding success.
  1262. * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
  1263. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  1264. */
  1265. uint32_t ble_gap_data_length_update_req_dec(uint8_t const * const p_buf,
  1266. uint16_t packet_len,
  1267. uint16_t * p_conn_handle,
  1268. ble_gap_data_length_params_t * * const pp_dl_params,
  1269. ble_gap_data_length_limitation_t * * const pp_dl_limitation);
  1270. /**@brief Encodes @ref sd_ble_gap_data_length_update command response.
  1271. *
  1272. * @sa @ref ble_gap_data_length_update_req_dec for request decoding.
  1273. *
  1274. * @param[in] return_code Return code indicating if command was successful or not.
  1275. * @param[out] p_buf Pointer to buffer where encoded data command response will be
  1276. * returned.
  1277. * @param[in,out] p_buf_len \c in: size of \p p_buf buffer.
  1278. * \c out: Length of encoded command response packet.
  1279. *
  1280. * @retval NRF_SUCCESS Encoding success.
  1281. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  1282. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  1283. */
  1284. uint32_t ble_gap_data_length_update_rsp_enc(uint32_t return_code,
  1285. uint8_t * const p_buf,
  1286. uint32_t * const p_buf_len,
  1287. ble_gap_data_length_limitation_t const * const p_dl_limitation);
  1288. #endif
  1289. #if NRF_SD_BLE_API_VERSION >= 5
  1290. /**@brief Decodes @ref sd_ble_gap_phy_update command request.
  1291. *
  1292. * @sa @ref ble_gap_phy_update_rsp_enc for response encoding.
  1293. *
  1294. * @param[in] p_buf Pointer to beginning of command request packet.
  1295. * @param[in] packet_len Length (in bytes) of response packet.
  1296. * @param[out] p_conn_handle Pointer to connection handle
  1297. * @param[out] pp_gap_phys Pointer to pointer to the struct.
  1298. *
  1299. * @retval NRF_SUCCESS Decoding success.
  1300. * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
  1301. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  1302. * @retval NRF_ERROR_INVALID_PARAM Decoding failure. Invalid operation type.
  1303. */
  1304. uint32_t ble_gap_phy_update_req_dec(uint8_t const * const p_buf,
  1305. uint32_t packet_len,
  1306. uint16_t * const p_conn_handle,
  1307. ble_gap_phys_t * * const pp_gap_phys);
  1308. /**@brief Encodes @ref sd_ble_gap_phy_update command response.
  1309. *
  1310. * @sa @ref ble_gap_phy_update_req_dec for request decoding.
  1311. *
  1312. * @param[in] return_code Return code indicating if command was successful or not.
  1313. * @param[out] p_buf Pointer to buffer where encoded data command response will be
  1314. * returned.
  1315. * @param[in,out] p_buf_len \c in: size of \p p_buf buffer.
  1316. * \c out: Length of encoded command response packet.
  1317. *
  1318. * @retval NRF_SUCCESS Encoding success.
  1319. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  1320. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  1321. */
  1322. uint32_t ble_gap_phy_update_rsp_enc(uint32_t return_code,
  1323. uint8_t * const p_buf,
  1324. uint32_t * const p_buf_len);
  1325. #endif
  1326. #if NRF_SD_BLE_API_VERSION >= 6
  1327. /**@brief Decodes @ref sd_ble_gap_adv_set_configure command request.
  1328. *
  1329. * @sa @ref ble_gap_adv_set_configure_rsp_enc for response encoding.
  1330. *
  1331. * @param[in] p_buf Pointer to beginning of command request packet.
  1332. * @param[in] packet_len Length (in bytes) of response packet.
  1333. * @param[out] p_conn_handle Pointer to connection handle
  1334. * @param[out] pp_adv_handle Pointer to pointer to the struct.
  1335. * @param[out] pp_adv_data Pointer to pointer to the struct.
  1336. * @param[out] pp_adv_params Pointer to pointer to the struct.
  1337. *
  1338. * @retval NRF_SUCCESS Decoding success.
  1339. * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
  1340. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  1341. * @retval NRF_ERROR_INVALID_PARAM Decoding failure. Invalid operation type.
  1342. */
  1343. uint32_t ble_gap_adv_set_configure_req_dec(uint8_t const * const p_buf,
  1344. uint16_t packet_len,
  1345. uint8_t * * const pp_adv_handle,
  1346. ble_gap_adv_data_t **const pp_adv_data,
  1347. ble_gap_adv_params_t **const pp_adv_params);
  1348. /**@brief Encodes @ref sd_ble_gap_adv_set_configure command response.
  1349. *
  1350. * @sa @ref ble_gap_adv_set_configure_req_dec for request decoding.
  1351. *
  1352. * @param[in] return_code Return code indicating if command was successful or not.
  1353. * @param[out] p_buf Pointer to buffer where encoded data command response will be
  1354. * returned.
  1355. * @param[in,out] p_buf_len \c in: size of \p p_buf buffer.
  1356. * \c out: Length of encoded command response packet.
  1357. * @param[in] p_adv_handle Pointer to the field to be encoded.
  1358. *
  1359. * @retval NRF_SUCCESS Encoding success.
  1360. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  1361. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  1362. */
  1363. uint32_t ble_gap_adv_set_configure_rsp_enc(uint32_t return_code,
  1364. uint8_t * const p_buf,
  1365. uint32_t * const p_buf_len,
  1366. ble_gap_adv_data_t * p_ble_adv_data,
  1367. uint8_t const * const p_adv_handle);
  1368. #ifndef S112
  1369. /**@brief Decodes @ref sd_ble_gap_qos_channel_survey_start command request.
  1370. *
  1371. * @sa @ref ble_gap_qos_channel_survey_start_rsp_enc for response encoding.
  1372. *
  1373. * @param[in] p_buf Pointer to beginning of command request packet.
  1374. * @param[in] packet_len Length (in bytes) of response packet.
  1375. * @param[out] p_interval_us Pointer to interval.
  1376. *
  1377. * @retval NRF_SUCCESS Decoding success.
  1378. * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
  1379. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  1380. * @retval NRF_ERROR_INVALID_PARAM Decoding failure. Invalid operation type.
  1381. */
  1382. uint32_t ble_gap_qos_channel_survey_start_req_dec(uint8_t const * const p_buf,
  1383. uint32_t packet_len,
  1384. uint32_t * const p_interval_us);
  1385. /**@brief Encodes @ref sd_ble_gap_qos_channel_survey_start command response.
  1386. *
  1387. * @sa @ref ble_gap_qos_channel_survey_start_req_dec for request decoding.
  1388. *
  1389. * @param[in] return_code Return code indicating if command was successful or not.
  1390. * @param[out] p_buf Pointer to buffer where encoded data command response will be
  1391. * returned.
  1392. * @param[in,out] p_buf_len \c in: size of \p p_buf buffer.
  1393. * \c out: Length of encoded command response packet.
  1394. *
  1395. * @retval NRF_SUCCESS Encoding success.
  1396. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  1397. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  1398. */
  1399. uint32_t ble_gap_qos_channel_survey_start_rsp_enc(uint32_t return_code,
  1400. uint8_t * const p_buf,
  1401. uint32_t * const p_buf_len);
  1402. /**@brief Decodes @ref sd_ble_gap_qos_channel_survey_stop command request.
  1403. *
  1404. * @sa @ref ble_gap_qos_channel_survey_stop_rsp_enc for response encoding.
  1405. *
  1406. * @param[in] p_buf Pointer to beginning of command request packet.
  1407. * @param[in] packet_len Length (in bytes) of response packet.
  1408. *
  1409. * @retval NRF_SUCCESS Decoding success.
  1410. * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
  1411. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  1412. * @retval NRF_ERROR_INVALID_PARAM Decoding failure. Invalid operation type.
  1413. */
  1414. uint32_t ble_gap_qos_channel_survey_stop_req_dec(uint8_t const * const p_buf,
  1415. uint32_t packet_len);
  1416. /**@brief Encodes @ref sd_ble_gap_qos_channel_survey_stop command response.
  1417. *
  1418. * @sa @ref ble_gap_qos_channel_survey_stop_req_dec for request decoding.
  1419. *
  1420. * @param[in] return_code Return code indicating if command was successful or not.
  1421. * @param[out] p_buf Pointer to buffer where encoded data command response will be
  1422. * returned.
  1423. * @param[in,out] p_buf_len \c in: size of \p p_buf buffer.
  1424. * \c out: Length of encoded command response packet.
  1425. *
  1426. * @retval NRF_SUCCESS Encoding success.
  1427. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  1428. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  1429. */
  1430. uint32_t ble_gap_qos_channel_survey_stop_rsp_enc(uint32_t return_code,
  1431. uint8_t * const p_buf,
  1432. uint32_t * const p_buf_len);
  1433. #endif //!defined(S112)
  1434. #endif
  1435. /** @} */
  1436. #ifdef __cplusplus
  1437. }
  1438. #endif
  1439. #endif