ant_app.h 87 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652
  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_APP_H__
  41. #define ANT_APP_H__
  42. /**
  43. * @addtogroup ser_app_s212_codecs Application codecs for S212
  44. * @ingroup ser_codecs_app
  45. */
  46. /**@file
  47. *
  48. * @defgroup ant_app Application command request encoders and command response decoders
  49. * @{
  50. * @ingroup ser_app_s212_codecs
  51. *
  52. * @brief Application command request encoders and command response decoders.
  53. */
  54. //#include "ble.h"
  55. #include "ant_interface.h"
  56. /**@brief Encodes @ref sd_ant_enable command request.
  57. *
  58. * @sa @ref ant_enable_rsp_dec for command response decoder.
  59. *
  60. * @param[in] p_ant_enable_params Pointer to an @ref ANT_ENABLE structure.
  61. * @param[in] p_buf Pointer to buffer where encoded data command will be
  62. * returned.
  63. * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
  64. * \c out: Length of encoded command packet.
  65. *
  66. * @retval NRF_SUCCESS Encoding success.
  67. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  68. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  69. */
  70. uint32_t ant_enable_req_enc(ANT_ENABLE * p_ant_enable_params,
  71. uint8_t * const p_buf,
  72. uint32_t * const p_buf_len);
  73. /**@brief Decodes response to @ref sd_ant_enable command.
  74. *
  75. * @sa @ref ant_enable_req_enc for command request encoder.
  76. *
  77. * @param[in] p_buf Pointer to beginning of command response packet.
  78. * @param[in] packet_len Length (in bytes) of response packet.
  79. * @param[out] p_result_code Command result code.
  80. *
  81. * @retval NRF_SUCCESS Success.
  82. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  83. * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to
  84. * hold decoded event.
  85. */
  86. uint32_t ant_enable_rsp_dec(uint8_t const * const p_buf,
  87. uint32_t packet_len,
  88. uint32_t * const p_result_code);
  89. /**@brief Encodes @ref sd_ant_channel_assign command request.
  90. *
  91. * @sa @ref ant_channel_assign_rsp_dec for command response decoder.
  92. *
  93. * @param[in] channel Channel is an unsigned char (1 octet) denoting the channel
  94. * to assign.
  95. * @param[in] channel_type Channel Type is an unsigned char (1 octet) denoting the
  96. * channel type. See Assign Channel Parameters/Assign Channel
  97. * Types in ant_parameters.h.
  98. * @param[in] network Network is an unsigned char (1 octet) denoting the network
  99. * key to associate with the channel.
  100. * @param[in] ext_assign Ext Assign is a bit field (1 octet) for an extended
  101. * assign. See Ext. Assign Channel Parameters in
  102. * ant_parameters.h.
  103. * @param[in] p_buf Pointer to buffer where encoded data command will be
  104. * returned.
  105. * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
  106. * \c out: Length of encoded command packet.
  107. *
  108. * @retval NRF_SUCCESS Encoding success.
  109. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  110. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  111. */
  112. uint32_t ant_channel_assign_req_enc(uint8_t channel,
  113. uint8_t channel_type,
  114. uint8_t network,
  115. uint8_t ext_assign,
  116. uint8_t * const p_buf,
  117. uint32_t * const p_buf_len);
  118. /**@brief Decodes response to @ref sd_ant_channel_assign command.
  119. *
  120. * @sa @ref ant_channel_assign_req_enc for command request encoder.
  121. *
  122. * @param[in] p_buf Pointer to beginning of command response packet.
  123. * @param[in] packet_len Length (in bytes) of response packet.
  124. * @param[out] p_result_code Command result code.
  125. *
  126. * @retval NRF_SUCCESS Success.
  127. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  128. * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to
  129. * hold decoded event.
  130. */
  131. uint32_t ant_channel_assign_rsp_dec(uint8_t const * const p_buf,
  132. uint32_t packet_len,
  133. uint32_t * const p_result_code);
  134. /**@brief Encodes @ref sd_ant_channel_open command request.
  135. *
  136. * @sa @ref ant_channel_open_with_offset_rsp_dec for command response decoder.
  137. *
  138. * @param[in] channel Channel is an unsigned char (1 octet) denoting the channel to
  139. * open.
  140. * @param[in] usOffset Denote the offset from which to start the channel.
  141. *
  142. * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
  143. * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
  144. * \c out: Length of encoded command packet.
  145. *
  146. * @retval NRF_SUCCESS Encoding success.
  147. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  148. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  149. */
  150. uint32_t ant_channel_open_with_offset_req_enc(uint8_t channel,
  151. uint16_t usOffset,
  152. uint8_t * const p_buf,
  153. uint32_t * const p_buf_len);
  154. /**@brief Decodes response to @ref sd_ant_channel_open command.
  155. *
  156. * @sa @ref ant_channel_open_with_offset_req_enc for command request encoder.
  157. *
  158. * @param[in] p_buf Pointer to beginning of command response packet.
  159. * @param[in] packet_len Length (in bytes) of response packet.
  160. * @param[out] p_result_code Command result code.
  161. *
  162. * @retval NRF_SUCCESS Success.
  163. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  164. * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to
  165. * hold decoded event.
  166. */
  167. uint32_t ant_channel_open_with_offset_rsp_dec(uint8_t const * const p_buf,
  168. uint32_t packet_len,
  169. uint32_t * const p_result_code);
  170. /**@brief Encodes @ref sd_ant_channel_id_set command request.
  171. *
  172. * @sa @ref ant_channel_id_set_rsp_dec for command response decoder.
  173. *
  174. * @param[in] channel Channel is an unsigned char (1 octet) denoting the channel
  175. * number to set.
  176. * @param[in] device_number Device Number is an unsigned short (2 octets) denoting the
  177. * device number.
  178. * @param[in] device_type Device Type is an unsigned char (1 octet) denoting the device
  179. * type.
  180. * @param[in] transmit_type Transmit Type is an unsigned char (1 octet) denoting the
  181. * transmission type.
  182. * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
  183. * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
  184. * \c out: Length of encoded command packet.
  185. *
  186. * @retval NRF_SUCCESS Encoding success.
  187. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  188. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  189. */
  190. uint32_t ant_channel_id_set_req_enc(uint8_t channel,
  191. uint16_t device_number,
  192. uint8_t device_type,
  193. uint8_t transmit_type,
  194. uint8_t * const p_buf,
  195. uint32_t * const p_buf_len);
  196. /**@brief Decodes response to @ref sd_ant_channel_id_set command.
  197. *
  198. * @sa @ref ant_channel_id_set_req_enc for command request encoder.
  199. *
  200. * @param[in] p_buf Pointer to beginning of command response packet.
  201. * @param[in] packet_len Length (in bytes) of response packet.
  202. * @param[out] p_result_code Command result code.
  203. *
  204. * @retval NRF_SUCCESS Success.
  205. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  206. * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to
  207. * hold decoded event.
  208. */
  209. uint32_t ant_channel_id_set_rsp_dec(uint8_t const * const p_buf,
  210. uint32_t packet_len,
  211. uint32_t * const p_result_code);
  212. /**@brief Encodes @ref sd_ant_channel_period_set command request.
  213. *
  214. * @sa @ref ant_channel_period_set_rsp_dec for command response decoder.
  215. *
  216. * @param[in] channel Channel is an unsigned char (1 octet) denoting the channel
  217. * number to set the period to.
  218. * @param[in] period Period is an unsigned short (2 octets) denoting the period in
  219. * 32 kHz counts (usPeriod/32768 s).
  220. * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
  221. * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
  222. * \c out: Length of encoded command packet.
  223. *
  224. * @retval NRF_SUCCESS Encoding success.
  225. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  226. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  227. */
  228. uint32_t ant_channel_period_set_req_enc(uint8_t channel,
  229. uint16_t period,
  230. uint8_t * const p_buf,
  231. uint32_t * const p_buf_len);
  232. /**@brief Decodes response to @ref sd_ant_channel_period_set command.
  233. *
  234. * @sa @ref ant_channel_period_set_req_enc for command request encoder.
  235. *
  236. * @param[in] p_buf Pointer to beginning of command response packet.
  237. * @param[in] packet_len Length (in bytes) of response packet.
  238. * @param[out] p_result_code Command result code.
  239. *
  240. * @retval NRF_SUCCESS Success.
  241. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  242. * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to
  243. * hold decoded event.
  244. */
  245. uint32_t ant_channel_period_set_rsp_dec(uint8_t const * const p_buf,
  246. uint32_t packet_len,
  247. uint32_t * const p_result_code);
  248. /**@brief Encodes @ref sd_ant_channel_radio_freq_set command request.
  249. *
  250. * @sa @ref ant_channel_radio_freq_set_rsp_dec for command response decoder.
  251. *
  252. * @param[in] channel Channel is an unsigned char (1 octet) denoting the channel
  253. * number to set to.
  254. * @param[in] freq Freq is an unsigned char (1 octet) denoting the radio
  255. * frequency offset from 2400 MHz (eg. 2466 MHz, ucFreq = 66).
  256. * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
  257. * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
  258. * \c out: Length of encoded command packet.
  259. *
  260. * @retval NRF_SUCCESS Encoding success.
  261. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  262. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  263. */
  264. uint32_t ant_channel_radio_freq_set_req_enc(uint8_t channel,
  265. uint8_t freq,
  266. uint8_t * const p_buf,
  267. uint32_t * const p_buf_len);
  268. /**@brief Decodes response to @ref sd_ant_channel_radio_freq_set command.
  269. *
  270. * @sa @ref ant_channel_radio_freq_set_req_enc for command request encoder.
  271. *
  272. * @param[in] p_buf Pointer to beginning of command response packet.
  273. * @param[in] packet_len Length (in bytes) of response packet.
  274. * @param[out] p_result_code Command result code.
  275. *
  276. * @retval NRF_SUCCESS Success.
  277. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  278. * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to
  279. * hold decoded event.
  280. */
  281. uint32_t ant_channel_radio_freq_set_rsp_dec(uint8_t const * const p_buf,
  282. uint32_t packet_len,
  283. uint32_t * const p_result_code);
  284. /**@brief Encodes @ref sd_ant_broadcast_message_tx command request.
  285. *
  286. * @sa @ref ant_broadcast_message_tx_rsp_dec for command response decoder.
  287. *
  288. * @param[in] channel Channel is an unsigned char (1 octet) denoting the channel to
  289. * send the data on.
  290. * @param[in] size Size is an unsigned char (1 octet) denoting the size of the
  291. * message, ucSize must be 8.
  292. * @param[in] p_mesg Mesg is the buffer where the message is located (array must be
  293. * 8 octets).
  294. * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
  295. * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
  296. * \c out: Length of encoded command packet.
  297. *
  298. * @retval NRF_SUCCESS Encoding success.
  299. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  300. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  301. */
  302. uint32_t ant_broadcast_message_tx_req_enc(uint8_t channel,
  303. uint8_t size,
  304. uint8_t const * const p_mesg,
  305. uint8_t * const p_buf,
  306. uint32_t * const p_buf_len);
  307. /**@brief Decodes response to @ref sd_ant_broadcast_message_tx command.
  308. *
  309. * @sa @ref ant_broadcast_message_tx_req_enc for command request encoder.
  310. *
  311. * @param[in] p_buf Pointer to beginning of command response packet.
  312. * @param[in] packet_len Length (in bytes) of response packet.
  313. * @param[out] p_result_code Command result code.
  314. *
  315. * @retval NRF_SUCCESS Success.
  316. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  317. * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to
  318. * hold decoded event.
  319. */
  320. uint32_t ant_broadcast_message_tx_rsp_dec(uint8_t const * const p_buf,
  321. uint32_t packet_len,
  322. uint32_t * const p_result_code);
  323. /**@brief Encodes @ref sd_ant_acknowledge_message_tx command request.
  324. *
  325. * @sa @ref ant_acknowledge_message_tx_rsp_dec for command response decoder.
  326. *
  327. * @param[in] channel Channel is an unsigned char (1 octet) denoting the channel to
  328. * send the data on.
  329. * @param[in] size Size is an unsigned char (1 octet) denoting the size of the
  330. * message, ucSize must be 8.
  331. * @param[in] p_mesg Mesg is the buffer where the message is located (array must be
  332. * 8 octets).
  333. * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
  334. * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
  335. * \c out: Length of encoded command packet.
  336. *
  337. * @retval NRF_SUCCESS Encoding success.
  338. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  339. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  340. */
  341. uint32_t ant_acknowledge_message_tx_req_enc(uint8_t channel,
  342. uint8_t size,
  343. uint8_t const * const p_mesg,
  344. uint8_t * const p_buf,
  345. uint32_t * const p_buf_len);
  346. /**@brief Decodes response to @ref sd_ant_acknowledge_message_tx command.
  347. *
  348. * @sa @ref ant_acknowledge_message_tx_req_enc for command request encoder.
  349. *
  350. * @param[in] p_buf Pointer to beginning of command response packet.
  351. * @param[in] packet_len Length (in bytes) of response packet.
  352. * @param[out] p_result_code Command result code.
  353. *
  354. * @retval NRF_SUCCESS Success.
  355. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  356. * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to
  357. * hold decoded event.
  358. */
  359. uint32_t ant_acknowledge_message_tx_rsp_dec(uint8_t const * const p_buf,
  360. uint32_t packet_len,
  361. uint32_t * const p_result_code);
  362. /**@brief Encodes @ref sd_ant_channel_unassign command request.
  363. *
  364. * @sa @ref ant_channel_unassign_rsp_dec for command response decoder.
  365. *
  366. * @param[in] channel Channel is an unsigned char (1 octet) denoting the channel
  367. * to unassign.
  368. * @param[in] p_buf Pointer to buffer where encoded data command will be
  369. * returned.
  370. * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
  371. * \c out: Length of encoded command packet.
  372. *
  373. * @retval NRF_SUCCESS Encoding success.
  374. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  375. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  376. */
  377. uint32_t ant_channel_unassign_req_enc(uint8_t channel,
  378. uint8_t * const p_buf,
  379. uint32_t * const p_buf_len);
  380. /**@brief Decodes response to @ref sd_ant_channel_unassign command.
  381. *
  382. * @sa @ref ant_channel_unassign_req_enc for command request encoder.
  383. *
  384. * @param[in] p_buf Pointer to beginning of command response packet.
  385. * @param[in] packet_len Length (in bytes) of response packet.
  386. * @param[out] p_result_code Command result code.
  387. *
  388. * @retval NRF_SUCCESS Success.
  389. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  390. * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to
  391. * hold decoded event.
  392. */
  393. uint32_t ant_channel_unassign_rsp_dec(uint8_t const * const p_buf,
  394. uint32_t packet_len,
  395. uint32_t * const p_result_code);
  396. /**@brief Encodes @ref sd_ant_channel_close command request.
  397. *
  398. * @sa @ref ant_channel_close_rsp_dec for command response decoder.
  399. *
  400. * @param[in] channel Channel is an unsigned char (1 octet) denoting the channel
  401. * to close.
  402. * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
  403. * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
  404. * \c out: Length of encoded command packet.
  405. *
  406. * @retval NRF_SUCCESS Encoding success.
  407. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  408. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  409. */
  410. uint32_t ant_channel_close_req_enc(uint8_t channel,
  411. uint8_t * const p_buf,
  412. uint32_t * const p_buf_len);
  413. /**@brief Decodes response to @ref sd_ant_channel_close command.
  414. *
  415. * @sa @ref ant_channel_close_req_enc for command request encoder.
  416. *
  417. * @param[in] p_buf Pointer to beginning of command response packet.
  418. * @param[in] packet_len Length (in bytes) of response packet.
  419. * @param[out] p_result_code Command result code.
  420. *
  421. * @retval NRF_SUCCESS Success.
  422. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  423. * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to
  424. * hold decoded event.
  425. */
  426. uint32_t ant_channel_close_rsp_dec(uint8_t const * const p_buf,
  427. uint32_t packet_len,
  428. uint32_t * const p_result_code);
  429. /**@brief Encodes @ref sd_ant_network_address_set command request.
  430. *
  431. * @sa @ref ant_network_address_set_rsp_dec for command response decoder.
  432. *
  433. * @param[in] network Network is an unsigned char (1 octet) denoting the network
  434. * number to assign the network address to.
  435. * @param[in] p_network_key Network key is the pointer to location of the Network Key (8
  436. * octets in length).
  437. * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
  438. * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
  439. * \c out: Length of encoded command packet.
  440. *
  441. * @retval NRF_SUCCESS Encoding success.
  442. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  443. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  444. */
  445. uint32_t ant_network_address_set_req_enc(uint8_t network,
  446. uint8_t const * const p_network_key,
  447. uint8_t * const p_buf,
  448. uint32_t * const p_buf_len);
  449. /**@brief Decodes response to @ref sd_ant_network_address_set command.
  450. *
  451. * @sa @ref ant_network_address_set_req_enc for command request encoder.
  452. *
  453. * @param[in] p_buf Pointer to beginning of command response packet.
  454. * @param[in] packet_len Length (in bytes) of response packet.
  455. * @param[out] p_result_code Command result code.
  456. *
  457. * @retval NRF_SUCCESS Success.
  458. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  459. * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to
  460. * hold decoded event.
  461. */
  462. uint32_t ant_network_address_set_rsp_dec(uint8_t const * const p_buf,
  463. uint32_t packet_len,
  464. uint32_t * const p_result_code);
  465. /**@brief Encodes @ref sd_ant_channel_radio_tx_power_set command request.
  466. *
  467. * @sa @ref ant_channel_radio_tx_power_set_rsp_dec for command response decoder.
  468. *
  469. * @param[in] channel Channel is an unsigned char (1 octet) denoting the channel
  470. * number to assign the radio TX power.
  471. * @param[in] tx_power TX Power is an unsigned char (1 octet) denoting the ANT
  472. * transmit power index. See Radio TX Power Definitions in
  473. * ant_parameters.h.
  474. * @param[in] custom_tx_power Custom TX Power is an unsigned char (1 octet) denoting the
  475. * custom nRF transmit power as defined in nrf51_bitfields.h.
  476. * Only applicable if tx_power is set to custom TX power
  477. * selection.
  478. * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
  479. * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
  480. * \c out: Length of encoded command packet.
  481. *
  482. * @retval NRF_SUCCESS Encoding success.
  483. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  484. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  485. */
  486. uint32_t ant_channel_radio_tx_power_set_req_enc(uint8_t channel,
  487. uint8_t tx_power,
  488. uint8_t custom_tx_power,
  489. uint8_t * const p_buf,
  490. uint32_t * const p_buf_len);
  491. /**@brief Decodes response to @ref sd_ant_channel_radio_tx_power_set command.
  492. *
  493. * @sa @ref ant_channel_radio_tx_power_set_req_enc for command request encoder.
  494. *
  495. * @param[in] p_buf Pointer to beginning of command response packet.
  496. * @param[in] packet_len Length (in bytes) of response packet.
  497. * @param[out] p_result_code Command result code.
  498. *
  499. * @retval NRF_SUCCESS Success.
  500. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  501. * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to
  502. * hold decoded event.
  503. */
  504. uint32_t ant_channel_radio_tx_power_set_rsp_dec(uint8_t const * const p_buf,
  505. uint32_t packet_len,
  506. uint32_t * const p_result_code);
  507. /**@brief Encodes @ref sd_ant_channel_rx_search_timeout_set command request.
  508. *
  509. * @sa @ref ant_channel_rx_search_timeout_set_rsp_dec for command response decoder.
  510. *
  511. * @param[in] channel Channel is an unsigned char (1 octet) denoting the channel
  512. * number to set.
  513. * @param[in] timeout Timeout is an unsigned char (1 octet) denoting the time-out
  514. * value.
  515. * When applied to an assigned slave channel, ucTimeout is in 2.5
  516. * second increments. Default = 10 (25 s) at channel assignment.
  517. * When applied to an assigned master channel, ucTimeout is in
  518. * 250 ms increments. Default = 0 (disabled) at channel assignment
  519. * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
  520. * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
  521. * \c out: Length of encoded command packet.
  522. *
  523. * @retval NRF_SUCCESS Encoding success.
  524. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  525. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  526. */
  527. uint32_t ant_channel_rx_search_timeout_set_req_enc(uint8_t channel,
  528. uint8_t timeout,
  529. uint8_t * const p_buf,
  530. uint32_t * const p_buf_len);
  531. /**@brief Decodes response to @ref sd_ant_channel_rx_search_timeout_set command.
  532. *
  533. * @sa @ref ant_channel_rx_search_timeout_set_req_enc for command request encoder.
  534. *
  535. * @param[in] p_buf Pointer to beginning of command response packet.
  536. * @param[in] packet_len Length (in bytes) of response packet.
  537. * @param[out] p_result_code Command result code.
  538. *
  539. * @retval NRF_SUCCESS Success.
  540. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  541. * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to
  542. * hold decoded event.
  543. */
  544. uint32_t ant_channel_rx_search_timeout_set_rsp_dec(uint8_t const * const p_buf,
  545. uint32_t packet_len,
  546. uint32_t * const p_result_code);
  547. /**@brief Encodes @ref sd_ant_channel_low_priority_rx_search_timeout_set command request.
  548. *
  549. * @sa @ref ant_channel_low_priority_rx_search_timeout_set_rsp_dec for command response decoder.
  550. *
  551. * @param[in] channel Channel is an unsigned char (1 octet) denoting the channel
  552. * number to set.
  553. * @param[in] timeout Timeout is an unsigned char (1 octet) denoting the time-out
  554. * value in 2.5 seconds increments. Default = 2 (5s).
  555. * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
  556. * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
  557. * \c out: Length of encoded command packet.
  558. *
  559. * @retval NRF_SUCCESS Encoding success.
  560. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  561. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  562. */
  563. uint32_t ant_channel_low_priority_rx_search_timeout_set_req_enc(uint8_t channel,
  564. uint8_t timeout,
  565. uint8_t * const p_buf,
  566. uint32_t * const p_buf_len);
  567. /**@brief Decodes response to @ref sd_ant_channel_low_priority_rx_search_timeout_set command.
  568. *
  569. * @sa @ref ant_channel_low_priority_rx_search_timeout_set_req_enc for command request encoder.
  570. *
  571. * @param[in] p_buf Pointer to beginning of command response packet.
  572. * @param[in] packet_len Length (in bytes) of response packet.
  573. * @param[out] p_result_code Command result code.
  574. *
  575. * @retval NRF_SUCCESS Success.
  576. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  577. * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to
  578. * hold decoded event.
  579. */
  580. uint32_t ant_channel_low_priority_rx_search_timeout_set_rsp_dec(uint8_t const * const p_buf,
  581. uint32_t packet_len,
  582. uint32_t * const p_result_code);
  583. /**@brief Encodes @ref sd_ant_prox_search_set command request.
  584. *
  585. * @sa @ref ant_prox_search_set_rsp_dec for command response decoder.
  586. *
  587. * @param[in] channel Channel is an unsigned char (1 octet) denoting the channel
  588. * number.
  589. * @param[in] prox_threshold Prox threshold is an unsigned char (1 octet) denoting the
  590. * minimum RSSI threshold required for acquisition during a
  591. * search. See Radio Proximity Search Threshold in
  592. * ant_parameters.h.
  593. * @param[in] custom_prox_threshold Custom prox threshold is an unsigned char (1 octet) denoting
  594. * the custom minimum RSSI threshold for acquisition during a
  595. * search. Only applicable if ucProxThreshold is set to custom
  596. * proximity selection.
  597. * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
  598. * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
  599. * \c out: Length of encoded command packet.
  600. *
  601. * @retval NRF_SUCCESS Encoding success.
  602. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  603. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  604. */
  605. uint32_t ant_prox_search_set_req_enc(uint8_t channel,
  606. uint8_t prox_threshold,
  607. uint8_t custom_prox_threshold,
  608. uint8_t * const p_buf,
  609. uint32_t * const p_buf_len);
  610. /**@brief Decodes response to @ref sd_ant_prox_search_set command.
  611. *
  612. * @sa @ref ant_prox_search_set_req_enc for command request encoder.
  613. *
  614. * @param[in] p_buf Pointer to beginning of command response packet.
  615. * @param[in] packet_len Length (in bytes) of response packet.
  616. * @param[out] p_result_code Command result code.
  617. *
  618. * @retval NRF_SUCCESS Success.
  619. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  620. * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to
  621. * hold decoded event.
  622. */
  623. uint32_t ant_prox_search_set_rsp_dec(uint8_t const * const p_buf,
  624. uint32_t packet_len,
  625. uint32_t * const p_result_code);
  626. /**@brief Encodes @ref sd_ant_search_waveform_set command request.
  627. *
  628. * @sa @ref ant_search_waveform_set_rsp_dec for command response decoder.
  629. *
  630. * @param[in] channel Channel is an unsigned char (1 octet) denoting the channel
  631. * number.
  632. * @param[in] waveform Waveform is an unsigned short (2 octets) denoting the channel
  633. * waveform period (usWaveform/32768 s). Default = 316.
  634. * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
  635. * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
  636. * \c out: Length of encoded command packet.
  637. *
  638. * @retval NRF_SUCCESS Encoding success.
  639. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  640. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  641. */
  642. uint32_t ant_search_waveform_set_req_enc(uint8_t channel,
  643. uint16_t waveform,
  644. uint8_t * const p_buf,
  645. uint32_t * const p_buf_len);
  646. /**@brief Decodes response to @ref sd_ant_search_waveform_set command.
  647. *
  648. * @sa @ref ant_search_waveform_set_req_enc for command request encoder.
  649. *
  650. * @param[in] p_buf Pointer to beginning of command response packet.
  651. * @param[in] packet_len Length (in bytes) of response packet.
  652. * @param[out] p_result_code Command result code.
  653. *
  654. * @retval NRF_SUCCESS Success.
  655. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  656. * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to
  657. * hold decoded event.
  658. */
  659. uint32_t ant_search_waveform_set_rsp_dec(uint8_t const * const p_buf,
  660. uint32_t packet_len,
  661. uint32_t * const p_result_code);
  662. /**@brief Encodes @ref sd_ant_channel_id_get command request.
  663. *
  664. * @sa @ref ant_channel_id_get_rsp_dec for command response decoder.
  665. *
  666. * @param[in] channel Channel is an unsigned char (1 octet) denoting the channel
  667. * number.
  668. * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
  669. * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
  670. * \c out: Length of encoded command packet.
  671. *
  672. * @retval NRF_SUCCESS Encoding success.
  673. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  674. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  675. */
  676. uint32_t ant_channel_id_get_req_enc(uint8_t channel,
  677. uint8_t * const p_buf,
  678. uint32_t * const p_buf_len);
  679. /**@brief Decodes response to @ref sd_ant_channel_id_get command.
  680. *
  681. * @sa @ref ant_channel_id_get_req_enc for command request encoder.
  682. *
  683. * @param[in] p_buf Pointer to beginning of command response packet.
  684. * @param[in] packet_len Length (in bytes) of response packet.
  685. * @param[in] p_device_number Pointer to device number.
  686. * @param[in] p_device_type Pointer to device type.
  687. * @param[in] p_transmit_type Pointer to transmit type.
  688. * @param[out] p_result_code Command result code.
  689. *
  690. * @retval NRF_SUCCESS Success.
  691. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  692. * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to
  693. * hold decoded event.
  694. */
  695. uint32_t ant_channel_id_get_rsp_dec(uint8_t const * const p_buf,
  696. uint32_t packet_len,
  697. void * const p_device_number,
  698. void * const p_device_type,
  699. void * const p_transmit_type,
  700. uint32_t * const p_result_code);
  701. /**@brief Encodes @ref sd_ant_channel_radio_freq_get command request.
  702. *
  703. * @sa @ref ant_channel_radio_freq_get_rsp_dec for command response decoder.
  704. *
  705. * @param[in] channel Channel is an unsigned char (1 octet) denoting the channel
  706. * number.
  707. * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
  708. * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
  709. * \c out: Length of encoded command packet.
  710. *
  711. * @retval NRF_SUCCESS Encoding success.
  712. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  713. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  714. */
  715. uint32_t ant_channel_radio_freq_get_req_enc(uint8_t channel,
  716. uint8_t * const p_buf,
  717. uint32_t * const p_buf_len);
  718. /**@brief Decodes response to @ref sd_ant_channel_radio_freq_get command.
  719. *
  720. * @sa @ref ant_channel_radio_freq_get_req_enc for command request encoder.
  721. *
  722. * @param[in] p_buf Pointer to beginning of command response packet.
  723. * @param[in] packet_len Length (in bytes) of response packet.
  724. * @param[in] p_r_freq Pointer to radio frequency.
  725. * @param[out] p_result_code Command result code.
  726. *
  727. * @retval NRF_SUCCESS Success.
  728. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  729. * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to
  730. * hold decoded event.
  731. */
  732. uint32_t ant_channel_radio_freq_get_rsp_dec(uint8_t const * const p_buf,
  733. uint32_t packet_len,
  734. void * const p_r_freq,
  735. uint32_t * const p_result_code);
  736. /**@brief Encodes @ref sd_ant_channel_period_get command request.
  737. *
  738. * @sa @ref ant_channel_period_get_rsp_dec for command response decoder.
  739. *
  740. * @param[in] channel Channel is an unsigned char (1 octet) denoting the channel
  741. * number.
  742. * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
  743. * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
  744. * \c out: Length of encoded command packet.
  745. *
  746. * @retval NRF_SUCCESS Encoding success.
  747. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  748. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  749. */
  750. uint32_t ant_channel_period_get_req_enc(uint8_t channel,
  751. uint8_t * const p_buf,
  752. uint32_t * const p_buf_len);
  753. /**@brief Decodes response to @ref sd_ant_channel_period_get command.
  754. *
  755. * @sa @ref ant_channel_period_get_req_enc for command request encoder.
  756. *
  757. * @param[in] p_buf Pointer to beginning of command response packet.
  758. * @param[in] packet_len Length (in bytes) of response packet.
  759. * @param[in] p_period Pointer to period
  760. * @param[out] p_result_code Command result code.
  761. *
  762. * @retval NRF_SUCCESS Success.
  763. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  764. * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to
  765. * hold decoded event.
  766. */
  767. uint32_t ant_channel_period_get_rsp_dec(uint8_t const * const p_buf,
  768. uint32_t packet_len,
  769. void * p_period,
  770. uint32_t * const p_result_code);
  771. /**@brief Encodes @ref sd_ant_search_channel_priority_set command request.
  772. *
  773. * @sa @ref ant_search_channel_priority_set_rsp_dec for command response decoder.
  774. *
  775. * @param[in] channel Channel is an unsigned char (1 octet) denoting the channel
  776. * number.
  777. * @param[in] search_priority Search Priority is an unsigned char (1 octet) denoting the
  778. * search priority value. 0 to 7 (Default = 0).
  779. * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
  780. * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
  781. * \c out: Length of encoded command packet.
  782. *
  783. * @retval NRF_SUCCESS Encoding success.
  784. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  785. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  786. */
  787. uint32_t ant_search_channel_priority_set_req_enc(uint8_t channel,
  788. uint8_t search_priority,
  789. uint8_t * const p_buf,
  790. uint32_t * const p_buf_len);
  791. /**@brief Decodes response to @ref sd_ant_search_channel_priority_set command.
  792. *
  793. * @sa @ref ant_search_channel_priority_set_req_enc for command request encoder.
  794. *
  795. * @param[in] p_buf Pointer to beginning of command response packet.
  796. * @param[in] packet_len Length (in bytes) of response packet.
  797. * @param[out] p_result_code Command result code.
  798. *
  799. * @retval NRF_SUCCESS Success.
  800. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  801. * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to
  802. * hold decoded event.
  803. */
  804. uint32_t ant_search_channel_priority_set_rsp_dec(uint8_t const * const p_buf,
  805. uint32_t packet_len,
  806. uint32_t * const p_result_code);
  807. /**@brief Encodes @ref sd_ant_active_search_sharing_cycles_set command request.
  808. *
  809. * @sa @ref ant_active_search_sharing_cycles_set_rsp_dec for command response decoder.
  810. *
  811. * @param[in] channel Channel is an unsigned char (1 octet) denoting the channel
  812. * number.
  813. * @param[in] cycles Cycles is an unsigned char (1 octet) denoting the number of
  814. * cycles to set.
  815. * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
  816. * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
  817. * \c out: Length of encoded command packet.
  818. *
  819. * @retval NRF_SUCCESS Encoding success.
  820. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  821. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  822. */
  823. uint32_t ant_active_search_sharing_cycles_set_req_enc(uint8_t channel,
  824. uint8_t cycles,
  825. uint8_t * const p_buf,
  826. uint32_t * const p_buf_len);
  827. /**@brief Decodes response to @ref sd_ant_active_search_sharing_cycles_set command.
  828. *
  829. * @sa @ref ant_active_search_sharing_cycles_set_req_enc for command request encoder.
  830. *
  831. * @param[in] p_buf Pointer to beginning of command response packet.
  832. * @param[in] packet_len Length (in bytes) of response packet.
  833. * @param[out] p_result_code Command result code.
  834. *
  835. * @retval NRF_SUCCESS Success.
  836. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  837. * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to
  838. * hold decoded event.
  839. */
  840. uint32_t ant_active_search_sharing_cycles_set_rsp_dec(uint8_t const * const p_buf,
  841. uint32_t packet_len,
  842. uint32_t * const p_result_code);
  843. /**@brief Encodes @ref sd_ant_lib_config_set command request.
  844. *
  845. * @sa @ref ant_lib_config_set_rsp_dec for command response decoder.
  846. *
  847. * @param[in] ant_lib_config ANT Lib Config an unsigned char (1 octet) denoting the ANT lib
  848. * config bit flags. See ANT Library Config in ant_parameters.h.
  849. * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
  850. * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
  851. * \c out: Length of encoded command packet.
  852. *
  853. * @retval NRF_SUCCESS Encoding success.
  854. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  855. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  856. */
  857. uint32_t ant_lib_config_set_req_enc(uint8_t ant_lib_config,
  858. uint8_t * const p_buf,
  859. uint32_t * const p_buf_len);
  860. /**@brief Decodes response to @ref sd_ant_lib_config_set command.
  861. *
  862. * @sa @ref ant_lib_config_set_req_enc for command request encoder.
  863. *
  864. * @param[in] p_buf Pointer to beginning of command response packet.
  865. * @param[in] packet_len Length (in bytes) of response packet.
  866. * @param[out] p_result_code Command result code.
  867. *
  868. * @retval NRF_SUCCESS Success.
  869. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  870. * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to
  871. * hold decoded event.
  872. */
  873. uint32_t ant_lib_config_set_rsp_dec(uint8_t const * const p_buf,
  874. uint32_t packet_len,
  875. uint32_t * const p_result_code);
  876. /**@brief Encodes @ref sd_ant_active_search_sharing_cycles_get command request.
  877. *
  878. * @sa @ref ant_active_search_sharing_cycles_get_rsp_dec for command response decoder.
  879. *
  880. * @param[in] channel Channel is an unsigned char (1 octet) denoting the channel
  881. * number.
  882. * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
  883. * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
  884. * \c out: Length of encoded command packet.
  885. *
  886. * @retval NRF_SUCCESS Encoding success.
  887. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  888. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  889. */
  890. uint32_t ant_active_search_sharing_cycles_get_req_enc(uint8_t channel,
  891. uint8_t * const p_buf,
  892. uint32_t * const p_buf_len);
  893. /**@brief Decodes response to @ref sd_ant_active_search_sharing_cycles_get command.
  894. *
  895. * @sa @ref ant_active_search_sharing_cycles_get_req_enc for command request encoder.
  896. *
  897. * @param[in] p_buf Pointer to beginning of command response packet.
  898. * @param[in] packet_len Length (in bytes) of response packet.
  899. * @param[in] p_cycles Pointer to cycles.
  900. * @param[out] p_result_code Command result code.
  901. *
  902. * @retval NRF_SUCCESS Success.
  903. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  904. * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to
  905. * hold decoded event.
  906. */
  907. uint32_t ant_active_search_sharing_cycles_get_rsp_dec(uint8_t const * const p_buf,
  908. uint32_t packet_len,
  909. void * const p_cycles,
  910. uint32_t * const p_result_code);
  911. /**@brief Encodes @ref sd_ant_lib_config_get command request.
  912. *
  913. * @sa @ref ant_lib_config_get_rsp_dec for command response decoder.
  914. *
  915. * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
  916. * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
  917. * \c out: Length of encoded command packet.
  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_lib_config_get_req_enc(uint8_t * const p_buf,
  924. uint32_t * const p_buf_len);
  925. /**@brief Decodes response to @ref sd_ant_lib_config_get command.
  926. *
  927. * @sa @ref ant_lib_config_get_req_enc for command request encoder.
  928. *
  929. * @param[in] p_buf Pointer to beginning of command response packet.
  930. * @param[in] packet_len Length (in bytes) of response packet.
  931. * @param[in] p_ant_lib_config Pointer to the ANT library configuration.
  932. * @param[out] p_result_code Command result code.
  933. *
  934. * @retval NRF_SUCCESS Success.
  935. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  936. * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to
  937. * hold decoded event.
  938. */
  939. uint32_t ant_lib_config_get_rsp_dec(uint8_t const * const p_buf,
  940. uint32_t packet_len,
  941. void * const p_ant_lib_config,
  942. uint32_t * const p_result_code);
  943. /**@brief Encodes @ref sd_ant_lib_config_clear command request.
  944. *
  945. * @sa @ref ant_lib_config_clear_rsp_dec for command response decoder.
  946. *
  947. * @param[in] ant_lib_config ANT lib config is an unsigned char (1 octet) denoting the
  948. * ANT lib config bit(s) to clear. See ANT Library Config in
  949. * ant_parameters.h.
  950. * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
  951. * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
  952. * \c out: Length of encoded command packet.
  953. *
  954. * @retval NRF_SUCCESS Encoding success.
  955. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  956. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  957. */
  958. uint32_t ant_lib_config_clear_req_enc(uint8_t ant_lib_config,
  959. uint8_t * const p_buf,
  960. uint32_t * const p_buf_len);
  961. /**@brief Decodes response to @ref sd_ant_lib_config_clear command.
  962. *
  963. * @sa @ref ant_lib_config_clear_req_enc for command request encoder.
  964. *
  965. * @param[in] p_buf Pointer to beginning of command response packet.
  966. * @param[in] packet_len Length (in bytes) of response packet.
  967. * @param[out] p_result_code Command result code.
  968. *
  969. * @retval NRF_SUCCESS Success.
  970. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  971. * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to
  972. * hold decoded event.
  973. */
  974. uint32_t ant_lib_config_clear_rsp_dec(uint8_t const * const p_buf,
  975. uint32_t packet_len,
  976. uint32_t * const p_result_code);
  977. /**@brief Encodes @ref sd_ant_stack_reset command request.
  978. *
  979. * @sa @ref ant_stack_reset_rsp_dec for command response decoder.
  980. *
  981. * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
  982. * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
  983. * \c out: Length of encoded command packet.
  984. *
  985. * @retval NRF_SUCCESS Encoding success.
  986. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  987. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  988. */
  989. uint32_t ant_stack_reset_req_enc(uint8_t * const p_buf,
  990. uint32_t * const p_buf_len);
  991. /**@brief Decodes response to @ref sd_ant_stack_reset command.
  992. *
  993. * @sa @ref ant_stack_reset_req_enc for command request encoder.
  994. *
  995. * @param[in] p_buf Pointer to beginning of command response packet.
  996. * @param[in] packet_len Length (in bytes) of response packet.
  997. * @param[out] p_result_code Command result code.
  998. *
  999. * @retval NRF_SUCCESS Success.
  1000. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  1001. * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to
  1002. * hold decoded event.
  1003. */
  1004. uint32_t ant_stack_reset_rsp_dec(uint8_t const * const p_buf,
  1005. uint32_t packet_len,
  1006. uint32_t * const p_result_code);
  1007. /**@brief Encodes @ref sd_ant_rx_scan_mode_start command request.
  1008. *
  1009. * @sa @ref ant_rx_scan_mode_start_rsp_dec for command response decoder.
  1010. *
  1011. * @param[in] sync_channel_packets_only Sync channel packets only is an unsigned char (1 octet)
  1012. * denoting synchronous channel only scanning mode.
  1013. * 0 = disable, 1 = enable.
  1014. * @param[in] p_buf Pointer to buffer where encoded data command will be
  1015. * returned.
  1016. * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
  1017. * \c out: Length of encoded command packet.
  1018. *
  1019. * @retval NRF_SUCCESS Encoding success.
  1020. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  1021. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  1022. */
  1023. uint32_t ant_rx_scan_mode_start_req_enc(uint8_t sync_channel_packets_only,
  1024. uint8_t * const p_buf,
  1025. uint32_t * const p_buf_len);
  1026. /**@brief Decodes response to @ref sd_ant_rx_scan_mode_start command.
  1027. *
  1028. * @sa @ref ant_rx_scan_mode_start_req_enc for command request encoder.
  1029. *
  1030. * @param[in] p_buf Pointer to beginning of command response packet.
  1031. * @param[in] packet_len Length (in bytes) of response packet.
  1032. * @param[out] p_result_code Command result code.
  1033. *
  1034. * @retval NRF_SUCCESS Success.
  1035. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  1036. * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to
  1037. * hold decoded event.
  1038. */
  1039. uint32_t ant_rx_scan_mode_start_rsp_dec(uint8_t const * const p_buf,
  1040. uint32_t packet_len,
  1041. uint32_t * const p_result_code);
  1042. /**@brief Encodes @ref sd_ant_id_list_add command request.
  1043. *
  1044. * @sa @ref ant_id_list_add_rsp_dec for command response decoder.
  1045. *
  1046. * @param[in] channel Channel is an unsigned char (1 octet) denoting the channel
  1047. * number to add the list entry to.
  1048. * @param[in] p_dev_id Dev ID is the pointer to the buffer (4 octets) containing
  1049. * device ID information with the following format:
  1050. * Byte0 = DeviceNumber_LSB
  1051. * Byte1 = DeviceNumber_MSB
  1052. * Byte2 = DeviceType
  1053. * Byte3 = TransType
  1054. * @param[in] list_index List index is an unsigned char (1 octet) denoting the index
  1055. * where the specified channel ID is to be placed in the list (0-3).
  1056. * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
  1057. * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
  1058. * \c out: Length of encoded command packet.
  1059. *
  1060. * @retval NRF_SUCCESS Encoding success.
  1061. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  1062. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  1063. */
  1064. uint32_t ant_id_list_add_req_enc(uint8_t channel,
  1065. uint8_t const * const p_dev_id,
  1066. uint8_t list_index,
  1067. uint8_t * const p_buf,
  1068. uint32_t * const p_buf_len);
  1069. /**@brief Decodes response to @ref sd_ant_id_list_add command.
  1070. *
  1071. * @sa @ref ant_id_list_add_req_enc for command request encoder.
  1072. *
  1073. * @param[in] p_buf Pointer to beginning of command response packet.
  1074. * @param[in] packet_len Length (in bytes) of response packet.
  1075. * @param[out] p_result_code Command result code.
  1076. *
  1077. * @retval NRF_SUCCESS Success.
  1078. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  1079. * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to
  1080. * hold decoded event.
  1081. */
  1082. uint32_t ant_id_list_add_rsp_dec(uint8_t const * const p_buf,
  1083. uint32_t packet_len,
  1084. uint32_t * const p_result_code);
  1085. /**@brief Encodes @ref sd_ant_id_list_config command request.
  1086. *
  1087. * @sa @ref ant_id_list_config_rsp_dec for command response decoder.
  1088. *
  1089. * @param[in] channel Channel is an unsigned char (1 octet) denoting the
  1090. * channel number of the device ID list.
  1091. * @param[in] id_list_size ID list size is an unsigned char (1 octet) denoting the size of
  1092. * the inclusion or exclusion list (0-4).
  1093. * @param[in] inc_exc_flag Inc exc flag is an unsigned char (1 octet) denoting the type of
  1094. * list as Include(0) or Exclude(1).
  1095. * @param[in] channel
  1096. * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
  1097. * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
  1098. * \c out: Length of encoded command packet.
  1099. *
  1100. * @retval NRF_SUCCESS Encoding success.
  1101. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  1102. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  1103. */
  1104. uint32_t ant_id_list_config_req_enc(uint8_t channel,
  1105. uint8_t id_list_size,
  1106. uint8_t inc_exc_flag,
  1107. uint8_t * const p_buf,
  1108. uint32_t * const p_buf_len);
  1109. /**@brief Decodes response to @ref sd_ant_id_list_config command.
  1110. *
  1111. * @sa @ref ant_id_list_config_req_enc for command request encoder.
  1112. *
  1113. * @param[in] p_buf Pointer to beginning of command response packet.
  1114. * @param[in] packet_len Length (in bytes) of response packet.
  1115. * @param[out] p_result_code Command result code.
  1116. *
  1117. * @retval NRF_SUCCESS Success.
  1118. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  1119. * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to
  1120. * hold decoded event.
  1121. */
  1122. uint32_t ant_id_list_config_rsp_dec(uint8_t const * const p_buf,
  1123. uint32_t packet_len,
  1124. uint32_t * const p_result_code);
  1125. /**@brief Encodes @ref sd_ant_channel_status_get command request.
  1126. *
  1127. * @sa @ref ant_channel_status_get_rsp_dec for command response decoder.
  1128. *
  1129. * @param[in] channel Channel is an unsigned char (1 octet) denoting the channel
  1130. * number.
  1131. * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
  1132. * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
  1133. * \c out: Length of encoded command packet.
  1134. *
  1135. * @retval NRF_SUCCESS Encoding success.
  1136. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  1137. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  1138. */
  1139. uint32_t ant_channel_status_get_req_enc(uint8_t channel,
  1140. uint8_t * const p_buf,
  1141. uint32_t * const p_buf_len);
  1142. /**@brief Decodes response to @ref sd_ant_channel_status_get command.
  1143. *
  1144. * @sa @ref ant_channel_status_get_req_enc for command request encoder.
  1145. *
  1146. * @param[in] p_buf Pointer to beginning of command response packet.
  1147. * @param[in] packet_len Length (in bytes) of response packet.
  1148. * @param[in] p_status Pointer to status
  1149. * @param[out] p_result_code Command result code.
  1150. *
  1151. * @retval NRF_SUCCESS Success.
  1152. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  1153. * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to
  1154. * hold decoded event.
  1155. */
  1156. uint32_t ant_channel_status_get_rsp_dec(uint8_t const * const p_buf,
  1157. uint32_t packet_len,
  1158. void * const p_status,
  1159. uint32_t * const p_result_code);
  1160. /**@brief Encodes @ref sd_ant_cw_test_mode_init command request.
  1161. *
  1162. * @sa @ref ant_cw_test_mode_init_rsp_dec for command response decoder.
  1163. *
  1164. * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
  1165. * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
  1166. * \c out: Length of encoded command packet.
  1167. *
  1168. * @retval NRF_SUCCESS Encoding success.
  1169. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  1170. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  1171. */
  1172. uint32_t ant_cw_test_mode_init_req_enc(uint8_t * const p_buf,
  1173. uint32_t * const p_buf_len);
  1174. /**@brief Decodes response to @ref sd_ant_cw_test_mode_init command.
  1175. *
  1176. * @sa @ref ant_cw_test_mode_init_req_enc for command request encoder.
  1177. *
  1178. * @param[in] p_buf Pointer to beginning of command response packet.
  1179. * @param[in] packet_len Length (in bytes) of response packet.
  1180. * @param[out] p_result_code Command result code.
  1181. *
  1182. * @retval NRF_SUCCESS Success.
  1183. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  1184. * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to
  1185. * hold decoded event.
  1186. */
  1187. uint32_t ant_cw_test_mode_init_rsp_dec(uint8_t const * const p_buf,
  1188. uint32_t packet_len,
  1189. uint32_t * const p_result_code);
  1190. /**@brief Encodes @ref sd_ant_cw_test_mode command request.
  1191. *
  1192. * @sa @ref ant_cw_test_mode_rsp_dec for command response decoder.
  1193. *
  1194. * @param[in] radio_freq Radio freq is an unsigned char (1 octet) denoting the radio
  1195. * frequency offset from 2400 MHz for continuous wave mode.
  1196. * (eg. 2466 MHz, ucRadioFreq = 66).
  1197. * @param[in] tx_power TX Power is an unsigned char (1 octet) denoting the ANT transmit
  1198. * power index for continuous wave mode. See Radio TX Power
  1199. * Definitions in ant_parameters.h
  1200. * @param[in] custom_tx_power Custom TX power is an unsigned char (1 octet) denoting the
  1201. * custom nRF transmit power as defined in nrf51_bitfields.h. Only
  1202. * applicable if ucTxPower is set to custom TX power selection.
  1203. * @param[in] mode Mode is an unsigned char (1 octet) denoting test mode type where
  1204. * 0 = cw tx carrier transmission, 1 = cw tx modulated transmission.
  1205. * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
  1206. * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
  1207. * \c out: Length of encoded command packet.
  1208. *
  1209. * @retval NRF_SUCCESS Encoding success.
  1210. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  1211. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  1212. */
  1213. uint32_t ant_cw_test_mode_req_enc(uint8_t radio_freq,
  1214. uint8_t tx_power,
  1215. uint8_t custom_tx_power,
  1216. uint8_t mode,
  1217. uint8_t * const p_buf,
  1218. uint32_t * const p_buf_len);
  1219. /**@brief Decodes response to @ref sd_ant_cw_test_mode command.
  1220. *
  1221. * @sa @ref ant_cw_test_mode_req_enc for command request encoder.
  1222. *
  1223. * @param[in] p_buf Pointer to beginning of command response packet.
  1224. * @param[in] packet_len Length (in bytes) of response packet.
  1225. * @param[out] p_result_code Command result code.
  1226. *
  1227. * @retval NRF_SUCCESS Success.
  1228. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  1229. * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to
  1230. * hold decoded event.
  1231. */
  1232. uint32_t ant_cw_test_mode_rsp_dec(uint8_t const * const p_buf,
  1233. uint32_t packet_len,
  1234. uint32_t * const p_result_code);
  1235. /**@brief Encodes @ref sd_ant_version_get command request.
  1236. *
  1237. * @sa @ref ant_version_get_rsp_dec for command response decoder.
  1238. *
  1239. * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
  1240. * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
  1241. * \c out: Length of encoded command packet.
  1242. *
  1243. * @retval NRF_SUCCESS Encoding success.
  1244. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  1245. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  1246. */
  1247. uint32_t ant_version_get_req_enc(uint8_t * const p_buf,
  1248. uint32_t * const p_buf_len);
  1249. /**@brief Decodes response to @ref sd_ant_version_get command.
  1250. *
  1251. * @sa @ref ant_version_get_req_enc for command request encoder.
  1252. *
  1253. * @param[in] p_buf Pointer to beginning of command response packet.
  1254. * @param[in] packet_len Length (in bytes) of response packet.
  1255. * @param[in] p_version Pointer to version string buffer.
  1256. * @param[out] p_result_code Command result code.
  1257. *
  1258. * @retval NRF_SUCCESS Success.
  1259. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  1260. * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to
  1261. * hold decoded event.
  1262. */
  1263. uint32_t ant_version_get_rsp_dec(uint8_t const * const p_buf,
  1264. uint32_t packet_len,
  1265. void * * const p_version,
  1266. uint32_t * const p_result_code);
  1267. /**@brief Encodes @ref sd_ant_capabilities_get command request.
  1268. *
  1269. * @sa @ref ant_capabilities_get_rsp_dec for command response decoder.
  1270. *
  1271. * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
  1272. * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
  1273. * \c out: Length of encoded command packet.
  1274. *
  1275. * @retval NRF_SUCCESS Encoding success.
  1276. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  1277. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  1278. */
  1279. uint32_t ant_capabilities_get_req_enc(uint8_t * const p_buf,
  1280. uint32_t * const p_buf_len);
  1281. /**@brief Decodes response to @ref sd_ant_capabilities_get command.
  1282. *
  1283. * @sa @ref ant_capabilities_get_req_enc for command request encoder.
  1284. *
  1285. * @param[in] p_buf Pointer to beginning of command response packet.
  1286. * @param[in] packet_len Length (in bytes) of response packet.
  1287. * @param[in] pp_capabilities Pointer to pointer to capabilities buffer.
  1288. * @param[out] p_result_code Command result code.
  1289. *
  1290. * @retval NRF_SUCCESS Success.
  1291. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  1292. * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to
  1293. * hold decoded event.
  1294. */
  1295. uint32_t ant_capabilities_get_rsp_dec(uint8_t const * const p_buf,
  1296. uint32_t packet_len,
  1297. void * * const pp_capabilities,
  1298. uint32_t * const p_result_code);
  1299. /**@brief Encodes @ref sd_ant_crypto_channel_enable command request.
  1300. *
  1301. * @sa @ref ant_crypto_channel_enable_rsp_dec for command response decoder.
  1302. *
  1303. * @param[in] channel Channel is an unsigned char (1 octet) denoting the channel in
  1304. * which encryption mode is set.
  1305. * @param[in] enable Enable is an unsigned char (1 octet) denoting the encryption
  1306. * mode. See Encrypted Channel Defines in ant_parameters.h.
  1307. * @param[in] key_num Key num is an unsigned char (1 octet) denoting the key index of
  1308. * the 128-bit key to be used for encryption. The key index range
  1309. * is bound by the number of encrypted channels configured by
  1310. * sd_ant_enable(). If sd_ant_enable() is not used then by default
  1311. * key num is 0. Range is [0 to (num encrypted channels - 1)], if
  1312. * 1 or more encrypted channels are configured.
  1313. * @param[in] decimation_rate Decimation rate is an unsigned char (1 octet) denoting the
  1314. * decimate rate to apply for encrypted slave channel. Must be > 0.
  1315. * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
  1316. * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
  1317. * \c out: Length of encoded command packet.
  1318. *
  1319. * @retval NRF_SUCCESS Encoding success.
  1320. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  1321. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  1322. */
  1323. uint32_t ant_crypto_channel_enable_req_enc(uint8_t channel,
  1324. uint8_t enable,
  1325. uint8_t key_num,
  1326. uint8_t decimation_rate,
  1327. uint8_t * const p_buf,
  1328. uint32_t * const p_buf_len);
  1329. /**@brief Decodes response to @ref sd_ant_crypto_channel_enable command.
  1330. *
  1331. * @sa @ref ant_crypto_channel_enable_req_enc for command request encoder.
  1332. *
  1333. * @param[in] p_buf Pointer to beginning of command response packet.
  1334. * @param[in] packet_len Length (in bytes) of response packet.
  1335. * @param[out] p_result_code Command result code.
  1336. *
  1337. * @retval NRF_SUCCESS Success.
  1338. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  1339. * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to
  1340. * hold decoded event.
  1341. */
  1342. uint32_t ant_crypto_channel_enable_rsp_dec(uint8_t const * const p_buf,
  1343. uint32_t packet_len,
  1344. uint32_t * const p_result_code);
  1345. /**@brief Encodes @ref sd_ant_adv_burst_config_set command request.
  1346. *
  1347. * @sa @ref ant_adv_burst_config_set_rsp_dec for command response decoder.
  1348. *
  1349. * @param[in] p_config Config is a buffer containing the advanced burst
  1350. * configuration to be set.
  1351. * @param[in] size Size is an unsigned char (1 octet) denoting the size of the
  1352. * configuration parameter buffer.
  1353. * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
  1354. * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
  1355. * \c out: Length of encoded command packet.
  1356. *
  1357. * @retval NRF_SUCCESS Encoding success.
  1358. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  1359. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  1360. */
  1361. uint32_t ant_adv_burst_config_set_req_enc(uint8_t const * const p_config,
  1362. uint8_t size,
  1363. uint8_t * const p_buf,
  1364. uint32_t * const p_buf_len);
  1365. /**@brief Decodes response to @ref sd_ant_adv_burst_config_set command.
  1366. *
  1367. * @sa @ref ant_adv_burst_config_set_req_enc for command request encoder.
  1368. *
  1369. * @param[in] p_buf Pointer to beginning of command response packet.
  1370. * @param[in] packet_len Length (in bytes) of response packet.
  1371. * @param[out] p_result_code Command result code.
  1372. *
  1373. * @retval NRF_SUCCESS Success.
  1374. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  1375. * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to
  1376. * hold decoded event.
  1377. */
  1378. uint32_t ant_adv_burst_config_set_rsp_dec(uint8_t const * const p_buf,
  1379. uint32_t packet_len,
  1380. uint32_t * const p_result_code);
  1381. /**@brief Encodes @ref sd_ant_crypto_key_set command request.
  1382. *
  1383. * @sa @ref ant_crypto_key_set_rsp_dec for command response decoder.
  1384. *
  1385. * @param[in] key_num Key num is an unsigned char (1 octet) denoting the key index for
  1386. * assignment.
  1387. * @param[in] p_key Buffer (16 octets) containing the 128-bit AES key to be
  1388. * assigned to the key index.
  1389. *
  1390. * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
  1391. * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
  1392. * \c out: Length of encoded command packet.
  1393. *
  1394. * @retval NRF_SUCCESS Encoding success.
  1395. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  1396. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  1397. */
  1398. uint32_t ant_crypto_key_set_req_enc(uint8_t key_num,
  1399. uint8_t const * const p_key,
  1400. uint8_t * const p_buf,
  1401. uint32_t * const p_buf_len);
  1402. /**@brief Decodes response to @ref sd_ant_crypto_key_set command.
  1403. *
  1404. * @sa @ref ant_crypto_key_set_req_enc for command request encoder.
  1405. *
  1406. * @param[in] p_buf Pointer to beginning of command response packet.
  1407. * @param[in] packet_len Length (in bytes) of response packet.
  1408. * @param[out] p_result_code Command result code.
  1409. *
  1410. * @retval NRF_SUCCESS Success.
  1411. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  1412. * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to
  1413. * hold decoded event.
  1414. */
  1415. uint32_t ant_crypto_key_set_rsp_dec(uint8_t const * const p_buf,
  1416. uint32_t packet_len,
  1417. uint32_t * const p_result_code);
  1418. /**@brief Encodes @ref sd_ant_crypto_info_set command request.
  1419. *
  1420. * @sa @ref ant_crypto_info_set_rsp_dec for command response decoder.
  1421. *
  1422. * @param[in] type Type is an unsigned char (1 octet) denoting the type of
  1423. * information being set.
  1424. * @param[in] p_info Pointer to a buffer buffer containing the information being set.
  1425. *
  1426. * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
  1427. * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
  1428. * \c out: Length of encoded command packet.
  1429. *
  1430. * @retval NRF_SUCCESS Encoding success.
  1431. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  1432. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  1433. */
  1434. uint32_t ant_crypto_info_set_req_enc(uint8_t type,
  1435. uint8_t const * const p_info,
  1436. uint8_t * const p_buf,
  1437. uint32_t * const p_buf_len);
  1438. /**@brief Decodes response to @ref sd_ant_crypto_info_set command.
  1439. *
  1440. * @sa @ref ant_crypto_info_set_req_enc for command request encoder.
  1441. *
  1442. * @param[in] p_buf Pointer to beginning of command response packet.
  1443. * @param[in] packet_len Length (in bytes) of response packet.
  1444. * @param[out] p_result_code Command result code.
  1445. *
  1446. * @retval NRF_SUCCESS Success.
  1447. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  1448. * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to
  1449. * hold decoded event.
  1450. */
  1451. uint32_t ant_crypto_info_set_rsp_dec(uint8_t const * const p_buf,
  1452. uint32_t packet_len,
  1453. uint32_t * const p_result_code);
  1454. /**@brief Encodes @ref sd_ant_crypto_info_get command request.
  1455. *
  1456. * @sa @ref ant_crypto_info_get_rsp_dec for command response decoder.
  1457. *
  1458. * @param[in] type Type is an unsigned char (1 octet) denoting the type of
  1459. * information being set.
  1460. * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
  1461. * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
  1462. * \c out: Length of encoded command 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_crypto_info_get_req_enc(uint8_t type,
  1469. uint8_t * const p_buf,
  1470. uint32_t * const p_buf_len);
  1471. /**@brief Decodes response to @ref sd_ant_crypto_info_get command.
  1472. *
  1473. * @sa @ref ant_crypto_info_get_req_enc for command request encoder.
  1474. *
  1475. * @param[in] p_buf Pointer to beginning of command response packet.
  1476. * @param[in] packet_len Length (in bytes) of response packet.
  1477. * @param[in] p_info Pointer to the info buffer.
  1478. * @param[out] p_result_code Command result code.
  1479. *
  1480. * @retval NRF_SUCCESS Success.
  1481. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  1482. * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to
  1483. * hold decoded event.
  1484. */
  1485. uint32_t ant_crypto_info_get_rsp_dec(uint8_t const * const p_buf,
  1486. uint32_t packet_len,
  1487. void * const p_info,
  1488. uint32_t * const p_result_code);
  1489. /**@brief Encodes @ref sd_ant_coex_config_set command request.
  1490. *
  1491. * @sa @ref ant_coex_config_set_rsp_dec for command response decoder.
  1492. *
  1493. * @param[in] channel Channel is an unsigned char (1 octet) denoting the channel for
  1494. * which the coexistence configuration is to be set
  1495. * @param[in] p_config Pointer to a buffer containing the configuration to be set.
  1496. * @param[in] p_adv_coex_config Pointer to a buffer containing the advanced coexistence configuration
  1497. * to be set.
  1498. *
  1499. * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
  1500. * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
  1501. * \c out: Length of encoded command packet.
  1502. *
  1503. * @retval NRF_SUCCESS Encoding success.
  1504. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  1505. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  1506. */
  1507. uint32_t ant_coex_config_set_req_enc(uint8_t channel,
  1508. ANT_BUFFER_PTR const * const p_config,
  1509. ANT_BUFFER_PTR const * const p_adv_coex_config,
  1510. uint8_t * const p_buf,
  1511. uint32_t * const p_buf_len);
  1512. /**@brief Decodes response to @ref sd_ant_coex_config_set command.
  1513. *
  1514. * @sa @ref ant_coex_config_set_req_enc for command request encoder.
  1515. *
  1516. * @param[in] p_buf Pointer to beginning of command response packet.
  1517. * @param[in] packet_len Length (in bytes) of response packet.
  1518. * @param[out] p_result_code Command result code.
  1519. *
  1520. * @retval NRF_SUCCESS Success.
  1521. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  1522. * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to
  1523. * hold decoded event.
  1524. */
  1525. uint32_t ant_coex_config_set_rsp_dec(uint8_t const * const p_buf,
  1526. uint32_t packet_len,
  1527. uint32_t * const p_result_code);
  1528. /**@brief Encodes @ref sd_ant_coex_config_get command request.
  1529. *
  1530. * @sa @ref ant_coex_config_get_rsp_dec for command response decoder.
  1531. *
  1532. * @param[in] channel Channel is an unsigned char (1 octet) denoting the channel to
  1533. * query.
  1534. * @param[in] p_buf Pointer to buffer where encoded data command will be returned.
  1535. * @param[in,out] p_buf_len \c in: Size of \p p_buf buffer.
  1536. * \c out: Length of encoded command packet.
  1537. *
  1538. * @retval NRF_SUCCESS Encoding success.
  1539. * @retval NRF_ERROR_NULL Encoding failure. NULL pointer supplied.
  1540. * @retval NRF_ERROR_INVALID_LENGTH Encoding failure. Incorrect buffer length.
  1541. */
  1542. uint32_t ant_coex_config_get_req_enc(uint8_t channel,
  1543. uint8_t * const p_buf,
  1544. uint32_t * const p_buf_len);
  1545. /**@brief Decodes response to @ref sd_ant_coex_config_get command.
  1546. *
  1547. * @sa @ref ant_coex_config_get_req_enc for command request encoder.
  1548. *
  1549. * @param[in] p_buf Pointer to beginning of command response packet.
  1550. * @param[in] packet_len Length (in bytes) of response packet.
  1551. * @param[in] p_coex_config Pointer to the coexistence configuration buffer.
  1552. * @param[in] p_adv_coex_config Pointer to the advanced coexistence configuration buffer.
  1553. * @param[out] p_result_code Command result code.
  1554. *
  1555. * @retval NRF_SUCCESS Success.
  1556. * @retval NRF_ERROR_INVALID_LENGTH Decoding failure. Incorrect buffer length.
  1557. * @retval NRF_ERROR_DATA_SIZE Decoding failure. Length of \p p_event is too small to
  1558. * hold decoded event.
  1559. */
  1560. uint32_t ant_coex_config_get_rsp_dec(uint8_t const * const p_buf,
  1561. uint32_t packet_len,
  1562. void * const p_coex_config,
  1563. void * const p_adv_coex_config,
  1564. uint32_t * const p_result_code);
  1565. /** @} */
  1566. #endif