ble_struct_serialization.h 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  1. /**
  2. * Copyright (c) 2014 - 2020, Nordic Semiconductor ASA
  3. *
  4. * All rights reserved.
  5. *
  6. * Redistribution and use in source and binary forms, with or without modification,
  7. * are permitted provided that the following conditions are met:
  8. *
  9. * 1. Redistributions of source code must retain the above copyright notice, this
  10. * list of conditions and the following disclaimer.
  11. *
  12. * 2. Redistributions in binary form, except as embedded into a Nordic
  13. * Semiconductor ASA integrated circuit in a product or a software update for
  14. * such product, must reproduce the above copyright notice, this list of
  15. * conditions and the following disclaimer in the documentation and/or other
  16. * materials provided with the distribution.
  17. *
  18. * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
  19. * contributors may be used to endorse or promote products derived from this
  20. * software without specific prior written permission.
  21. *
  22. * 4. This software, with or without modification, must only be used with a
  23. * Nordic Semiconductor ASA integrated circuit.
  24. *
  25. * 5. Any software provided in binary form under this license must not be reverse
  26. * engineered, decompiled, modified and/or disassembled.
  27. *
  28. * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
  29. * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  30. * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
  31. * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
  32. * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  33. * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
  34. * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  35. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  36. * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  37. * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  38. *
  39. */
  40. #ifndef BLE_STRUCT_SERIALIZATION_H__
  41. #define BLE_STRUCT_SERIALIZATION_H__
  42. #include "ble_types.h"
  43. #ifdef __cplusplus
  44. extern "C" {
  45. #endif
  46. uint32_t ble_uuid_t_enc(void const * const p_void_struct,
  47. uint8_t * const p_buf,
  48. uint32_t buf_len,
  49. uint32_t * const p_index);
  50. uint32_t ble_uuid_t_dec(uint8_t const * const p_buf,
  51. uint32_t buf_len,
  52. uint32_t * const p_index,
  53. void * const p_void_struct);
  54. uint32_t ble_uuid128_t_enc(const void * const p_void_struct,
  55. uint8_t * const p_buf,
  56. uint32_t buf_len,
  57. uint32_t * const p_index);
  58. uint32_t ble_uuid128_t_dec(uint8_t const * const p_buf,
  59. uint32_t buf_len,
  60. uint32_t * const p_index,
  61. void * const p_void_struct);
  62. uint32_t ble_enable_params_t_enc(void const * const p_void_struct,
  63. uint8_t * const p_buf,
  64. uint32_t buf_len,
  65. uint32_t * const p_index);
  66. uint32_t ble_enable_params_t_dec(uint8_t const * const p_buf,
  67. uint32_t buf_len,
  68. uint32_t * const p_index,
  69. void * const p_void_struct);
  70. uint32_t ble_conn_bw_t_enc(void const * const p_void_struct,
  71. uint8_t * const p_buf,
  72. uint32_t buf_len,
  73. uint32_t * const p_index);
  74. uint32_t ble_conn_bw_t_dec(uint8_t const * const p_buf,
  75. uint32_t buf_len,
  76. uint32_t * const p_index,
  77. void * const p_void_struct);
  78. uint32_t ble_common_opt_conn_bw_t_enc(void const * const p_void_struct,
  79. uint8_t * const p_buf,
  80. uint32_t buf_len,
  81. uint32_t * const p_index);
  82. uint32_t ble_common_opt_conn_bw_t_dec(uint8_t const * const p_buf,
  83. uint32_t buf_len,
  84. uint32_t * const p_index,
  85. void * const p_void_struct);
  86. uint32_t ble_conn_bw_count_t_enc(void const * const p_void_struct,
  87. uint8_t * const p_buf,
  88. uint32_t buf_len,
  89. uint32_t * const p_index);
  90. uint32_t ble_conn_bw_count_t_dec(uint8_t const * const p_buf,
  91. uint32_t buf_len,
  92. uint32_t * const p_index,
  93. void * const p_void_struct);
  94. uint32_t ble_conn_bw_counts_t_enc(void const * const p_void_struct,
  95. uint8_t * const p_buf,
  96. uint32_t buf_len,
  97. uint32_t * const p_index);
  98. uint32_t ble_conn_bw_counts_t_dec(uint8_t const * const p_buf,
  99. uint32_t buf_len,
  100. uint32_t * const p_index,
  101. void * const p_void_struct);
  102. uint32_t ble_common_enable_params_t_enc(void const * const p_void_struct,
  103. uint8_t * const p_buf,
  104. uint32_t buf_len,
  105. uint32_t * const p_index);
  106. uint32_t ble_common_enable_params_t_dec(uint8_t const * const p_buf,
  107. uint32_t buf_len,
  108. uint32_t * const p_index,
  109. void * const p_void_struct);
  110. uint32_t ble_common_opt_pa_lna_t_enc(void const * const p_void_struct,
  111. uint8_t * const p_buf,
  112. uint32_t buf_len,
  113. uint32_t * const p_index);
  114. uint32_t ble_common_opt_pa_lna_t_dec(uint8_t const * const p_buf,
  115. uint32_t buf_len,
  116. uint32_t * const p_index,
  117. void * const p_void_struct);
  118. uint32_t ble_pa_lna_cfg_t_enc(void const * const p_void_struct,
  119. uint8_t * const p_buf,
  120. uint32_t buf_len,
  121. uint32_t * const p_index);
  122. uint32_t ble_pa_lna_cfg_t_dec(uint8_t const * const p_buf,
  123. uint32_t buf_len,
  124. uint32_t * const p_index,
  125. void * const p_void_struct);
  126. uint32_t ble_user_mem_block_t_enc(void const * const p_void_struct,
  127. uint8_t * const p_buf,
  128. uint32_t buf_len,
  129. uint32_t * const p_index);
  130. uint32_t ble_user_mem_block_t_dec(uint8_t const * const p_buf,
  131. uint32_t buf_len,
  132. uint32_t * const p_index,
  133. void * const p_void_struct);
  134. uint32_t ble_version_t_enc(void const * const p_void_struct,
  135. uint8_t * const p_buf,
  136. uint32_t buf_len,
  137. uint32_t * const p_index);
  138. uint32_t ble_version_t_dec(uint8_t const * const p_buf,
  139. uint32_t buf_len,
  140. uint32_t * const p_index,
  141. void * const p_void_struct);
  142. uint32_t ble_evt_data_length_changed_t_enc(void const * const p_void_struct,
  143. uint8_t * const p_buf,
  144. uint32_t buf_len,
  145. uint32_t * const p_index);
  146. uint32_t ble_evt_data_length_changed_t_dec(uint8_t const * const p_buf,
  147. uint32_t buf_len,
  148. uint32_t * const p_index,
  149. void * const p_void_struct);
  150. uint32_t ble_common_opt_conn_evt_ext_t_enc(void const * const p_void_struct,
  151. uint8_t * const p_buf,
  152. uint32_t buf_len,
  153. uint32_t * const p_index);
  154. uint32_t ble_common_opt_conn_evt_ext_t_dec(uint8_t const * const p_buf,
  155. uint32_t buf_len,
  156. uint32_t * const p_index,
  157. void * const p_void_struct);
  158. #if NRF_SD_BLE_API_VERSION >= 4
  159. uint32_t ble_common_cfg_vs_uuid_t_enc(void const * const p_void_struct,
  160. uint8_t * const p_buf,
  161. uint32_t buf_len,
  162. uint32_t * const p_index);
  163. uint32_t ble_common_cfg_vs_uuid_t_dec(uint8_t const * const p_buf,
  164. uint32_t buf_len,
  165. uint32_t * const p_index,
  166. void * const p_void_struct);
  167. #endif
  168. #if defined(NRF_SD_BLE_API_VERSION) && NRF_SD_BLE_API_VERSION > 4
  169. uint32_t ble_data_t_enc(void const * const p_void_struct,
  170. uint8_t * const p_buf,
  171. uint32_t buf_len,
  172. uint32_t * const p_index);
  173. uint32_t ble_data_t_dec(uint8_t const * const p_buf,
  174. uint32_t buf_len,
  175. uint32_t * const p_index,
  176. void * const p_void_struct);
  177. #endif
  178. #ifdef __cplusplus
  179. }
  180. #endif
  181. #endif // BLE_STRUCT_SERIALIZATION_H__