ant_conn.h 84 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591
  1. /**
  2. * Copyright (c) 2017 - 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 ANT_CONN_H__
  41. #define ANT_CONN_H__
  42. /**
  43. * @addtogroup ser_conn_s212_codecs Connectivity codecs for S212
  44. * @ingroup ser_codecs_conn
  45. */
  46. /**@file
  47. *
  48. * @defgroup ant_conn Connectivity command request decoders and command response encoders
  49. * @{
  50. * @ingroup ser_conn_s212_codecs
  51. *
  52. * @brief Connectivity command request decoders and command response encoders.
  53. */
  54. #include "ant_interface.h"
  55. /**@brief Decodes @ref sd_ant_enable command request.
  56. *
  57. * @sa @ref ant_enable_rsp_enc for response encoding.
  58. *
  59. * @param[in] p_buf Pointer to beginning of command request packet.
  60. * @param[in] packet_len Length (in bytes) of response packet.
  61. * @param[out] pp_ant_enable_params Pointer to pointer to @ref ANT_ENABLE.
  62. * \c It will be set to NULL if p_ant_enable_params is not
  63. * present in the packet.
  64. *
  65. * @retval NRF_SUCCESS Decoding success.
  66. * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
  67. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  68. */
  69. uint32_t ant_enable_req_dec(uint8_t const * const p_buf,
  70. uint32_t packet_len,
  71. ANT_ENABLE * * const pp_ant_enable_params);
  72. /**@brief Encodes @ref sd_ant_enable command response.
  73. *
  74. * @sa @ref ant_enable_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 ant_enable_rsp_enc(uint32_t return_code,
  87. uint8_t * const p_buf,
  88. uint32_t * const p_buf_len);
  89. /**@brief Decodes @ref sd_ant_channel_assign command request.
  90. *
  91. * @sa @ref ant_channel_assign_rsp_enc for response encoding.
  92. *
  93. * @param[in] p_buf Pointer to beginning of command request packet.
  94. * @param[in] packet_len Length (in bytes) of response packet.
  95. *
  96. * @param[out] p_channel Pointer to an unsigned char (1 octet) where the channel to be
  97. * assigned will be set.
  98. * @param[out] p_type Pointer to an unsigned char (1 octet) where the channel type
  99. * to be assigned will be set.
  100. * @param[out] p_network Pointer to an unsigned char (1 octet) where the network key to
  101. * associate with the channel will be set.
  102. * @param[out] p_ext_assign Pointer to a bit field (1 octet) where an extended assign will
  103. * be set.
  104. *
  105. * @retval NRF_SUCCESS Decoding success.
  106. * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
  107. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  108. */
  109. uint32_t ant_channel_assign_req_dec(uint8_t const * const p_buf,
  110. uint32_t packet_len,
  111. uint8_t * const p_channel,
  112. uint8_t * const p_type,
  113. uint8_t * const p_network,
  114. uint8_t * const p_ext_assign);
  115. /**@brief Encodes @ref sd_ant_channel_assign command response.
  116. *
  117. * @sa @ref ant_channel_assign_req_dec for request decoding.
  118. *
  119. * @param[in] return_code Return code indicating if command was successful or not.
  120. * @param[out] p_buf Pointer to buffer where encoded data command response will be
  121. * returned.
  122. * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
  123. * \c out: Length of encoded command response packet.
  124. *
  125. * @retval NRF_SUCCESS Encoding success.
  126. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  127. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  128. */
  129. uint32_t ant_channel_assign_rsp_enc(uint32_t return_code,
  130. uint8_t * const p_buf,
  131. uint32_t * const p_buf_len);
  132. /**@brief Decodes @ref sd_ant_channel_open command request.
  133. *
  134. * @sa @ref ant_channel_open_with_offset_rsp_enc for response encoding.
  135. *
  136. * @param[in] p_buf Pointer to beginning of command request packet.
  137. * @param[in] packet_len Length (in bytes) of response packet.
  138. *
  139. * @param[out] p_channel Pointer to an unsigned char (1 octet) where the channel to be
  140. * opened will be set.
  141. * @param[out] p_usOffset Pointer to a channel start time offset value.
  142. *
  143. * @retval NRF_SUCCESS Decoding success.
  144. * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
  145. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  146. */
  147. uint32_t ant_channel_open_with_offset_req_dec(uint8_t const * const p_buf,
  148. uint32_t packet_len,
  149. uint8_t * const p_channel,
  150. uint16_t * const p_usOffset);
  151. /**@brief Encodes @ref sd_ant_channel_open command response.
  152. *
  153. * @sa @ref ant_channel_open_with_offset_req_dec for request decoding.
  154. *
  155. * @param[in] return_code Return code indicating if command was successful or not.
  156. * @param[out] p_buf Pointer to buffer where encoded data command response will be
  157. * returned.
  158. * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
  159. * \c out: Length of encoded command response packet.
  160. *
  161. * @retval NRF_SUCCESS Encoding success.
  162. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  163. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  164. */
  165. uint32_t ant_channel_open_with_offset_rsp_enc(uint32_t return_code,
  166. uint8_t * const p_buf,
  167. uint32_t * const p_buf_len);
  168. /**@brief Decodes @ref sd_ant_channel_id_set command request.
  169. *
  170. * @sa @ref ant_channel_id_set_rsp_enc for response encoding.
  171. *
  172. * @param[in] p_buf Pointer to beginning of command request packet.
  173. * @param[in] packet_len Length (in bytes) of response packet.
  174. *
  175. * @param[out] p_channel Pointer to an unsigned char (1 octet) where the channel number
  176. * will be set.
  177. * @param[out] p_device_number Pointer to an unsigned short (2 octets) where the device
  178. * number will be set.
  179. * @param[out] p_device_type Pointer to an an unsigned char (1 octet) where the device type
  180. * will be set.
  181. * @param[out] p_transmission_type Pointer to an unsigned char (1 octet) where the transmission
  182. * type will be set.
  183. *
  184. * @retval NRF_SUCCESS Decoding success.
  185. * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
  186. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  187. */
  188. uint32_t ant_channel_id_set_req_dec(uint8_t const * const p_buf,
  189. uint32_t packet_len,
  190. uint8_t * const p_channel,
  191. uint16_t * const p_device_number,
  192. uint8_t * const p_device_type,
  193. uint8_t * const p_transmission_type);
  194. /**@brief Encodes @ref sd_ant_channel_id_set command response.
  195. *
  196. * @sa @ref ant_channel_id_set_req_dec for request decoding.
  197. *
  198. * @param[in] return_code Return code indicating if command was successful or not.
  199. * @param[out] p_buf Pointer to buffer where encoded data command response will be
  200. * returned.
  201. * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
  202. * \c out: Length of encoded command response packet.
  203. *
  204. * @retval NRF_SUCCESS Encoding success.
  205. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  206. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  207. */
  208. uint32_t ant_channel_id_set_rsp_enc(uint32_t return_code,
  209. uint8_t * const p_buf,
  210. uint32_t * const p_buf_len);
  211. /**@brief Decodes @ref sd_ant_channel_period_set command request.
  212. *
  213. * @sa @ref ant_channel_period_set_rsp_enc for response encoding.
  214. *
  215. * @param[in] p_buf Pointer to beginning of command request packet.
  216. * @param[in] packet_len Length (in bytes) of response packet.
  217. *
  218. * @param[out] p_channel Pointer to an unsigned char (1 octet) where the channel number
  219. * associated with the period will be set.
  220. * @param[out] p_period Pointer to an unsigned short (2 octets) where the period will
  221. * be set. Value is in 32 kHz counts (usPeriod/32768 s).
  222. *
  223. * @retval NRF_SUCCESS Decoding success.
  224. * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
  225. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  226. */
  227. uint32_t ant_channel_period_set_req_dec(uint8_t const * const p_buf,
  228. uint32_t packet_len,
  229. uint8_t * const p_channel,
  230. uint16_t * const p_period);
  231. /**@brief Encodes @ref sd_ant_channel_period_set command response.
  232. *
  233. * @sa @ref ant_channel_period_set_req_dec for request decoding.
  234. *
  235. * @param[in] return_code Return code indicating if command was successful or not.
  236. * @param[out] p_buf Pointer to buffer where encoded data command response will be
  237. * returned.
  238. * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
  239. * \c out: Length of encoded command response packet.
  240. *
  241. * @retval NRF_SUCCESS Encoding success.
  242. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  243. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  244. */
  245. uint32_t ant_channel_period_set_rsp_enc(uint32_t return_code,
  246. uint8_t * const p_buf,
  247. uint32_t * const p_buf_len);
  248. /**@brief Decodes @ref sd_ant_channel_radio_freq_set command request.
  249. *
  250. * @sa @ref ant_channel_radio_freq_set_rsp_enc for response encoding.
  251. *
  252. * @param[in] p_buf Pointer to beginning of command request packet.
  253. * @param[in] packet_len Length (in bytes) of response packet.
  254. *
  255. * @param[out] p_channel Pointer to an unsigned char (1 octet) where the channel number
  256. * associated with the radio frequency will be set.
  257. * @param[out] p_freq Pointer to an unsigned char (1 octet) where the radio
  258. * frequency will be set. Value is offset from 2400 MHz
  259. * (eg. 2466 MHz, ucFreq = 66).
  260. *
  261. * @retval NRF_SUCCESS Decoding success.
  262. * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
  263. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  264. */
  265. uint32_t ant_channel_radio_freq_set_req_dec(uint8_t const * const p_buf,
  266. uint32_t packet_len,
  267. uint8_t * const p_channel,
  268. uint8_t * const p_freq);
  269. /**@brief Encodes @ref sd_ant_channel_radio_freq_set command response.
  270. *
  271. * @sa @ref ant_channel_radio_freq_set_req_dec for request decoding.
  272. *
  273. * @param[in] return_code Return code indicating if command was successful or not.
  274. * @param[out] p_buf Pointer to buffer where encoded data command response will be
  275. * returned.
  276. * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
  277. * \c out: Length of encoded command response packet.
  278. *
  279. * @retval NRF_SUCCESS Encoding success.
  280. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  281. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  282. */
  283. uint32_t ant_channel_radio_freq_set_rsp_enc(uint32_t return_code,
  284. uint8_t * const p_buf,
  285. uint32_t * const p_buf_len);
  286. /**@brief Decodes @ref sd_ant_broadcast_message_tx command request.
  287. *
  288. * @sa @ref ant_broadcast_message_tx_rsp_enc for response encoding.
  289. *
  290. * @param[in] p_buf Pointer to beginning of command request packet.
  291. * @param[in] packet_len Length (in bytes) of response packet.
  292. *
  293. * @param[out] p_channel Pointer to an unsigned char (1 octet) where the channel to
  294. * send the data on will be set.
  295. * @param[out] p_size Pointer to an unsigned char (1 octet) where the size of the
  296. * message will be set.
  297. * @param[out] pp_mesg Pointer to pointer to the buffer where the broadcast message
  298. * will be set (array must be 8 octets).
  299. *
  300. * @retval NRF_SUCCESS Decoding success.
  301. * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
  302. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  303. */
  304. uint32_t ant_broadcast_message_tx_req_dec(uint8_t const * const p_buf,
  305. uint32_t packet_len,
  306. uint8_t * const p_channel,
  307. uint8_t * const p_size,
  308. uint8_t * * const pp_mesg);
  309. /**@brief Encodes @ref sd_ant_broadcast_message_tx command response.
  310. *
  311. * @sa @ref ant_broadcast_message_tx_req_dec for request decoding.
  312. *
  313. * @param[in] return_code Return code indicating if command was successful or not.
  314. * @param[out] p_buf Pointer to buffer where encoded data command response will be
  315. * returned.
  316. * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
  317. * \c out: Length of encoded command response packet.
  318. *
  319. * @retval NRF_SUCCESS Encoding success.
  320. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  321. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  322. */
  323. uint32_t ant_broadcast_message_tx_rsp_enc(uint32_t return_code,
  324. uint8_t * const p_buf,
  325. uint32_t * const p_buf_len);
  326. /**@brief Decodes @ref sd_ant_acknowledge_message_tx command request.
  327. *
  328. * @sa @ref ant_acknowledge_message_tx_rsp_enc for response encoding.
  329. *
  330. * @param[in] p_buf Pointer to beginning of command request packet.
  331. * @param[in] packet_len Length (in bytes) of response packet.
  332. *
  333. * @param[out] p_channel Pointer to an unsigned char (1 octet) where the channel to
  334. * send the data on will be set.
  335. * @param[out] p_size Pointer to an unsigned char (1 octet) where the size of the
  336. * message will be set.
  337. * @param[out] pp_mesg Pointer to pointer to the buffer where the acknowledge message
  338. * will be set (array must be 8 octets).
  339. *
  340. * @retval NRF_SUCCESS Decoding success.
  341. * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
  342. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  343. */
  344. uint32_t ant_acknowledge_message_tx_req_dec(uint8_t const * const p_buf,
  345. uint32_t packet_len,
  346. uint8_t * const p_channel,
  347. uint8_t * const p_size,
  348. uint8_t * * const pp_mesg);
  349. /**@brief Encodes @ref sd_ant_acknowledge_message_tx command response.
  350. *
  351. * @sa @ref ant_acknowledge_message_tx_req_dec for request decoding.
  352. *
  353. * @param[in] return_code Return code indicating if command was successful or not.
  354. * @param[out] p_buf Pointer to buffer where encoded data command response will be
  355. * returned.
  356. * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
  357. * \c out: Length of encoded command response packet.
  358. *
  359. * @retval NRF_SUCCESS Encoding success.
  360. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  361. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  362. */
  363. uint32_t ant_acknowledge_message_tx_rsp_enc(uint32_t return_code,
  364. uint8_t * const p_buf,
  365. uint32_t * const p_buf_len);
  366. /**@brief Decodes @ref sd_ant_channel_unassign command request.
  367. *
  368. * @sa @ref ant_channel_unassign_rsp_enc for response encoding.
  369. *
  370. * @param[in] p_buf Pointer to beginning of command request packet.
  371. * @param[in] packet_len Length (in bytes) of response packet.
  372. *
  373. * @param[out] p_channel Pointer to an unsigned char (1 octet) where the channel to be
  374. * unassigned will be set.
  375. *
  376. * @retval NRF_SUCCESS Decoding success.
  377. * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
  378. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  379. */
  380. uint32_t ant_channel_unassign_req_dec(uint8_t const * const p_buf,
  381. uint32_t packet_len,
  382. uint8_t * const p_channel);
  383. /**@brief Encodes @ref sd_ant_channel_unassign command response.
  384. *
  385. * @sa @ref ant_channel_unassign_req_dec for request decoding.
  386. *
  387. * @param[in] return_code Return code indicating if command was successful or not.
  388. * @param[out] p_buf Pointer to buffer where encoded data command response will be
  389. * returned.
  390. * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
  391. * \c out: Length of encoded command response packet.
  392. *
  393. * @retval NRF_SUCCESS Encoding success.
  394. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  395. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  396. */
  397. uint32_t ant_channel_unassign_rsp_enc(uint32_t return_code,
  398. uint8_t * const p_buf,
  399. uint32_t * const p_buf_len);
  400. /**@brief Decodes @ref sd_ant_channel_close command request.
  401. *
  402. * @sa @ref ant_channel_close_rsp_enc for response encoding.
  403. *
  404. * @param[in] p_buf Pointer to beginning of command request packet.
  405. * @param[in] packet_len Length (in bytes) of response packet.
  406. *
  407. * @param[out] p_channel Pointer to an unsigned char (1 octet) where the channel to be
  408. * closed will be set.
  409. *
  410. * @retval NRF_SUCCESS Decoding success.
  411. * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
  412. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  413. */
  414. uint32_t ant_channel_close_req_dec(uint8_t const * const p_buf,
  415. uint32_t packet_len,
  416. uint8_t * const p_channel);
  417. /**@brief Encodes @ref sd_ant_channel_close command response.
  418. *
  419. * @sa @ref ant_channel_close_req_dec for request decoding.
  420. *
  421. * @param[in] return_code Return code indicating if command was successful or not.
  422. * @param[out] p_buf Pointer to buffer where encoded data command response will be
  423. * returned.
  424. * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
  425. * \c out: Length of encoded command response packet.
  426. *
  427. * @retval NRF_SUCCESS Encoding success.
  428. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  429. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  430. */
  431. uint32_t ant_channel_close_rsp_enc(uint32_t return_code,
  432. uint8_t * const p_buf,
  433. uint32_t * const p_buf_len);
  434. /**@brief Decodes @ref sd_ant_network_address_set command request.
  435. *
  436. * @sa @ref ant_network_address_set_rsp_enc for response encoding.
  437. *
  438. * @param[in] p_buf Pointer to beginning of command request packet.
  439. * @param[in] packet_len Length (in bytes) of response packet.
  440. *
  441. * @param[out] p_network Pointer to an unsigned char (1 octet) where the network number
  442. * to assign the network address to will be set.
  443. * @param[out] pp_network_key Pointer to a pointer to where the network key (8 octets in
  444. * length) will be set.
  445. *
  446. * @retval NRF_SUCCESS Decoding success.
  447. * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
  448. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  449. */
  450. uint32_t ant_network_address_set_req_dec(uint8_t const * const p_buf,
  451. uint32_t packet_len,
  452. uint8_t * const p_network,
  453. uint8_t * * const pp_network_key);
  454. /**@brief Encodes @ref sd_ant_network_address_set command response.
  455. *
  456. * @sa @ref ant_network_address_set_req_dec for request decoding.
  457. *
  458. * @param[in] return_code Return code indicating if command was successful or not.
  459. * @param[out] p_buf Pointer to buffer where encoded data command response will be
  460. * returned.
  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 ant_network_address_set_rsp_enc(uint32_t return_code,
  469. uint8_t * const p_buf,
  470. uint32_t * const p_buf_len);
  471. /**@brief Decodes @ref sd_ant_channel_radio_tx_power_set command request.
  472. *
  473. * @sa @ref ant_channel_radio_tx_power_set_rsp_enc for response encoding.
  474. *
  475. * @param[in] p_buf Pointer to beginning of command request packet.
  476. * @param[in] packet_len Length (in bytes) of response packet.
  477. *
  478. * @param[out] p_channel Pointer to an unsigned char (1 octet) where the channel number
  479. * to assign the radio TX power will be set.
  480. * @param[out] p_tx_power Pointer to an unsigned char (1 octet) where the ANT transmit
  481. * power index will be set. See Radio TX Power Definitions in
  482. * ant_parameters.h.
  483. * @param[out] p_custom_tx_power Pointer to an unsigned char (1 octet) where the custom nRF
  484. * transmit power as defined in nrf51_bitfields.h will be set.
  485. * Only applicable if tx_power is set to custom TX power
  486. * selection.
  487. *
  488. * @retval NRF_SUCCESS Decoding success.
  489. * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
  490. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  491. */
  492. uint32_t ant_channel_radio_tx_power_set_req_dec(uint8_t const * const p_buf,
  493. uint32_t packet_len,
  494. uint8_t * const p_channel,
  495. uint8_t * const p_tx_power,
  496. uint8_t * const p_custom_tx_power);
  497. /**@brief Encodes @ref sd_ant_channel_radio_tx_power_set command response.
  498. *
  499. * @sa @ref ant_channel_radio_tx_power_set_req_dec for request decoding.
  500. *
  501. * @param[in] return_code Return code indicating if command was successful or not.
  502. * @param[out] p_buf Pointer to buffer where encoded data command response will be
  503. * returned.
  504. * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
  505. * \c out: Length of encoded command response packet.
  506. *
  507. * @retval NRF_SUCCESS Encoding success.
  508. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  509. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  510. */
  511. uint32_t ant_channel_radio_tx_power_set_rsp_enc(uint32_t return_code,
  512. uint8_t * const p_buf,
  513. uint32_t * const p_buf_len);
  514. /**@brief Decodes @ref sd_ant_channel_rx_search_timeout_set command request.
  515. *
  516. * @sa @ref ant_channel_rx_search_timeout_set_rsp_enc for response encoding.
  517. *
  518. * @param[in] p_buf Pointer to beginning of command request packet.
  519. * @param[in] packet_len Length (in bytes) of response packet.
  520. *
  521. * @param[out] p_channel Pointer to an unsigned char (1 octet) where the channel number
  522. * will be set.
  523. * @param[out] p_timeout Pointer to an unsigned char (1 octet) where the time-out value
  524. * will be set.
  525. *
  526. * @retval NRF_SUCCESS Decoding success.
  527. * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
  528. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  529. */
  530. uint32_t ant_channel_rx_search_timeout_set_req_dec(uint8_t const * const p_buf,
  531. uint32_t packet_len,
  532. uint8_t * const p_channel,
  533. uint8_t * const p_timeout);
  534. /**@brief Encodes @ref sd_ant_channel_rx_search_timeout_set command response.
  535. *
  536. * @sa @ref ant_channel_rx_search_timeout_set_req_dec for request decoding.
  537. *
  538. * @param[in] return_code Return code indicating if command was successful or not.
  539. * @param[out] p_buf Pointer to buffer where encoded data command response will be
  540. * returned.
  541. * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
  542. * \c out: Length of encoded command response packet.
  543. *
  544. * @retval NRF_SUCCESS Encoding success.
  545. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  546. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  547. */
  548. uint32_t ant_channel_rx_search_timeout_set_rsp_enc(uint32_t return_code,
  549. uint8_t * const p_buf,
  550. uint32_t * const p_buf_len);
  551. /**@brief Decodes @ref sd_ant_channel_low_priority_rx_search_timeout_set command request.
  552. *
  553. * @sa @ref ant_channel_low_priority_rx_search_timeout_set_rsp_enc for response encoding.
  554. *
  555. * @param[in] p_buf Pointer to beginning of command request packet.
  556. * @param[in] packet_len Length (in bytes) of response packet.
  557. *
  558. * @param[out] p_channel Pointer to an unsigned char (1 octet) where the channel number
  559. * will be set.
  560. * @param[out] p_timeout Pointer to an unsigned char (1 octet) where the time-out value
  561. * will be set.
  562. *
  563. * @retval NRF_SUCCESS Decoding success.
  564. * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
  565. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  566. */
  567. uint32_t ant_channel_low_priority_rx_search_timeout_set_req_dec(uint8_t const * const p_buf,
  568. uint32_t packet_len,
  569. uint8_t * const p_channel,
  570. uint8_t * const p_timeout);
  571. /**@brief Encodes @ref sd_ant_channel_low_priority_rx_search_timeout_set command response.
  572. *
  573. * @sa @ref ant_channel_low_priority_rx_search_timeout_set_req_dec for request decoding.
  574. *
  575. * @param[in] return_code Return code indicating if command was successful or not.
  576. * @param[out] p_buf Pointer to buffer where encoded data command response will be
  577. * returned.
  578. * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
  579. * \c out: Length of encoded command response packet.
  580. *
  581. * @retval NRF_SUCCESS Encoding success.
  582. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  583. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  584. */
  585. uint32_t ant_channel_low_priority_rx_search_timeout_set_rsp_enc(uint32_t return_code,
  586. uint8_t * const p_buf,
  587. uint32_t * const p_buf_len);
  588. /**@brief Decodes @ref sd_ant_prox_search_set command request.
  589. *
  590. * @sa @ref ant_prox_search_set_rsp_enc for response encoding.
  591. *
  592. * @param[in] p_buf Pointer to beginning of command request packet.
  593. * @param[in] packet_len Length (in bytes) of response packet.
  594. *
  595. * @param[out] p_channel Pointer to an unsigned char (1 octet) where the channel
  596. * number will be set.
  597. * @param[out] p_prox_threshold Pointer to an unsigned char (1 octet) where the minimum
  598. * RSSI threshold required for acquisition during a search
  599. * will be set. See Radio Proximity Search Threshold in
  600. * ant_parameters.h.
  601. * @param[out] p_custom_prox_threshold Pointer to an unsigned char (1 octet) where the custom
  602. * minimum RSSI threshold for acquisition during a search
  603. * will be set. Only applicable if prox_threshold is set to
  604. * custom proximity selection.
  605. *
  606. * @retval NRF_SUCCESS Decoding success.
  607. * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
  608. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  609. */
  610. uint32_t ant_prox_search_set_req_dec(uint8_t const * const p_buf,
  611. uint32_t packet_len,
  612. uint8_t * const p_channel,
  613. uint8_t * const p_prox_threshold,
  614. uint8_t * const p_custom_prox_threshold);
  615. /**@brief Encodes @ref sd_ant_prox_search_set command response.
  616. *
  617. * @sa @ref ant_prox_search_set_req_dec for request decoding.
  618. *
  619. * @param[in] return_code Return code indicating if command was successful or not.
  620. * @param[out] p_buf Pointer to buffer where encoded data command response will be
  621. * returned.
  622. * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
  623. * \c out: Length of encoded command response packet.
  624. *
  625. * @retval NRF_SUCCESS Encoding success.
  626. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  627. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  628. */
  629. uint32_t ant_prox_search_set_rsp_enc(uint32_t return_code,
  630. uint8_t * const p_buf,
  631. uint32_t * const p_buf_len);
  632. /**@brief Decodes @ref sd_ant_search_waveform_set command request.
  633. *
  634. * @sa @ref ant_search_waveform_set_rsp_enc for response encoding.
  635. *
  636. * @param[in] p_buf Pointer to beginning of command request packet.
  637. * @param[in] packet_len Length (in bytes) of response packet.
  638. *
  639. * @param[out] p_channel Pointer to an unsigned char (1 octet) where the channel
  640. * number will be set.
  641. * @param[out] p_waveform Pointer to an unsigned short (2 octets) where the channel
  642. * waveform period (usWaveform/32768 s) will be set.
  643. * Default = 316.
  644. *
  645. * @retval NRF_SUCCESS Decoding success.
  646. * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
  647. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  648. */
  649. uint32_t ant_search_waveform_set_req_dec(uint8_t const * const p_buf,
  650. uint32_t packet_len,
  651. uint8_t * const p_channel,
  652. uint16_t * const p_waveform);
  653. /**@brief Encodes @ref sd_ant_search_waveform_set command response.
  654. *
  655. * @sa @ref ant_search_waveform_set_req_dec for request decoding.
  656. *
  657. * @param[in] return_code Return code indicating if command was successful or not.
  658. * @param[out] p_buf Pointer to buffer where encoded data command response will be
  659. * returned.
  660. * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
  661. * \c out: Length of encoded command response packet.
  662. *
  663. * @retval NRF_SUCCESS Encoding success.
  664. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  665. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  666. */
  667. uint32_t ant_search_waveform_set_rsp_enc(uint32_t return_code,
  668. uint8_t * const p_buf,
  669. uint32_t * const p_buf_len);
  670. /**@brief Decodes @ref sd_ant_channel_id_get command request.
  671. *
  672. * @sa @ref ant_channel_id_get_rsp_enc for response encoding.
  673. *
  674. * @param[in] p_buf Pointer to beginning of command request packet.
  675. * @param[in] packet_len Length (in bytes) of response packet.
  676. *
  677. * @param[out] p_channel Pointer to an unsigned char (1 octet) where the channel
  678. * number will be set.
  679. *
  680. * @retval NRF_SUCCESS Decoding success.
  681. * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
  682. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  683. */
  684. uint32_t ant_channel_id_get_req_dec(uint8_t const * const p_buf,
  685. uint16_t packet_len,
  686. uint8_t * const p_channel);
  687. /**@brief Encodes @ref sd_ant_channel_id_get command response.
  688. *
  689. * @sa @ref ant_channel_id_get_req_dec for request decoding.
  690. *
  691. * @param[in] return_code Return code indicating if command was successful or not.
  692. * @param[out] p_buf Pointer to buffer where encoded data command response will be
  693. * returned.
  694. * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
  695. * \c out: Length of encoded command response packet.
  696. * @param[in] p_device_number Pointer to device number
  697. * @param[in] p_device_type Pointer to device type
  698. * @param[in] p_transmit_type Pointer to transmit type
  699. *
  700. * @retval NRF_SUCCESS Encoding success.
  701. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  702. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  703. */
  704. uint32_t ant_channel_id_get_rsp_enc(uint32_t return_code,
  705. uint8_t * const p_buf,
  706. uint32_t * const p_buf_len,
  707. uint16_t const * const p_device_number,
  708. uint8_t const * const p_device_type,
  709. uint8_t const * const p_transmit_type);
  710. /**@brief Decodes @ref sd_ant_channel_radio_freq_get command request.
  711. *
  712. * @sa @ref ant_channel_radio_freq_get_rsp_enc for response encoding.
  713. *
  714. * @param[in] p_buf Pointer to beginning of command request packet.
  715. * @param[in] packet_len Length (in bytes) of response packet.
  716. *
  717. * @param[out] p_channel Pointer to an unsigned char (1 octet) where the channel number
  718. * will be set.
  719. *
  720. * @retval NRF_SUCCESS Decoding success.
  721. * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
  722. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  723. */
  724. uint32_t ant_channel_radio_freq_get_req_dec(uint8_t const * const p_buf,
  725. uint16_t packet_len,
  726. uint8_t * const p_channel);
  727. /**@brief Encodes @ref sd_ant_channel_radio_freq_get command response.
  728. *
  729. * @sa @ref ant_channel_radio_freq_get_req_dec for request decoding.
  730. *
  731. * @param[in] return_code Return code indicating if command was successful or not.
  732. * @param[out] p_buf Pointer to buffer where encoded data command response will be
  733. * returned.
  734. * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
  735. * \c out: Length of encoded command response packet.
  736. * @param[in] p_r_freq Pointer to radio frequency
  737. *
  738. * @retval NRF_SUCCESS Encoding success.
  739. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  740. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  741. */
  742. uint32_t ant_channel_radio_freq_get_rsp_enc(uint32_t return_code,
  743. uint8_t * const p_buf,
  744. uint32_t * const p_buf_len,
  745. uint8_t const * const p_r_freq);
  746. /**@brief Decodes @ref sd_ant_channel_period_get command request.
  747. *
  748. * @sa @ref ant_channel_period_get_rsp_enc for response encoding.
  749. *
  750. * @param[in] p_buf Pointer to beginning of command request packet.
  751. * @param[in] packet_len Length (in bytes) of response packet.
  752. *
  753. * @param[out] p_channel Pointer to an unsigned char (1 octet) where the channel number
  754. * will be set.
  755. *
  756. * @retval NRF_SUCCESS Decoding success.
  757. * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
  758. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  759. */
  760. uint32_t ant_channel_period_get_req_dec(uint8_t const * const p_buf,
  761. uint16_t packet_len,
  762. uint8_t * const p_channel);
  763. /**@brief Encodes @ref sd_ant_channel_period_get command response.
  764. *
  765. * @sa @ref ant_channel_period_get_req_dec for request decoding.
  766. *
  767. * @param[in] return_code Return code indicating if command was successful or not.
  768. * @param[out] p_buf Pointer to buffer where encoded data command response will be
  769. * returned.
  770. * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
  771. * \c out: Length of encoded command response packet.
  772. * @param[in] p_period Pointer to period
  773. *
  774. * @retval NRF_SUCCESS Encoding success.
  775. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  776. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  777. */
  778. uint32_t ant_channel_period_get_rsp_enc(uint32_t return_code,
  779. uint8_t * const p_buf,
  780. uint32_t * const p_buf_len,
  781. uint16_t const * const p_period);
  782. /**@brief Decodes @ref sd_ant_search_channel_priority_set command request.
  783. *
  784. * @sa @ref ant_search_channel_priority_set_rsp_enc for response encoding.
  785. *
  786. * @param[in] p_buf Pointer to beginning of command request packet.
  787. * @param[in] packet_len Length (in bytes) of response packet.
  788. *
  789. * @param[out] p_channel Pointer to an unsigned char (1 octet) where the channel number
  790. * will be set.
  791. * @param[out] p_search_priority Pointer to an unsigned char (1 octet) where the search
  792. * priority value will be set. 0 to 7 (Default = 0).
  793. *
  794. * @retval NRF_SUCCESS Decoding success.
  795. * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
  796. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  797. */
  798. uint32_t ant_search_channel_priority_set_req_dec(uint8_t const * const p_buf,
  799. uint32_t packet_len,
  800. uint8_t * const p_channel,
  801. uint8_t * const p_search_priority);
  802. /**@brief Encodes @ref sd_ant_search_channel_priority_set command response.
  803. *
  804. * @sa @ref ant_search_channel_priority_set_req_dec for request decoding.
  805. *
  806. * @param[in] return_code Return code indicating if command was successful or not.
  807. * @param[out] p_buf Pointer to buffer where encoded data command response will be
  808. * returned.
  809. * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
  810. * \c out: Length of encoded command response packet.
  811. *
  812. * @retval NRF_SUCCESS Encoding success.
  813. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  814. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  815. */
  816. uint32_t ant_search_channel_priority_set_rsp_enc(uint32_t return_code,
  817. uint8_t * const p_buf,
  818. uint32_t * const p_buf_len);
  819. /**@brief Decodes @ref sd_ant_active_search_sharing_cycles_set command request.
  820. *
  821. * @sa @ref ant_active_search_sharing_cycles_set_rsp_enc for response encoding.
  822. *
  823. * @param[in] p_buf Pointer to beginning of command request packet.
  824. * @param[in] packet_len Length (in bytes) of response packet.
  825. *
  826. * @param[out] p_channel Pointer to an unsigned char (1 octet) where the channel number
  827. * will be set.
  828. * @param[out] p_cycles Pointer to an unsigned char (1 octet) where the numbe of
  829. * cycles will be set.
  830. *
  831. * @retval NRF_SUCCESS Decoding success.
  832. * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
  833. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  834. */
  835. uint32_t ant_active_search_sharing_cycles_set_req_dec(uint8_t const * const p_buf,
  836. uint32_t packet_len,
  837. uint8_t * const p_channel,
  838. uint8_t * const p_cycles);
  839. /**@brief Encodes @ref sd_ant_active_search_sharing_cycles_set command response.
  840. *
  841. * @sa @ref ant_active_search_sharing_cycles_set_req_dec for request decoding.
  842. *
  843. * @param[in] return_code Return code indicating if command was successful or not.
  844. * @param[out] p_buf Pointer to buffer where encoded data command response will be
  845. * returned.
  846. * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
  847. * \c out: Length of encoded command response packet.
  848. *
  849. * @retval NRF_SUCCESS Encoding success.
  850. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  851. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  852. */
  853. uint32_t ant_active_search_sharing_cycles_set_rsp_enc(uint32_t return_code,
  854. uint8_t * const p_buf,
  855. uint32_t * const p_buf_len);
  856. /**@brief Decodes @ref sd_ant_lib_config_set command request.
  857. *
  858. * @sa @ref ant_lib_config_set_rsp_enc for response encoding.
  859. *
  860. * @param[in] p_buf Pointer to beginning of command request packet.
  861. * @param[in] packet_len Length (in bytes) of response packet.
  862. *
  863. * @param[out] p_ant_lib_config Pointer to an unsigned char (1 octet) where the ANT lib
  864. * config bit flags will be set. See ANT Library Config in
  865. * ant_parameters.h.
  866. *
  867. * @retval NRF_SUCCESS Decoding success.
  868. * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
  869. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  870. */
  871. uint32_t ant_lib_config_set_req_dec(uint8_t const * const p_buf,
  872. uint32_t packet_len,
  873. uint8_t * const p_ant_lib_config);
  874. /**@brief Encodes @ref sd_ant_lib_config_set command response.
  875. *
  876. * @sa @ref ant_lib_config_set_req_dec for request decoding.
  877. *
  878. * @param[in] return_code Return code indicating if command was successful or not.
  879. * @param[out] p_buf Pointer to buffer where encoded data command response will be
  880. * returned.
  881. * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
  882. * \c out: Length of encoded command response packet.
  883. *
  884. * @retval NRF_SUCCESS Encoding success.
  885. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  886. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  887. */
  888. uint32_t ant_lib_config_set_rsp_enc(uint32_t return_code,
  889. uint8_t * const p_buf,
  890. uint32_t * const p_buf_len);
  891. /**@brief Decodes @ref sd_ant_active_search_sharing_cycles_get command request.
  892. *
  893. * @sa @ref ant_active_search_sharing_cycles_get_rsp_enc for response encoding.
  894. *
  895. * @param[in] p_buf Pointer to beginning of command request packet.
  896. * @param[in] packet_len Length (in bytes) of response packet.
  897. *
  898. * @param[out] p_channel Pointer to an unsigned char (1 octet) where the channel number
  899. * will be set.
  900. *
  901. * @retval NRF_SUCCESS Decoding success.
  902. * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
  903. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  904. */
  905. uint32_t ant_active_search_sharing_cycles_get_req_dec(uint8_t const * const p_buf,
  906. uint16_t packet_len,
  907. uint8_t * const p_channel);
  908. /**@brief Encodes @ref sd_ant_active_search_sharing_cycles_get command response.
  909. *
  910. * @sa @ref ant_active_search_sharing_cycles_get_req_dec for request decoding.
  911. *
  912. * @param[in] return_code Return code indicating if command was successful or not.
  913. * @param[out] p_buf Pointer to buffer where encoded data command response will be
  914. * returned.
  915. * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
  916. * \c out: Length of encoded command response packet.
  917. * @param[in] p_cycles Pointer to cycles.
  918. *
  919. * @retval NRF_SUCCESS Encoding success.
  920. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  921. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  922. */
  923. uint32_t ant_active_search_sharing_cycles_get_rsp_enc(uint32_t return_code,
  924. uint8_t * const p_buf,
  925. uint32_t * const p_buf_len,
  926. uint8_t const * const p_cycles);
  927. /**@brief Encodes @ref sd_ant_lib_config_get command response.
  928. *
  929. * @param[in] return_code Return code indicating if command was successful or not.
  930. * @param[out] p_buf Pointer to buffer where encoded data command response will be
  931. * returned.
  932. * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
  933. * \c out: Length of encoded command response packet.
  934. * @param[in] p_ant_lib_config Pointer to ANT library configuration.
  935. *
  936. * @retval NRF_SUCCESS Encoding success.
  937. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  938. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  939. */
  940. uint32_t ant_lib_config_get_rsp_enc(uint32_t return_code,
  941. uint8_t * const p_buf,
  942. uint32_t * const p_buf_len,
  943. uint8_t const * const p_ant_lib_config);
  944. /**@brief Decodes @ref sd_ant_lib_config_clear command request.
  945. *
  946. * @sa @ref ant_lib_config_clear_rsp_enc for response encoding.
  947. *
  948. * @param[in] p_buf Pointer to beginning of command request packet.
  949. * @param[in] packet_len Length (in bytes) of response packet.
  950. *
  951. * @param[out] p_ant_lib_config Pointer to an unsigned char (1 octet) where the ANT lib config
  952. * bit(s) to clear will be set. See ANT Library Config in
  953. * ant_parameters.h.
  954. *
  955. * @retval NRF_SUCCESS Decoding success.
  956. * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
  957. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  958. */
  959. uint32_t ant_lib_config_clear_req_dec(uint8_t const * const p_buf,
  960. uint32_t packet_len,
  961. uint8_t * const p_ant_lib_config);
  962. /**@brief Encodes @ref sd_ant_lib_config_clear command response.
  963. *
  964. * @sa @ref ant_lib_config_clear_req_dec for request decoding.
  965. *
  966. * @param[in] return_code Return code indicating if command was successful or not.
  967. * @param[out] p_buf Pointer to buffer where encoded data command response will be
  968. * returned.
  969. * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
  970. * \c out: Length of encoded command response packet.
  971. *
  972. * @retval NRF_SUCCESS Encoding success.
  973. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  974. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  975. */
  976. uint32_t ant_lib_config_clear_rsp_enc(uint32_t return_code,
  977. uint8_t * const p_buf,
  978. uint32_t * const p_buf_len);
  979. /**@brief Encodes @ref sd_ant_stack_reset command response.
  980. *
  981. * @param[in] return_code Return code indicating if command was successful or not.
  982. * @param[out] p_buf Pointer to buffer where encoded data command response will be
  983. * returned.
  984. * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
  985. * \c out: Length of encoded command response packet.
  986. *
  987. * @retval NRF_SUCCESS Encoding success.
  988. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  989. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  990. */
  991. uint32_t ant_stack_reset_rsp_enc(uint32_t return_code,
  992. uint8_t * const p_buf,
  993. uint32_t * const p_buf_len);
  994. /**@brief Decodes @ref sd_ant_rx_scan_mode_start command request.
  995. *
  996. * @sa @ref ant_rx_scan_mode_start_rsp_enc for response encoding.
  997. *
  998. * @param[in] p_buf Pointer to beginning of command request packet.
  999. * @param[in] packet_len Length (in bytes) of response packet.
  1000. *
  1001. * @param[out] p_sync_channel_packets_only Pointer to an unsigned char (1 octet) where the
  1002. * synchronous channel only scanning mode will be set.
  1003. * 0 = disable, 1 = enable.
  1004. *
  1005. * @retval NRF_SUCCESS Decoding success.
  1006. * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
  1007. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  1008. */
  1009. uint32_t ant_rx_scan_mode_start_req_dec(uint8_t const * const p_buf,
  1010. uint32_t packet_len,
  1011. uint8_t * const p_sync_channel_packets_only);
  1012. /**@brief Encodes @ref sd_ant_rx_scan_mode_start command response.
  1013. *
  1014. * @sa @ref ant_rx_scan_mode_start_req_dec for request decoding.
  1015. *
  1016. * @param[in] return_code Return code indicating if command was successful or not.
  1017. * @param[out] p_buf Pointer to buffer where encoded data command response will be
  1018. * returned.
  1019. * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
  1020. * \c out: Length of encoded command response packet.
  1021. *
  1022. * @retval NRF_SUCCESS Encoding success.
  1023. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  1024. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  1025. */
  1026. uint32_t ant_rx_scan_mode_start_rsp_enc(uint32_t return_code,
  1027. uint8_t * const p_buf,
  1028. uint32_t * const p_buf_len);
  1029. /**@brief Decodes @ref sd_ant_id_list_add command request.
  1030. *
  1031. * @sa @ref ant_id_list_add_rsp_enc for response encoding.
  1032. *
  1033. * @param[in] p_buf Pointer to beginning of command request packet.
  1034. * @param[in] packet_len Length (in bytes) of response packet.
  1035. *
  1036. * @param[out] p_channel Pointer to an unsigned char (1 octet) where the channel
  1037. * number to add the list entry to will be set.
  1038. * @param[out] pp_dev_id Pointer to pointer to where the Dev ID will be stored.
  1039. * @param[out] p_list_index Pointer to an unsigned char (1 octet) where the list
  1040. * index (0-3), will be set.
  1041. *
  1042. * @retval NRF_SUCCESS Decoding success.
  1043. * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
  1044. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  1045. */
  1046. uint32_t ant_id_list_add_req_dec(uint8_t const * const p_buf,
  1047. uint32_t packet_len,
  1048. uint8_t * const p_channel,
  1049. uint8_t * * const pp_dev_id,
  1050. uint8_t * const p_list_index);
  1051. /**@brief Encodes @ref sd_ant_id_list_add command response.
  1052. *
  1053. * @sa @ref ant_id_list_add_req_dec for request decoding.
  1054. *
  1055. * @param[in] return_code Return code indicating if command was successful or not.
  1056. * @param[out] p_buf Pointer to buffer where encoded data command response will be
  1057. * returned.
  1058. * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
  1059. * \c out: Length of encoded command response packet.
  1060. *
  1061. * @retval NRF_SUCCESS Encoding success.
  1062. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  1063. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  1064. */
  1065. uint32_t ant_id_list_add_rsp_enc(uint32_t return_code,
  1066. uint8_t * const p_buf,
  1067. uint32_t * const p_buf_len);
  1068. /**@brief Decodes @ref sd_ant_id_list_config command request.
  1069. *
  1070. * @sa @ref ant_id_list_config_rsp_enc for response encoding.
  1071. *
  1072. * @param[in] p_buf Pointer to beginning of command request packet.
  1073. * @param[in] packet_len Length (in bytes) of response packet.
  1074. *
  1075. * @param[out] p_channel Pointer to an unsigned char (1 octet) wher the channel number
  1076. * of the device ID list will be stored.
  1077. * @param[out] p_id_list_size Pointer to an unsigned char (1 octet) where the size of the
  1078. * inclusion or exclusion list (0-4) will be stored.
  1079. * @param[out] p_inc_exc_flag Pointer to an unsigned char (1 octet) where the type of list
  1080. * will be stored.
  1081. *
  1082. * @retval NRF_SUCCESS Decoding success.
  1083. * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
  1084. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  1085. */
  1086. uint32_t ant_id_list_config_req_dec(uint8_t const * const p_buf,
  1087. uint32_t packet_len,
  1088. uint8_t * const p_channel,
  1089. uint8_t * const p_id_list_size,
  1090. uint8_t * const p_inc_exc_flag);
  1091. /**@brief Encodes @ref sd_ant_id_list_add command response.
  1092. *
  1093. * @sa @ref ant_id_list_config_req_dec for request decoding.
  1094. *
  1095. * @param[in] return_code Return code indicating if command was successful or not.
  1096. * @param[out] p_buf Pointer to buffer where encoded data command response will be
  1097. * returned.
  1098. * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
  1099. * \c out: Length of encoded command response packet.
  1100. *
  1101. * @retval NRF_SUCCESS Encoding success.
  1102. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  1103. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  1104. */
  1105. uint32_t ant_id_list_config_rsp_enc(uint32_t return_code,
  1106. uint8_t * const p_buf,
  1107. uint32_t * const p_buf_len);
  1108. /**@brief Decodes @ref sd_ant_channel_status_get command request.
  1109. *
  1110. * @sa @ref ant_channel_status_get_rsp_enc for response encoding.
  1111. *
  1112. * @param[in] p_buf Pointer to beginning of command request packet.
  1113. * @param[in] packet_len Length (in bytes) of response packet.
  1114. *
  1115. * @param[out] p_channel Pointer to an unsigned char (1 octet) where the channel number
  1116. * will be set.
  1117. *
  1118. * @retval NRF_SUCCESS Decoding success.
  1119. * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
  1120. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  1121. */
  1122. uint32_t ant_channel_status_get_req_dec(uint8_t const * const p_buf,
  1123. uint16_t packet_len,
  1124. uint8_t * const p_channel);
  1125. /**@brief Encodes @ref sd_ant_channel_status_get command response.
  1126. *
  1127. * @sa @ref ant_channel_status_get_req_dec for request decoding.
  1128. *
  1129. * @param[in] return_code Return code indicating if command was successful or not.
  1130. * @param[out] p_buf Pointer to buffer where encoded data command response will be
  1131. * returned.
  1132. * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
  1133. * \c out: Length of encoded command response packet.
  1134. * @param[in] p_status Pointer to status
  1135. *
  1136. * @retval NRF_SUCCESS Encoding success.
  1137. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  1138. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  1139. */
  1140. uint32_t ant_channel_status_get_rsp_enc(uint32_t return_code,
  1141. uint8_t * const p_buf,
  1142. uint32_t * const p_buf_len,
  1143. uint8_t const * const p_status);
  1144. /**@brief Encodes @ref sd_ant_cw_test_mode_init command response.
  1145. *
  1146. * @param[in] return_code Return code indicating if command was successful or not.
  1147. * @param[out] p_buf Pointer to buffer where encoded data command response will be
  1148. * returned.
  1149. * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
  1150. * \c out: Length of encoded command response packet.
  1151. *
  1152. * @retval NRF_SUCCESS Encoding success.
  1153. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  1154. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  1155. */
  1156. uint32_t ant_cw_test_mode_init_rsp_enc(uint32_t return_code,
  1157. uint8_t * const p_buf,
  1158. uint32_t * const p_buf_len);
  1159. /**@brief Decodes @ref sd_ant_cw_test_mode command request.
  1160. *
  1161. * @sa @ref ant_cw_test_mode_rsp_enc for response encoding.
  1162. *
  1163. * @param[in] p_buf Pointer to beginning of command request packet.
  1164. * @param[in] packet_len Length (in bytes) of response packet.
  1165. *
  1166. * @param[out] p_radio_freq Pointer to an unsigned char (1 octet) where the radio
  1167. * frequency offset from 2400 MHz for continuous wave mode will be
  1168. * set. (eg. 2466 MHz, ucRadioFreq = 66).
  1169. * @param[out] p_tx_power Pointer to an unsigned char (1 octet) where the ANT transmit
  1170. * power index for continuous wave mode will be set. See Radio
  1171. * TX Power Definitions in ant_parameters.h
  1172. * @param[out] p_custom_tx_power Pointer to an unsigned char (1 octet) where the custom nRF
  1173. * transmit power as defined in nrf51_bitfields.h will be set. Only
  1174. * applicable if ucTxPower is set to custom TX power selection.
  1175. * @param[out] p_mode Pointer to an unsigned char (1 octet) where the test mode type
  1176. * will be set.
  1177. * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
  1178. *
  1179. * @retval NRF_SUCCESS Decoding success.
  1180. * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
  1181. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  1182. */
  1183. uint32_t ant_cw_test_mode_req_dec(uint8_t const * const p_buf,
  1184. uint32_t packet_len,
  1185. uint8_t * const p_radio_freq,
  1186. uint8_t * const p_tx_power,
  1187. uint8_t * const p_custom_tx_power,
  1188. uint8_t * const p_mode);
  1189. /**@brief Encodes @ref sd_ant_cw_test_mode command response.
  1190. *
  1191. * @sa @ref ant_cw_test_mode_req_dec for request decoding.
  1192. *
  1193. * @param[in] return_code Return code indicating if command was successful or not.
  1194. * @param[out] p_buf Pointer to buffer where encoded data command response will be
  1195. * returned.
  1196. * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
  1197. * \c out: Length of encoded command response packet.
  1198. *
  1199. * @retval NRF_SUCCESS Encoding success.
  1200. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  1201. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  1202. */
  1203. uint32_t ant_cw_test_mode_rsp_enc(uint32_t return_code,
  1204. uint8_t * const p_buf,
  1205. uint32_t * const p_buf_len);
  1206. /**@brief Encodes @ref sd_ant_version_get command response.
  1207. *
  1208. * @param[in] return_code Return code indicating if command was successful or not.
  1209. * @param[out] p_buf Pointer to buffer where encoded data command response will be
  1210. * returned.
  1211. * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
  1212. * \c out: Length of encoded command response packet.
  1213. * @param[in] p_version Pointer to version.
  1214. *
  1215. * @retval NRF_SUCCESS Encoding success.
  1216. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  1217. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  1218. */
  1219. uint32_t ant_version_get_rsp_enc(uint32_t return_code,
  1220. uint8_t * const p_buf,
  1221. uint32_t * const p_buf_len,
  1222. uint8_t const * const p_version);
  1223. /**@brief Encodes @ref sd_ant_capabilities_get command response.
  1224. *
  1225. * @param[in] return_code Return code indicating if command was successful or not.
  1226. * @param[out] p_buf Pointer to buffer where encoded data command response will be
  1227. * returned.
  1228. * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
  1229. * \c out: Length of encoded command response packet.
  1230. * @param[in] p_capabilities Pointer to ant capabilities buffer.
  1231. *
  1232. * @retval NRF_SUCCESS Encoding success.
  1233. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  1234. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  1235. */
  1236. uint32_t ant_capabilities_get_rsp_enc(uint32_t return_code,
  1237. uint8_t * const p_buf,
  1238. uint32_t * const p_buf_len,
  1239. uint8_t const * const p_capabilities);
  1240. /**@brief Decodes @ref sd_ant_crypto_channel_enable command request.
  1241. *
  1242. * @sa @ref ant_crypto_channel_enable_rsp_enc for response encoding.
  1243. *
  1244. * @param[in] p_buf Pointer to beginning of command request packet.
  1245. * @param[in] packet_len Length (in bytes) of response packet.
  1246. *
  1247. * @param[out] p_channel Pointer to an unsigned char (1 octet) where the channel in which
  1248. * encryption mode is set will be copied to.
  1249. * @param[out] p_enable Pointer to an unsigned char (1 octet) where the encryption
  1250. * mode will be set.
  1251. * @param[out] p_key_num Pointer to an unsigned char (1 octet) where the key index of the
  1252. * 128-bit key to be used for encryption will be set.
  1253. * @param[out] p_decimation_rate Pointer to an unsigned char (1 octet) where the decimate rate to
  1254. * apply for encrypted slave channel will be set. Must be > 0.
  1255. *
  1256. * @retval NRF_SUCCESS Decoding success.
  1257. * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
  1258. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  1259. */
  1260. uint32_t ant_crypto_channel_enable_req_dec(uint8_t const * const p_buf,
  1261. uint32_t packet_len,
  1262. uint8_t * const p_channel,
  1263. uint8_t * const p_enable,
  1264. uint8_t * const p_key_num,
  1265. uint8_t * const p_decimation_rate);
  1266. /**@brief Encodes @ref sd_ant_crypto_channel_enable command response.
  1267. *
  1268. * @sa @ref ant_crypto_channel_enable_req_dec for request decoding.
  1269. *
  1270. * @param[in] return_code Return code indicating if command was successful or not.
  1271. * @param[out] p_buf Pointer to buffer where encoded data command response will be
  1272. * returned.
  1273. * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
  1274. * \c out: Length of encoded command response packet.
  1275. *
  1276. * @retval NRF_SUCCESS Encoding success.
  1277. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  1278. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  1279. */
  1280. uint32_t ant_crypto_channel_enable_rsp_enc(uint32_t return_code,
  1281. uint8_t * const p_buf,
  1282. uint32_t * const p_buf_len);
  1283. /**@brief Decodes @ref sd_ant_adv_burst_config_set command request.
  1284. *
  1285. * @sa @ref ant_adv_burst_config_set_rsp_enc for response encoding.
  1286. *
  1287. * @param[in] p_buf Pointer to beginning of command request packet.
  1288. * @param[in] packet_len Length (in bytes) of response packet.
  1289. *
  1290. * @param[out] p_config Pointer to the buffer where advanced burst
  1291. * configuration will be set.
  1292. * @param[out] p_size Pointer to an unsigned char (1 octet) where the size of the
  1293. * configuration parameter buffer will be set.
  1294. * @retval NRF_SUCCESS Decoding success.
  1295. * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
  1296. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  1297. */
  1298. uint32_t ant_adv_burst_config_set_req_dec(uint8_t const * const p_buf,
  1299. uint32_t packet_len,
  1300. uint8_t * const p_config,
  1301. uint8_t * const p_size);
  1302. /**@brief Encodes @ref sd_ant_adv_burst_config_set command response.
  1303. *
  1304. * @sa @ref ant_adv_burst_config_set_req_dec for request decoding.
  1305. *
  1306. * @param[in] return_code Return code indicating if command was successful or not.
  1307. * @param[out] p_buf Pointer to buffer where encoded data command response will be
  1308. * returned.
  1309. * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
  1310. * \c out: Length of encoded command response packet.
  1311. *
  1312. * @retval NRF_SUCCESS Encoding success.
  1313. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  1314. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  1315. */
  1316. uint32_t ant_adv_burst_config_set_rsp_enc(uint32_t return_code,
  1317. uint8_t * const p_buf,
  1318. uint32_t * const p_buf_len);
  1319. /**@brief Decodes @ref sd_ant_crypto_key_set command request.
  1320. *
  1321. * @sa @ref ant_crypto_key_set_rsp_enc for response encoding.
  1322. *
  1323. * @param[in] p_buf Pointer to beginning of command request packet.
  1324. * @param[in] packet_len Length (in bytes) of response packet.
  1325. *
  1326. * @param[out] p_key_num Pointer to an unsigned char (1 octet) where the key index for
  1327. * assignment will be set.
  1328. * @param[out] pp_key Pointer to pointer to buffer (16 octets) where the 128-bit
  1329. * AES key to be assigned to the key index will be set.
  1330. *
  1331. * @retval NRF_SUCCESS Decoding success.
  1332. * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
  1333. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  1334. */
  1335. uint32_t ant_crypto_key_set_req_dec(uint8_t const * const p_buf,
  1336. uint32_t packet_len,
  1337. uint8_t * const p_key_num,
  1338. uint8_t * * const pp_key);
  1339. /**@brief Encodes @ref sd_ant_crypto_key_set command response.
  1340. *
  1341. * @sa @ref ant_crypto_key_set_req_dec for request decoding.
  1342. *
  1343. * @param[in] return_code Return code indicating if command was successful or not.
  1344. * @param[out] p_buf Pointer to buffer where encoded data command response will be
  1345. * returned.
  1346. * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
  1347. * \c out: Length of encoded command response packet.
  1348. *
  1349. * @retval NRF_SUCCESS Encoding success.
  1350. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  1351. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  1352. */
  1353. uint32_t ant_crypto_key_set_rsp_enc(uint32_t return_code,
  1354. uint8_t * const p_buf,
  1355. uint32_t * const p_buf_len);
  1356. /**@brief Decodes @ref sd_ant_crypto_info_set command request.
  1357. *
  1358. * @sa @ref ant_crypto_info_set_rsp_enc for response encoding.
  1359. *
  1360. * @param[in] p_buf Pointer to beginning of command request packet.
  1361. * @param[in] packet_len Length (in bytes) of response packet.
  1362. *
  1363. * @param[out] p_type Pointer to an unsigned char (1 octet) where the type of
  1364. * information being set will be copied.
  1365. * @param[out] pp_info Pointer to pointer to buffer where information being set will be
  1366. * copied.
  1367. *
  1368. * @retval NRF_SUCCESS Decoding success.
  1369. * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
  1370. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  1371. */
  1372. uint32_t ant_crypto_info_set_req_dec(uint8_t const * const p_buf,
  1373. uint32_t packet_len,
  1374. uint8_t * const p_type,
  1375. uint8_t * * const pp_info);
  1376. /**@brief Encodes @ref sd_ant_crypto_info_set command response.
  1377. *
  1378. * @sa @ref ant_crypto_info_set_req_dec for request decoding.
  1379. *
  1380. * @param[in] return_code Return code indicating if command was successful or not.
  1381. * @param[out] p_buf Pointer to buffer where encoded data command response will be
  1382. * returned.
  1383. * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
  1384. * \c out: Length of encoded command response packet.
  1385. *
  1386. * @retval NRF_SUCCESS Encoding success.
  1387. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  1388. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  1389. */
  1390. uint32_t ant_crypto_info_set_rsp_enc(uint32_t return_code,
  1391. uint8_t * const p_buf,
  1392. uint32_t * const p_buf_len);
  1393. /**@brief Decodes @ref sd_ant_crypto_info_get command request.
  1394. *
  1395. * @sa @ref ant_crypto_info_get_rsp_enc for response encoding.
  1396. *
  1397. * @param[in] p_buf Pointer to beginning of command request packet.
  1398. * @param[in] packet_len Length (in bytes) of response packet.
  1399. *
  1400. * @param[out] p_type Pointer to an unsigned char (1 octet) where the type of
  1401. * information being set will be copied.
  1402. *
  1403. * @retval NRF_SUCCESS Decoding success.
  1404. * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
  1405. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  1406. */
  1407. uint32_t ant_crypto_info_get_req_dec(uint8_t const * const p_buf,
  1408. uint16_t packet_len,
  1409. uint8_t * const p_type);
  1410. /**@brief Encodes @ref sd_ant_crypto_info_get command response.
  1411. *
  1412. * @sa @ref ant_crypto_info_get_req_dec for request decoding.
  1413. *
  1414. * @param[in] return_code Return code indicating if command was successful or not.
  1415. * @param[out] p_buf Pointer to buffer where encoded data command response will be
  1416. * returned.
  1417. * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
  1418. * \c out: Length of encoded command response packet.
  1419. * @param[in] type The type of information being set.
  1420. * @param[in] p_info Pointer to info buffer.
  1421. *
  1422. * @retval NRF_SUCCESS Encoding success.
  1423. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  1424. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  1425. */
  1426. uint32_t ant_crypto_info_get_rsp_enc(uint32_t return_code,
  1427. uint8_t * const p_buf,
  1428. uint32_t * const p_buf_len,
  1429. uint8_t type,
  1430. uint8_t const * const p_info);
  1431. /**@brief Decodes @ref sd_ant_coex_config_set command request.
  1432. *
  1433. * @sa @ref ant_coex_config_set_rsp_enc for response encoding.
  1434. *
  1435. * @param[in] p_buf Pointer to beginning of command request packet.
  1436. * @param[in] packet_len Length (in bytes) of response packet.
  1437. *
  1438. * @param[in] p_channel Pointer to an unsigned char (1 octet) where the channel for
  1439. * which the coexistence configuration is to be set will be copied.
  1440. * @param[in] p_coex_config Pointer to a buffer where the coexistence configuration to be set will
  1441. * be copied.
  1442. * @param[in] p_adv_coex_config Pointer to a buffer where the advanced coexistence configuration to be set will
  1443. * be copied.
  1444. *
  1445. * @retval NRF_SUCCESS Decoding success.
  1446. * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
  1447. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  1448. */
  1449. uint32_t ant_coex_config_set_req_dec(uint8_t const * const p_buf,
  1450. uint32_t packet_len,
  1451. uint8_t * const p_channel,
  1452. ANT_BUFFER_PTR * const p_coex_config,
  1453. ANT_BUFFER_PTR * const p_adv_coex_config);
  1454. /**@brief Encodes @ref sd_ant_coex_config_set command response.
  1455. *
  1456. * @sa @ref ant_coex_config_set_req_dec for request decoding.
  1457. *
  1458. * @param[in] return_code Return code indicating if command was successful or not.
  1459. * @param[out] p_buf Pointer to buffer where encoded data command response will be
  1460. * returned.
  1461. * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
  1462. * \c out: Length of encoded command response packet.
  1463. *
  1464. * @retval NRF_SUCCESS Encoding success.
  1465. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  1466. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  1467. */
  1468. uint32_t ant_coex_config_set_rsp_enc(uint32_t return_code,
  1469. uint8_t * const p_buf,
  1470. uint32_t * const p_buf_len);
  1471. /**@brief Decodes @ref sd_ant_coex_config_get command request.
  1472. *
  1473. * @sa @ref ant_channel_id_get_rsp_enc for response encoding.
  1474. *
  1475. * @param[in] p_buf Pointer to beginning of command request packet.
  1476. * @param[in] packet_len Length (in bytes) of response packet.
  1477. *
  1478. * @param[out] p_channel Pointer to an unsigned char (1 octet) where the channel
  1479. * number will be set.
  1480. *
  1481. * @retval NRF_SUCCESS Decoding success.
  1482. * @retval NRF_ERROR_NULL Decoding failure. NULL pointer supplied.
  1483. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  1484. */
  1485. uint32_t ant_coex_config_get_req_dec(uint8_t const * const p_buf,
  1486. uint16_t packet_len,
  1487. uint8_t * const p_channel);
  1488. /**@brief Encodes @ref sd_ant_coex_config_get command response.
  1489. *
  1490. * @sa @ref ant_channel_id_get_req_dec for request decoding.
  1491. *
  1492. * @param[in] return_code Return code indicating if command was successful or not.
  1493. * @param[out] p_buf Pointer to buffer where encoded data command response will be
  1494. * returned.
  1495. * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
  1496. * \c out: Length of encoded command response packet.
  1497. * @param[in] p_coex_config Pointer to the coexistence configuration.
  1498. * @param[in] p_adv_coex_config Pointer to the advanced coexistence configuration.
  1499. *
  1500. * @retval NRF_SUCCESS Encoding success.
  1501. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  1502. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  1503. */
  1504. uint32_t ant_coex_config_get_rsp_enc(uint32_t return_code,
  1505. uint8_t * const p_buf,
  1506. uint32_t * const p_buf_len,
  1507. ANT_BUFFER_PTR * const p_coex_config,
  1508. ANT_BUFFER_PTR * const p_adv_coex_config);
  1509. /** @} */
  1510. #endif