ble_gap_conn.c 39 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113
  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. #include "ble_gap_conn.h"
  41. #include <string.h>
  42. #include "ble_serialization.h"
  43. #include "cond_field_serialization.h"
  44. #include "ble_gap_struct_serialization.h"
  45. #include "ble_struct_serialization.h"
  46. #include "app_util.h"
  47. #if defined(NRF_SD_BLE_API_VERSION) && NRF_SD_BLE_API_VERSION < 6
  48. uint32_t ble_gap_adv_data_set_req_dec(uint8_t const * const p_buf,
  49. uint32_t packet_len,
  50. uint8_t * * const pp_data,
  51. uint8_t * p_dlen,
  52. uint8_t * * const pp_sr_data,
  53. uint8_t * p_srdlen)
  54. {
  55. SER_REQ_DEC_BEGIN(SD_BLE_GAP_ADV_DATA_SET);
  56. SER_ASSERT_NOT_NULL(p_dlen);
  57. SER_ASSERT_NOT_NULL(p_srdlen);
  58. SER_PULL_len8data(pp_data, p_dlen);
  59. SER_PULL_len8data(pp_sr_data, p_srdlen);
  60. SER_REQ_DEC_END;
  61. }
  62. uint32_t ble_gap_adv_data_set_rsp_enc(uint32_t return_code,
  63. uint8_t * const p_buf,
  64. uint32_t * const p_buf_len)
  65. {
  66. SER_RSP_ENC_RESULT_ONLY(SD_BLE_GAP_ADV_DATA_SET);
  67. }
  68. #endif
  69. uint32_t ble_gap_adv_start_req_dec(uint8_t const * const p_buf,
  70. uint32_t packet_len,
  71. #if NRF_SD_BLE_API_VERSION > 5
  72. uint8_t * p_adv_handle
  73. #else
  74. ble_gap_adv_params_t * * const pp_adv_params
  75. #endif
  76. #if NRF_SD_BLE_API_VERSION >= 4
  77. ,uint8_t * p_conn_cfg_tag
  78. #endif
  79. )
  80. {
  81. SER_REQ_DEC_BEGIN(SD_BLE_GAP_ADV_START);
  82. #if NRF_SD_BLE_API_VERSION > 5
  83. SER_PULL_uint8(p_adv_handle);
  84. #else
  85. SER_ASSERT_NOT_NULL(pp_adv_params);
  86. SER_ASSERT_NOT_NULL(*pp_adv_params);
  87. SER_ASSERT_NOT_NULL((*pp_adv_params)->p_peer_addr);
  88. SER_PULL_COND(pp_adv_params, ble_gap_adv_params_t_dec);
  89. #endif
  90. #if NRF_SD_BLE_API_VERSION >= 4
  91. SER_PULL_uint8(p_conn_cfg_tag);
  92. #endif
  93. SER_REQ_DEC_END;
  94. }
  95. uint32_t ble_gap_adv_start_rsp_enc(uint32_t return_code,
  96. uint8_t * const p_buf,
  97. uint32_t * const p_buf_len
  98. )
  99. {
  100. SER_RSP_ENC_RESULT_ONLY(SD_BLE_GAP_ADV_START);
  101. }
  102. #if NRF_SD_BLE_API_VERSION > 5
  103. uint32_t ble_gap_adv_stop_req_dec(uint8_t const * const p_buf,
  104. uint16_t packet_len,
  105. uint8_t * p_adv_handle)
  106. {
  107. SER_REQ_DEC_BEGIN(SD_BLE_GAP_ADV_STOP);
  108. SER_PULL_uint8(p_adv_handle);
  109. SER_REQ_DEC_END;
  110. }
  111. #endif
  112. uint32_t ble_gap_adv_stop_rsp_enc(uint32_t return_code,
  113. uint8_t * const p_buf,
  114. uint32_t * const p_buf_len)
  115. {
  116. SER_RSP_ENC_RESULT_ONLY(SD_BLE_GAP_ADV_STOP);
  117. }
  118. uint32_t ble_gap_appearance_get_req_dec(uint8_t const * const p_buf,
  119. uint16_t packet_len,
  120. uint16_t * * const pp_appearance)
  121. {
  122. SER_REQ_DEC_BEGIN(SD_BLE_GAP_APPEARANCE_GET);
  123. SER_ASSERT_NOT_NULL(pp_appearance);
  124. SER_ASSERT_NOT_NULL(*pp_appearance);
  125. SER_PULL_COND(pp_appearance, NULL);
  126. SER_REQ_DEC_END;
  127. }
  128. uint32_t ble_gap_appearance_get_rsp_enc(uint32_t return_code,
  129. uint8_t * const p_buf,
  130. uint32_t * const p_buf_len,
  131. uint16_t const * const p_appearance)
  132. {
  133. SER_RSP_ENC_BEGIN(SD_BLE_GAP_APPEARANCE_GET);
  134. SER_PUSH_COND(p_appearance, uint16_t_enc);
  135. SER_RSP_ENC_END;
  136. }
  137. uint32_t ble_gap_appearance_set_req_dec(uint8_t const * const p_buf,
  138. uint32_t packet_len,
  139. uint16_t * const p_appearance)
  140. {
  141. SER_REQ_DEC_BEGIN(SD_BLE_GAP_APPEARANCE_SET);
  142. SER_ASSERT_NOT_NULL(p_appearance);
  143. SER_PULL_uint16(p_appearance);
  144. SER_REQ_DEC_END;
  145. }
  146. uint32_t ble_gap_appearance_set_rsp_enc(uint32_t return_code,
  147. uint8_t * const p_buf,
  148. uint32_t * const p_buf_len)
  149. {
  150. SER_RSP_ENC_RESULT_ONLY(SD_BLE_GAP_APPEARANCE_SET);
  151. }
  152. uint32_t ble_gap_auth_key_reply_req_dec(uint8_t const * const p_buf,
  153. uint16_t packet_len,
  154. uint16_t * p_conn_handle,
  155. uint8_t * p_key_type,
  156. uint8_t * * const pp_key)
  157. {
  158. SER_REQ_DEC_BEGIN(SD_BLE_GAP_AUTH_KEY_REPLY);
  159. SER_ASSERT_NOT_NULL(p_conn_handle);
  160. SER_ASSERT_NOT_NULL(p_key_type);
  161. SER_PULL_uint16(p_conn_handle);
  162. SER_PULL_uint8(p_key_type);
  163. uint8_t key_len;
  164. switch (*p_key_type)
  165. {
  166. case BLE_GAP_AUTH_KEY_TYPE_NONE:
  167. key_len = 0;
  168. break;
  169. case BLE_GAP_AUTH_KEY_TYPE_PASSKEY:
  170. key_len = 6;
  171. break;
  172. case BLE_GAP_AUTH_KEY_TYPE_OOB:
  173. key_len = 16;
  174. break;
  175. default:
  176. return NRF_ERROR_INVALID_PARAM;
  177. }
  178. SER_PULL_buf(pp_key, key_len, key_len);
  179. SER_REQ_DEC_END;
  180. }
  181. uint32_t ble_gap_auth_key_reply_rsp_enc(uint32_t return_code,
  182. uint8_t * const p_buf,
  183. uint32_t * const p_buf_len)
  184. {
  185. SER_RSP_ENC_RESULT_ONLY(SD_BLE_GAP_AUTH_KEY_REPLY);
  186. }
  187. uint32_t ble_gap_authenticate_req_dec(uint8_t const * const p_buf,
  188. uint32_t packet_len,
  189. uint16_t * const p_conn_handle,
  190. ble_gap_sec_params_t * * const pp_sec_params)
  191. {
  192. SER_REQ_DEC_BEGIN(SD_BLE_GAP_AUTHENTICATE);
  193. SER_ASSERT_NOT_NULL(p_conn_handle);
  194. SER_ASSERT_NOT_NULL(pp_sec_params);
  195. SER_ASSERT_NOT_NULL(*pp_sec_params);
  196. SER_PULL_uint16(p_conn_handle);
  197. SER_PULL_COND(pp_sec_params, ble_gap_sec_params_t_dec);
  198. SER_REQ_DEC_END;
  199. }
  200. uint32_t ble_gap_authenticate_rsp_enc(uint32_t return_code,
  201. uint8_t * const p_buf,
  202. uint32_t * const p_buf_len)
  203. {
  204. SER_RSP_ENC_RESULT_ONLY(SD_BLE_GAP_AUTHENTICATE);
  205. }
  206. uint32_t ble_gap_conn_param_update_req_dec(uint8_t const * const p_buf,
  207. uint32_t packet_len,
  208. uint16_t * p_conn_handle,
  209. ble_gap_conn_params_t * * const pp_conn_params)
  210. {
  211. SER_REQ_DEC_BEGIN(SD_BLE_GAP_CONN_PARAM_UPDATE);
  212. SER_ASSERT_NOT_NULL(p_conn_handle);
  213. SER_ASSERT_NOT_NULL(pp_conn_params);
  214. SER_ASSERT_NOT_NULL(*pp_conn_params);
  215. SER_PULL_uint16(p_conn_handle);
  216. SER_PULL_COND(pp_conn_params, ble_gap_conn_params_t_dec);
  217. SER_REQ_DEC_END;
  218. }
  219. uint32_t ble_gap_conn_param_update_rsp_enc(uint32_t return_code,
  220. uint8_t * const p_buf,
  221. uint32_t * const p_buf_len)
  222. {
  223. SER_RSP_ENC_RESULT_ONLY(SD_BLE_GAP_CONN_PARAM_UPDATE);
  224. }
  225. uint32_t ble_gap_conn_sec_get_req_dec(uint8_t const * const p_buf,
  226. uint32_t packet_len,
  227. uint16_t * p_conn_handle,
  228. ble_gap_conn_sec_t * * const pp_conn_sec)
  229. {
  230. SER_REQ_DEC_BEGIN(SD_BLE_GAP_CONN_SEC_GET);
  231. SER_ASSERT_NOT_NULL(p_conn_handle);
  232. SER_PULL_uint16(p_conn_handle);
  233. SER_PULL_COND(pp_conn_sec, NULL);
  234. SER_REQ_DEC_END;
  235. }
  236. uint32_t ble_gap_conn_sec_get_rsp_enc(uint32_t return_code,
  237. ble_gap_conn_sec_t * const p_conn_sec,
  238. uint8_t * const p_buf,
  239. uint32_t * const p_buf_len)
  240. {
  241. SER_RSP_ENC_BEGIN(SD_BLE_GAP_CONN_SEC_GET);
  242. SER_PUSH_COND(p_conn_sec, ble_gap_conn_sec_t_enc);
  243. SER_RSP_ENC_END;
  244. }
  245. uint32_t ble_gap_device_name_get_req_dec(uint8_t const * const p_buf,
  246. uint32_t packet_len,
  247. uint8_t * * pp_name,
  248. uint16_t * * pp_name_len)
  249. {
  250. SER_REQ_DEC_BEGIN(SD_BLE_GAP_DEVICE_NAME_GET);
  251. SER_ASSERT_NOT_NULL(pp_name_len);
  252. SER_PULL_COND(pp_name_len, uint16_t_dec);
  253. SER_PULL_COND(pp_name, NULL);
  254. SER_REQ_DEC_END;
  255. }
  256. uint32_t ble_gap_device_name_get_rsp_enc(uint32_t return_code,
  257. uint8_t const * const p_dev_name,
  258. uint16_t * p_dev_name_len,
  259. uint16_t cpy_len,
  260. uint8_t * const p_buf,
  261. uint32_t * const p_buf_len)
  262. {
  263. SER_RSP_ENC_BEGIN(SD_BLE_GAP_DEVICE_NAME_GET);
  264. SER_PUSH_COND(p_dev_name_len, uint16_t_enc);
  265. SER_PUSH_len16data(p_dev_name, cpy_len);
  266. SER_RSP_ENC_END;
  267. }
  268. uint32_t ble_gap_device_name_set_req_dec(uint8_t const * const p_buf,
  269. uint32_t packet_len,
  270. ble_gap_conn_sec_mode_t * * const pp_write_perm,
  271. uint8_t * * const pp_dev_name,
  272. uint16_t * const p_dev_name_len)
  273. {
  274. SER_REQ_DEC_BEGIN(SD_BLE_GAP_DEVICE_NAME_SET);
  275. SER_ASSERT_NOT_NULL(pp_write_perm);
  276. SER_ASSERT_NOT_NULL(pp_dev_name);
  277. SER_ASSERT_NOT_NULL(p_dev_name_len);
  278. SER_PULL_COND(pp_write_perm, ble_gap_conn_sec_mode_t_dec);
  279. SER_PULL_len16data(pp_dev_name, p_dev_name_len);
  280. SER_REQ_DEC_END;
  281. }
  282. uint32_t ble_gap_device_name_set_rsp_enc(uint32_t return_code,
  283. uint8_t * const p_buf,
  284. uint32_t * const p_buf_len)
  285. {
  286. SER_RSP_ENC_RESULT_ONLY(SD_BLE_GAP_DEVICE_NAME_SET);
  287. }
  288. uint32_t ble_gap_disconnect_req_dec(uint8_t const * const p_buf,
  289. uint32_t packet_len,
  290. uint16_t * const p_conn_handle,
  291. uint8_t * const p_hci_status)
  292. {
  293. SER_REQ_DEC_BEGIN(SD_BLE_GAP_DISCONNECT);
  294. SER_ASSERT_NOT_NULL(p_conn_handle);
  295. SER_ASSERT_NOT_NULL(p_hci_status);
  296. SER_PULL_uint16(p_conn_handle);
  297. SER_PULL_uint8(p_hci_status);
  298. SER_REQ_DEC_END;
  299. }
  300. uint32_t ble_gap_disconnect_rsp_enc(uint32_t return_code,
  301. uint8_t * const p_buf,
  302. uint32_t * const p_buf_len)
  303. {
  304. SER_RSP_ENC_RESULT_ONLY(SD_BLE_GAP_DISCONNECT);
  305. }
  306. #ifndef S112
  307. uint32_t ble_gap_encrypt_req_dec(uint8_t const * const p_buf,
  308. uint16_t packet_len,
  309. uint16_t * const p_conn_handle,
  310. ble_gap_master_id_t ** const pp_master_id,
  311. ble_gap_enc_info_t ** const pp_enc_info)
  312. {
  313. SER_REQ_DEC_BEGIN(SD_BLE_GAP_ENCRYPT);
  314. SER_ASSERT_NOT_NULL(p_conn_handle);
  315. SER_ASSERT_NOT_NULL(pp_enc_info);
  316. SER_ASSERT_NOT_NULL(pp_master_id);
  317. SER_ASSERT_NOT_NULL(*pp_enc_info);
  318. SER_ASSERT_NOT_NULL(*pp_master_id);
  319. SER_PULL_uint16(p_conn_handle);
  320. SER_PULL_COND(pp_master_id, ble_gap_master_id_t_dec);
  321. SER_PULL_COND(pp_enc_info, ble_gap_enc_info_t_dec);
  322. SER_REQ_DEC_END;
  323. }
  324. uint32_t ble_gap_encrypt_rsp_enc(uint32_t return_code,
  325. uint8_t * const p_buf,
  326. uint32_t * const p_buf_len)
  327. {
  328. SER_RSP_ENC_RESULT_ONLY(SD_BLE_GAP_ENCRYPT);
  329. }
  330. #endif
  331. uint32_t ble_gap_keypress_notify_req_dec(uint8_t const * const p_buf,
  332. uint32_t packet_len,
  333. uint16_t * p_conn_handle,
  334. uint8_t * p_kp_not)
  335. {
  336. SER_REQ_DEC_BEGIN(SD_BLE_GAP_KEYPRESS_NOTIFY);
  337. SER_ASSERT_NOT_NULL(p_conn_handle);
  338. SER_ASSERT_NOT_NULL(p_kp_not);
  339. SER_PULL_uint16(p_conn_handle);
  340. SER_PULL_uint8(p_kp_not);
  341. SER_REQ_DEC_END;
  342. }
  343. uint32_t ble_gap_keypress_notify_rsp_enc(uint32_t return_code,
  344. uint8_t * const p_buf,
  345. uint32_t * const p_buf_len)
  346. {
  347. SER_RSP_ENC_RESULT_ONLY(SD_BLE_GAP_KEYPRESS_NOTIFY);
  348. }
  349. uint32_t ble_gap_lesc_dhkey_reply_req_dec(uint8_t const * const p_buf,
  350. uint32_t packet_len,
  351. uint16_t * p_conn_handle,
  352. ble_gap_lesc_dhkey_t * * pp_dhkey)
  353. {
  354. SER_REQ_DEC_BEGIN(SD_BLE_GAP_LESC_DHKEY_REPLY);
  355. SER_ASSERT_NOT_NULL(p_conn_handle);
  356. SER_ASSERT_NOT_NULL(pp_dhkey);
  357. SER_PULL_uint16(p_conn_handle);
  358. SER_PULL_COND(pp_dhkey, ble_gap_lesc_dhkey_t_dec);
  359. SER_REQ_DEC_END;
  360. }
  361. uint32_t ble_gap_lesc_dhkey_reply_rsp_enc(uint32_t return_code,
  362. uint8_t * const p_buf,
  363. uint32_t * const p_buf_len)
  364. {
  365. SER_RSP_ENC_RESULT_ONLY(SD_BLE_GAP_LESC_DHKEY_REPLY);
  366. }
  367. uint32_t ble_gap_lesc_oob_data_get_req_dec(uint8_t const * const p_buf,
  368. uint32_t packet_len,
  369. uint16_t * p_conn_handle,
  370. ble_gap_lesc_p256_pk_t * * pp_pk_own,
  371. ble_gap_lesc_oob_data_t * * pp_oobd_own)
  372. {
  373. SER_REQ_DEC_BEGIN(SD_BLE_GAP_LESC_OOB_DATA_GET);
  374. SER_ASSERT_NOT_NULL(p_conn_handle);
  375. SER_ASSERT_NOT_NULL(pp_oobd_own);
  376. SER_ASSERT_NOT_NULL(pp_pk_own);
  377. SER_PULL_uint16(p_conn_handle);
  378. SER_PULL_COND(pp_pk_own, ble_gap_lesc_p256_pk_t_dec);
  379. SER_PULL_COND(pp_oobd_own, NULL);
  380. SER_REQ_DEC_END;
  381. }
  382. uint32_t ble_gap_lesc_oob_data_get_rsp_enc(uint32_t return_code,
  383. ble_gap_lesc_oob_data_t * p_oobd_own,
  384. uint8_t * const p_buf,
  385. uint32_t * const p_buf_len)
  386. {
  387. SER_RSP_ENC_BEGIN(SD_BLE_GAP_LESC_OOB_DATA_GET);
  388. SER_PUSH_COND(p_oobd_own, ble_gap_lesc_oob_data_t_enc);
  389. SER_RSP_ENC_END;
  390. }
  391. uint32_t ble_gap_lesc_oob_data_set_req_dec(uint8_t const * const p_buf,
  392. uint32_t packet_len,
  393. uint16_t * p_conn_handle,
  394. ble_gap_lesc_oob_data_t * * pp_oobd_own,
  395. ble_gap_lesc_oob_data_t * * pp_oobd_peer)
  396. {
  397. SER_REQ_DEC_BEGIN(SD_BLE_GAP_LESC_OOB_DATA_SET);
  398. SER_ASSERT_NOT_NULL(p_conn_handle);
  399. SER_ASSERT_NOT_NULL(pp_oobd_own);
  400. SER_ASSERT_NOT_NULL(pp_oobd_peer);
  401. SER_PULL_uint16(p_conn_handle);
  402. SER_PULL_COND(pp_oobd_own, ble_gap_lesc_oob_data_t_dec);
  403. SER_PULL_COND(pp_oobd_peer, ble_gap_lesc_oob_data_t_dec);
  404. SER_REQ_DEC_END;
  405. }
  406. uint32_t ble_gap_lesc_oob_data_set_rsp_enc(uint32_t return_code,
  407. uint8_t * const p_buf,
  408. uint32_t * const p_buf_len)
  409. {
  410. SER_RSP_ENC_RESULT_ONLY(SD_BLE_GAP_LESC_OOB_DATA_SET);
  411. }
  412. uint32_t ble_gap_ppcp_get_req_dec(uint8_t const * const p_buf,
  413. uint16_t packet_len,
  414. ble_gap_conn_params_t * * const pp_conn_params)
  415. {
  416. SER_REQ_DEC_BEGIN(SD_BLE_GAP_PPCP_GET);
  417. SER_ASSERT_NOT_NULL(pp_conn_params);
  418. SER_ASSERT_NOT_NULL(*pp_conn_params);
  419. SER_ASSERT_LENGTH_LEQ(2, packet_len);
  420. SER_PULL_COND(pp_conn_params, NULL);
  421. SER_REQ_DEC_END;
  422. }
  423. uint32_t ble_gap_ppcp_get_rsp_enc(uint32_t return_code,
  424. uint8_t * const p_buf,
  425. uint32_t * const p_buf_len,
  426. ble_gap_conn_params_t const * const p_conn_params)
  427. {
  428. SER_RSP_ENC_BEGIN(SD_BLE_GAP_PPCP_GET);
  429. SER_PUSH_COND(p_conn_params, ble_gap_conn_params_t_enc);
  430. SER_RSP_ENC_END;
  431. }
  432. uint32_t ble_gap_ppcp_set_req_dec(uint8_t const * const p_buf,
  433. uint32_t packet_len,
  434. ble_gap_conn_params_t * * const pp_conn_params)
  435. {
  436. SER_REQ_DEC_BEGIN(SD_BLE_GAP_PPCP_SET);
  437. SER_ASSERT_NOT_NULL(pp_conn_params);
  438. SER_PULL_COND(pp_conn_params, ble_gap_conn_params_t_dec);
  439. SER_REQ_DEC_END;
  440. }
  441. uint32_t ble_gap_ppcp_set_rsp_enc(uint32_t return_code,
  442. uint8_t * const p_buf,
  443. uint32_t * const p_buf_len)
  444. {
  445. SER_RSP_ENC_RESULT_ONLY(SD_BLE_GAP_PPCP_SET);
  446. }
  447. uint32_t ble_gap_rssi_get_req_dec(uint8_t const * const p_buf,
  448. uint16_t packet_len,
  449. uint16_t * p_conn_handle,
  450. int8_t * * const pp_rssi
  451. #if NRF_SD_BLE_API_VERSION > 5
  452. ,uint8_t * * const pp_ch_index
  453. #endif
  454. )
  455. {
  456. SER_REQ_DEC_BEGIN(SD_BLE_GAP_RSSI_GET);
  457. SER_ASSERT_NOT_NULL(p_conn_handle);
  458. SER_ASSERT_NOT_NULL(pp_rssi);
  459. SER_ASSERT_NOT_NULL(*pp_rssi);
  460. SER_PULL_uint16(p_conn_handle);
  461. SER_PULL_COND(pp_rssi, NULL);
  462. #if NRF_SD_BLE_API_VERSION > 5
  463. SER_ASSERT_NOT_NULL(pp_ch_index);
  464. SER_ASSERT_NOT_NULL(*pp_ch_index);
  465. SER_PULL_COND(pp_ch_index, NULL);
  466. #endif
  467. SER_REQ_DEC_END;
  468. }
  469. uint32_t ble_gap_rssi_get_rsp_enc(uint32_t return_code,
  470. uint8_t * const p_buf,
  471. uint32_t * const p_buf_len,
  472. int8_t * p_rssi
  473. #if NRF_SD_BLE_API_VERSION > 5
  474. ,uint8_t * p_ch_index
  475. #endif
  476. )
  477. {
  478. SER_RSP_ENC_BEGIN(SD_BLE_GAP_RSSI_GET);
  479. SER_PUSH_COND(p_rssi, uint8_t_enc);
  480. #if NRF_SD_BLE_API_VERSION > 5
  481. SER_PUSH_COND(p_ch_index, uint8_t_enc);
  482. #endif
  483. SER_RSP_ENC_END;
  484. }
  485. uint32_t ble_gap_rssi_start_req_dec(uint8_t const * const p_buf,
  486. uint32_t packet_len,
  487. uint16_t * p_conn_handle,
  488. uint8_t * p_threshold_dbm,
  489. uint8_t * p_skip_count)
  490. {
  491. SER_REQ_DEC_BEGIN(SD_BLE_GAP_RSSI_START);
  492. SER_ASSERT_NOT_NULL(p_conn_handle);
  493. SER_ASSERT_NOT_NULL(p_threshold_dbm);
  494. SER_ASSERT_NOT_NULL(p_skip_count);
  495. SER_PULL_uint16(p_conn_handle);
  496. SER_PULL_uint8(p_threshold_dbm);
  497. SER_PULL_uint8(p_skip_count);
  498. SER_REQ_DEC_END;
  499. }
  500. uint32_t ble_gap_rssi_start_rsp_enc(uint32_t return_code,
  501. uint8_t * const p_buf,
  502. uint32_t * const p_buf_len)
  503. {
  504. SER_RSP_ENC_RESULT_ONLY(SD_BLE_GAP_RSSI_START);
  505. }
  506. uint32_t ble_gap_rssi_stop_req_dec(uint8_t const * const p_buf,
  507. uint32_t packet_len,
  508. uint16_t * p_conn_handle)
  509. {
  510. SER_REQ_DEC_BEGIN(SD_BLE_GAP_RSSI_STOP);
  511. SER_ASSERT_NOT_NULL(p_conn_handle);
  512. SER_PULL_uint16(p_conn_handle);
  513. SER_REQ_DEC_END;
  514. }
  515. uint32_t ble_gap_rssi_stop_rsp_enc(uint32_t return_code,
  516. uint8_t * const p_buf,
  517. uint32_t * const p_buf_len)
  518. {
  519. SER_RSP_ENC_RESULT_ONLY(SD_BLE_GAP_RSSI_STOP);
  520. }
  521. #ifndef S112
  522. uint32_t ble_gap_scan_start_req_dec(uint8_t const * const p_buf,
  523. uint32_t packet_len,
  524. ble_gap_scan_params_t * * const pp_scan_params
  525. #if defined(NRF_SD_BLE_API_VERSION) && NRF_SD_BLE_API_VERSION > 5
  526. ,ble_data_t * * const pp_adv_report_buffer
  527. #endif
  528. )
  529. {
  530. SER_REQ_DEC_BEGIN(SD_BLE_GAP_SCAN_START);
  531. SER_ASSERT_NOT_NULL(pp_scan_params);
  532. SER_ASSERT_NOT_NULL(*pp_scan_params);
  533. SER_PULL_COND(pp_scan_params, ble_gap_scan_params_t_dec);
  534. #if defined(NRF_SD_BLE_API_VERSION) && NRF_SD_BLE_API_VERSION > 5
  535. SER_PULL_COND(pp_adv_report_buffer, ble_data_t_dec);
  536. #endif
  537. SER_REQ_DEC_END;
  538. }
  539. uint32_t ble_gap_scan_start_rsp_enc(uint32_t return_code,
  540. #if defined(NRF_SD_BLE_API_VERSION) && NRF_SD_BLE_API_VERSION > 5
  541. ble_data_t *p_ble_data,
  542. #endif
  543. uint8_t * const p_buf,
  544. uint32_t * const p_buf_len)
  545. {
  546. SER_RSP_ENC_RESULT_ONLY(SD_BLE_GAP_SCAN_START);
  547. }
  548. uint32_t ble_gap_scan_stop_rsp_enc(uint32_t return_code,
  549. uint8_t * const p_buf,
  550. uint32_t * const p_buf_len)
  551. {
  552. SER_RSP_ENC_RESULT_ONLY(SD_BLE_GAP_SCAN_STOP);
  553. }
  554. uint32_t ble_gap_connect_req_dec(uint8_t const * const p_buf,
  555. uint32_t packet_len,
  556. ble_gap_addr_t * * const pp_addr,
  557. ble_gap_scan_params_t * * const pp_scan_params,
  558. ble_gap_conn_params_t * * const pp_conn_params
  559. #if NRF_SD_BLE_API_VERSION >= 4
  560. ,uint8_t * p_conn_cfg_tag
  561. #endif
  562. )
  563. {
  564. SER_REQ_DEC_BEGIN(SD_BLE_GAP_CONNECT);
  565. SER_ASSERT_NOT_NULL(pp_addr);
  566. SER_ASSERT_NOT_NULL(*pp_addr);
  567. SER_ASSERT_NOT_NULL(pp_scan_params);
  568. SER_ASSERT_NOT_NULL(*pp_scan_params);
  569. SER_ASSERT_NOT_NULL(pp_conn_params);
  570. SER_ASSERT_NOT_NULL(*pp_conn_params);
  571. SER_PULL_COND(pp_addr, ble_gap_addr_t_dec);
  572. SER_PULL_COND(pp_scan_params, ble_gap_scan_params_t_dec);
  573. SER_PULL_COND(pp_conn_params, ble_gap_conn_params_t_dec);
  574. #if NRF_SD_BLE_API_VERSION >= 4
  575. SER_PULL_uint8(p_conn_cfg_tag);
  576. #endif
  577. SER_REQ_DEC_END;
  578. }
  579. uint32_t ble_gap_connect_rsp_enc(uint32_t return_code,
  580. uint8_t * const p_buf,
  581. uint32_t * const p_buf_len)
  582. {
  583. SER_RSP_ENC_RESULT_ONLY(SD_BLE_GAP_CONNECT);
  584. }
  585. uint32_t ble_gap_connect_cancel_rsp_enc(uint32_t return_code,
  586. uint8_t * const p_buf,
  587. uint32_t * const p_buf_len)
  588. {
  589. SER_RSP_ENC_RESULT_ONLY(SD_BLE_GAP_CONNECT_CANCEL);
  590. }
  591. #endif //S112
  592. uint32_t ble_gap_sec_info_reply_req_dec(uint8_t const * const p_buf,
  593. uint16_t packet_len,
  594. uint16_t * p_conn_handle,
  595. ble_gap_enc_info_t * * const pp_enc_info,
  596. ble_gap_irk_t * * const pp_id_info,
  597. ble_gap_sign_info_t * * const pp_sign_info)
  598. {
  599. SER_REQ_DEC_BEGIN(SD_BLE_GAP_SEC_INFO_REPLY);
  600. SER_ASSERT_NOT_NULL(p_conn_handle);
  601. SER_ASSERT_NOT_NULL(pp_enc_info);
  602. SER_ASSERT_NOT_NULL(pp_id_info);
  603. SER_ASSERT_NOT_NULL(pp_sign_info);
  604. SER_ASSERT_NOT_NULL(*pp_enc_info);
  605. SER_ASSERT_NOT_NULL(*pp_id_info);
  606. SER_ASSERT_NOT_NULL(*pp_sign_info);
  607. SER_PULL_uint16(p_conn_handle);
  608. SER_PULL_COND(pp_enc_info, ble_gap_enc_info_t_dec);
  609. SER_PULL_COND(pp_id_info, ble_gap_irk_t_dec);
  610. SER_PULL_COND(pp_sign_info, ble_gap_sign_info_t_dec);
  611. SER_REQ_DEC_END;
  612. }
  613. uint32_t ble_gap_sec_info_reply_rsp_enc(uint32_t return_code,
  614. uint8_t * const p_buf,
  615. uint32_t * const p_buf_len)
  616. {
  617. SER_RSP_ENC_RESULT_ONLY(SD_BLE_GAP_SEC_INFO_REPLY);
  618. }
  619. uint32_t ble_gap_sec_params_reply_req_dec(uint8_t const * const p_buf,
  620. uint32_t packet_len,
  621. uint16_t * p_conn_handle,
  622. uint8_t * p_sec_status,
  623. ble_gap_sec_params_t * * const pp_sec_params,
  624. ble_gap_sec_keyset_t * * const pp_sec_keyset)
  625. {
  626. SER_REQ_DEC_BEGIN(SD_BLE_GAP_SEC_PARAMS_REPLY);
  627. SER_ASSERT_NOT_NULL(p_conn_handle);
  628. SER_ASSERT_NOT_NULL(p_sec_status);
  629. SER_ASSERT_NOT_NULL(pp_sec_params);
  630. SER_ASSERT_NOT_NULL(*pp_sec_params);
  631. SER_ASSERT_NOT_NULL(pp_sec_keyset);
  632. SER_ASSERT_NOT_NULL(*pp_sec_keyset);
  633. SER_PULL_uint16(p_conn_handle);
  634. SER_PULL_uint8(p_sec_status);
  635. SER_PULL_COND(pp_sec_params, ble_gap_sec_params_t_dec);
  636. SER_PULL_COND(pp_sec_keyset, ble_gap_sec_keyset_t_dec);
  637. SER_REQ_DEC_END;
  638. }
  639. uint32_t ble_gap_sec_params_reply_rsp_enc(uint32_t return_code,
  640. uint8_t * const p_buf,
  641. uint32_t * const p_buf_len,
  642. ble_gap_sec_keyset_t * const p_sec_keyset)
  643. {
  644. SER_RSP_ENC_BEGIN(SD_BLE_GAP_SEC_PARAMS_REPLY);
  645. SER_PUSH_COND(p_sec_keyset, ble_gap_sec_keyset_t_enc);
  646. SER_RSP_ENC_END;
  647. }
  648. uint32_t ble_gap_tx_power_set_req_dec(uint8_t const * const p_buf,
  649. uint32_t packet_len,
  650. #if NRF_SD_BLE_API_VERSION > 5
  651. uint8_t * p_role, uint16_t * p_handle,
  652. #endif
  653. int8_t * p_tx_power)
  654. {
  655. SER_REQ_DEC_BEGIN(SD_BLE_GAP_TX_POWER_SET);
  656. SER_ASSERT_NOT_NULL(p_tx_power);
  657. #if NRF_SD_BLE_API_VERSION > 5
  658. SER_PULL_uint8(p_role);
  659. SER_PULL_uint16(p_handle);
  660. #endif
  661. SER_PULL_int8(p_tx_power);
  662. SER_REQ_DEC_END;
  663. }
  664. uint32_t ble_gap_tx_power_set_rsp_enc(uint32_t return_code,
  665. uint8_t * const p_buf,
  666. uint32_t * const p_buf_len)
  667. {
  668. SER_RSP_ENC_RESULT_ONLY(SD_BLE_GAP_TX_POWER_SET);
  669. }
  670. uint32_t ble_gap_addr_get_req_dec(uint8_t const * const p_buf,
  671. uint16_t packet_len,
  672. ble_gap_addr_t * * const pp_address)
  673. {
  674. SER_REQ_DEC_BEGIN(SD_BLE_GAP_ADDR_GET);
  675. SER_PULL_COND(pp_address, NULL);
  676. SER_REQ_DEC_END;
  677. }
  678. uint32_t ble_gap_addr_get_rsp_enc(uint32_t return_code,
  679. uint8_t * const p_buf,
  680. uint32_t * const p_buf_len,
  681. ble_gap_addr_t const * const p_address)
  682. {
  683. SER_RSP_ENC_BEGIN(SD_BLE_GAP_ADDR_GET);
  684. SER_PUSH_FIELD(p_address, ble_gap_addr_t_enc);
  685. SER_RSP_ENC_END;
  686. }
  687. uint32_t ble_gap_addr_set_req_dec(uint8_t const * const p_buf,
  688. uint32_t packet_len,
  689. ble_gap_addr_t * * const pp_addr)
  690. {
  691. SER_REQ_DEC_BEGIN(SD_BLE_GAP_ADDR_SET);
  692. SER_PULL_COND(pp_addr, ble_gap_addr_t_dec);
  693. SER_REQ_DEC_END;
  694. }
  695. uint32_t ble_gap_addr_set_rsp_enc(uint32_t return_code,
  696. uint8_t * const p_buf,
  697. uint32_t * const p_buf_len)
  698. {
  699. SER_RSP_ENC_RESULT_ONLY(SD_BLE_GAP_ADDR_SET);
  700. }
  701. uint32_t ble_gap_privacy_set_req_dec(uint8_t const * const p_buf,
  702. uint32_t packet_len,
  703. ble_gap_privacy_params_t * * const pp_privacy_params)
  704. {
  705. SER_REQ_DEC_BEGIN(SD_BLE_GAP_PRIVACY_SET);
  706. SER_PULL_COND(pp_privacy_params, ble_gap_privacy_params_t_dec);
  707. SER_REQ_DEC_END;
  708. }
  709. uint32_t ble_gap_privacy_set_rsp_enc(uint32_t return_code,
  710. uint8_t * const p_buf,
  711. uint32_t * const p_buf_len)
  712. {
  713. SER_RSP_ENC_RESULT_ONLY(SD_BLE_GAP_PRIVACY_SET);
  714. }
  715. uint32_t ble_gap_privacy_get_req_dec(uint8_t const * const p_buf,
  716. uint16_t packet_len,
  717. ble_gap_privacy_params_t * * const pp_privacy_params)
  718. {
  719. SER_REQ_DEC_BEGIN(SD_BLE_GAP_PRIVACY_GET);
  720. SER_PULL_COND(pp_privacy_params, ble_gap_privacy_params_t_dec);
  721. SER_REQ_DEC_END;
  722. }
  723. uint32_t ble_gap_privacy_get_rsp_enc(uint32_t return_code,
  724. uint8_t * const p_buf,
  725. uint32_t * const p_buf_len,
  726. ble_gap_privacy_params_t const * const p_privacy_params)
  727. {
  728. SER_RSP_ENC_BEGIN(SD_BLE_GAP_PRIVACY_GET);
  729. SER_PUSH_COND(p_privacy_params, ble_gap_privacy_params_t_enc);
  730. SER_RSP_ENC_END;
  731. }
  732. uint32_t ble_gap_whitelist_set_req_dec(uint8_t const * const p_buf,
  733. uint32_t packet_len,
  734. ble_gap_addr_t * * * const ppp_wl_addrs,
  735. uint8_t * const p_len)
  736. {
  737. SER_REQ_DEC_BEGIN(SD_BLE_GAP_WHITELIST_SET);
  738. SER_ASSERT_NOT_NULL(ppp_wl_addrs);
  739. SER_ASSERT_NOT_NULL(*ppp_wl_addrs);
  740. SER_ASSERT_NOT_NULL(**ppp_wl_addrs);
  741. uint8_t presence;
  742. SER_PULL_uint8(p_len);
  743. SER_PULL_uint8(&presence);
  744. if (presence == SER_FIELD_PRESENT)
  745. {
  746. ble_gap_addr_t * * const pp_wl_addrs = *ppp_wl_addrs;
  747. for (uint32_t i = 0; i < *p_len; ++i)
  748. {
  749. SER_PULL_COND(&(pp_wl_addrs[i]), ble_gap_addr_t_dec);
  750. }
  751. }
  752. else
  753. {
  754. *ppp_wl_addrs = NULL;
  755. }
  756. SER_REQ_DEC_END;
  757. }
  758. uint32_t ble_gap_whitelist_set_rsp_enc(uint32_t return_code,
  759. uint8_t * const p_buf,
  760. uint32_t * const p_buf_len)
  761. {
  762. SER_RSP_ENC_RESULT_ONLY(SD_BLE_GAP_WHITELIST_SET);
  763. }
  764. uint32_t ble_gap_device_identities_set_req_dec(uint8_t const * const p_buf,
  765. uint32_t packet_len,
  766. ble_gap_id_key_t * * * const ppp_id_keys,
  767. ble_gap_irk_t * * * const ppp_local_irks,
  768. uint8_t * const p_len)
  769. {
  770. SER_REQ_DEC_BEGIN(SD_BLE_GAP_DEVICE_IDENTITIES_SET);
  771. SER_ASSERT_NOT_NULL(ppp_id_keys);
  772. SER_ASSERT_NOT_NULL(*ppp_id_keys);
  773. SER_ASSERT_NOT_NULL(**ppp_id_keys);
  774. SER_ASSERT_NOT_NULL(ppp_local_irks);
  775. SER_ASSERT_NOT_NULL(*ppp_local_irks);
  776. SER_ASSERT_NOT_NULL(**ppp_local_irks);
  777. uint8_t presence;
  778. SER_PULL_uint8(p_len);
  779. SER_PULL_uint8(&presence);
  780. if (presence == SER_FIELD_PRESENT)
  781. {
  782. ble_gap_id_key_t * * const pp_id_keys = *ppp_id_keys;
  783. for (uint32_t i = 0; i < *p_len; ++i)
  784. {
  785. SER_PULL_COND(&(pp_id_keys[i]), ble_gap_id_key_t_dec);
  786. }
  787. }
  788. else
  789. {
  790. *ppp_id_keys = NULL;
  791. }
  792. SER_PULL_uint8(&presence);
  793. if (presence == SER_FIELD_PRESENT)
  794. {
  795. ble_gap_irk_t * * const pp_local_irks = *ppp_local_irks;
  796. for (uint32_t i = 0; i < *p_len; ++i)
  797. {
  798. SER_PULL_COND(&(pp_local_irks[i]), ble_gap_irk_t_dec);
  799. }
  800. }
  801. else
  802. {
  803. *ppp_local_irks = NULL;
  804. }
  805. SER_REQ_DEC_END;
  806. }
  807. uint32_t ble_gap_device_identities_set_rsp_enc(uint32_t return_code,
  808. uint8_t * const p_buf,
  809. uint32_t * const p_buf_len)
  810. {
  811. SER_RSP_ENC_RESULT_ONLY(SD_BLE_GAP_DEVICE_IDENTITIES_SET);
  812. }
  813. #if NRF_SD_BLE_API_VERSION >= 4 && !defined(S112)
  814. uint32_t ble_gap_data_length_update_req_dec(uint8_t const * const p_buf,
  815. uint16_t packet_len,
  816. uint16_t * p_conn_handle,
  817. ble_gap_data_length_params_t * * const pp_dl_params,
  818. ble_gap_data_length_limitation_t * * const pp_dl_limitation)
  819. {
  820. SER_REQ_DEC_BEGIN(SD_BLE_GAP_DATA_LENGTH_UPDATE);
  821. SER_PULL_uint16(p_conn_handle);
  822. SER_PULL_COND(pp_dl_params, ble_gap_data_length_params_t_dec);
  823. SER_PULL_COND(pp_dl_limitation, NULL);
  824. SER_REQ_DEC_END;
  825. }
  826. uint32_t ble_gap_data_length_update_rsp_enc(uint32_t return_code,
  827. uint8_t * const p_buf,
  828. uint32_t * const p_buf_len,
  829. ble_gap_data_length_limitation_t const * const p_dl_limitation)
  830. {
  831. SER_RSP_ENC_BEGIN(SD_BLE_GAP_DATA_LENGTH_UPDATE);
  832. SER_PUSH_COND(p_dl_limitation, ble_gap_data_length_limitation_t_enc);
  833. SER_RSP_ENC_END;
  834. }
  835. #endif //NRF_SD_BLE_API_VERSION >= 4 && !defined(S112)
  836. #if NRF_SD_BLE_API_VERSION >= 5
  837. uint32_t ble_gap_phy_update_req_dec(uint8_t const * const p_buf,
  838. uint32_t packet_len,
  839. uint16_t * const p_conn_handle,
  840. ble_gap_phys_t * * const pp_gap_phys)
  841. {
  842. SER_REQ_DEC_BEGIN(SD_BLE_GAP_PHY_UPDATE);
  843. SER_ASSERT_NOT_NULL(p_conn_handle);
  844. SER_ASSERT_NOT_NULL(pp_gap_phys);
  845. SER_ASSERT_NOT_NULL(*pp_gap_phys);
  846. SER_PULL_uint16(p_conn_handle);
  847. SER_PULL_COND(pp_gap_phys, ble_gap_phys_t_dec);
  848. SER_REQ_DEC_END;
  849. }
  850. uint32_t ble_gap_phy_update_rsp_enc(uint32_t return_code,
  851. uint8_t * const p_buf,
  852. uint32_t * const p_buf_len)
  853. {
  854. SER_RSP_ENC_RESULT_ONLY(SD_BLE_GAP_PHY_UPDATE);
  855. }
  856. #endif //RF_SD_BLE_API_VERSION >= 5
  857. #if defined(NRF_SD_BLE_API_VERSION) && NRF_SD_BLE_API_VERSION > 5
  858. uint32_t ble_gap_adv_set_configure_req_dec(uint8_t const * const p_buf,
  859. uint16_t packet_len,
  860. uint8_t * * const pp_adv_handle,
  861. ble_gap_adv_data_t **const pp_adv_data,
  862. ble_gap_adv_params_t **const pp_adv_params)
  863. {
  864. SER_REQ_DEC_BEGIN(SD_BLE_GAP_ADV_SET_CONFIGURE);
  865. SER_ASSERT_NOT_NULL(pp_adv_handle);
  866. SER_ASSERT_NOT_NULL(*pp_adv_handle);
  867. SER_ASSERT_NOT_NULL(pp_adv_data);
  868. SER_ASSERT_NOT_NULL(*pp_adv_data);
  869. SER_ASSERT_NOT_NULL(pp_adv_params);
  870. SER_ASSERT_NOT_NULL(*pp_adv_params);
  871. SER_PULL_COND(pp_adv_handle, uint8_t_dec);
  872. SER_PULL_COND(pp_adv_data, ble_gap_adv_data_t_dec);
  873. SER_PULL_COND(pp_adv_params, ble_gap_adv_params_t_dec);
  874. SER_REQ_DEC_END;
  875. }
  876. uint32_t ble_gap_adv_set_configure_rsp_enc(uint32_t return_code,
  877. uint8_t * const p_buf,
  878. uint32_t * const p_buf_len,
  879. ble_gap_adv_data_t * p_ble_adv_data,
  880. uint8_t const * const p_adv_handle)
  881. {
  882. SER_RSP_ENC_BEGIN(SD_BLE_GAP_ADV_SET_CONFIGURE);
  883. SER_PUSH_COND(p_adv_handle, uint8_t_enc);
  884. SER_RSP_ENC_END;
  885. }
  886. #ifndef S112
  887. uint32_t ble_gap_qos_channel_survey_start_req_dec(uint8_t const * const p_buf,
  888. uint32_t packet_len,
  889. uint32_t * const p_interval_us)
  890. {
  891. SER_REQ_DEC_BEGIN(SD_BLE_GAP_QOS_CHANNEL_SURVEY_START);
  892. SER_ASSERT_NOT_NULL(p_interval_us);
  893. SER_PULL_uint32(p_interval_us);
  894. SER_REQ_DEC_END;
  895. }
  896. uint32_t ble_gap_qos_channel_survey_start_rsp_enc(uint32_t return_code,
  897. uint8_t * const p_buf,
  898. uint32_t * const p_buf_len)
  899. {
  900. SER_RSP_ENC_RESULT_ONLY(SD_BLE_GAP_QOS_CHANNEL_SURVEY_START);
  901. }
  902. uint32_t ble_gap_qos_channel_survey_stop_req_dec(uint8_t const * const p_buf,
  903. uint32_t packet_len)
  904. {
  905. SER_REQ_DEC_BEGIN(SD_BLE_GAP_QOS_CHANNEL_SURVEY_STOP);
  906. SER_REQ_DEC_END;
  907. }
  908. uint32_t ble_gap_qos_channel_survey_stop_rsp_enc(uint32_t return_code,
  909. uint8_t * const p_buf,
  910. uint32_t * const p_buf_len)
  911. {
  912. SER_RSP_ENC_RESULT_ONLY(SD_BLE_GAP_QOS_CHANNEL_SURVEY_STOP);
  913. }
  914. #endif
  915. #endif