conn_mw_ble_l2cap.h 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  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 _CONN_MW_BLE_L2CAP_H_
  41. #define _CONN_MW_BLE_L2CAP_H_
  42. #include <stdint.h>
  43. #ifdef __cplusplus
  44. extern "C" {
  45. #endif
  46. /**
  47. * @addtogroup sercon_mw_s132_ble_l2cap L2CAP Middleware command handlers
  48. * @{
  49. * @ingroup sercon_mw_s132
  50. */
  51. /**@brief Handles sd_ble_l2cap_cid_register command and prepares response.
  52. *
  53. * @param[in] p_rx_buf Pointer to input buffer.
  54. * @param[in] rx_buf_len Size of @p p_rx_buf.
  55. * @param[out] p_tx_buf Pointer to output buffer.
  56. * @param[in,out] p_tx_buf_len \c in: Size of \p p_tx_buf buffer.
  57. * \c out: Length of valid data in \p p_tx_buf.
  58. *
  59. * @retval NRF_SUCCESS Handler success.
  60. * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied.
  61. * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length.
  62. * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type.
  63. */
  64. uint32_t conn_mw_ble_l2cap_cid_register(uint8_t const * const p_rx_buf,
  65. uint32_t rx_buf_len,
  66. uint8_t * const p_tx_buf,
  67. uint32_t * const p_tx_buf_len);
  68. /**@brief Handles sd_ble_l2cap_cid_unregister command and prepares response.
  69. *
  70. * @param[in] p_rx_buf Pointer to input buffer.
  71. * @param[in] rx_buf_len Size of @p p_rx_buf.
  72. * @param[out] p_tx_buf Pointer to output buffer.
  73. * @param[in,out] p_tx_buf_len \c in: Size of \p p_tx_buf buffer.
  74. * \c out: Length of valid data in \p p_tx_buf.
  75. *
  76. * @retval NRF_SUCCESS Handler success.
  77. * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied.
  78. * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length.
  79. * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type.
  80. */
  81. uint32_t conn_mw_ble_l2cap_cid_unregister(uint8_t const * const p_rx_buf,
  82. uint32_t rx_buf_len,
  83. uint8_t * const p_tx_buf,
  84. uint32_t * const p_tx_buf_len);
  85. /**@brief Handles sd_ble_l2cap_tx command and prepares response.
  86. *
  87. * @param[in] p_rx_buf Pointer to input buffer.
  88. * @param[in] rx_buf_len Size of @p p_rx_buf.
  89. * @param[out] p_tx_buf Pointer to output buffer.
  90. * @param[in,out] p_tx_buf_len \c in: Size of \p p_tx_buf buffer.
  91. * \c out: Length of valid data in \p p_tx_buf.
  92. *
  93. * @retval NRF_SUCCESS Handler success.
  94. * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied.
  95. * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length.
  96. * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type.
  97. */
  98. uint32_t conn_mw_ble_l2cap_tx(uint8_t const * const p_rx_buf,
  99. uint32_t rx_buf_len,
  100. uint8_t * const p_tx_buf,
  101. uint32_t * const p_tx_buf_len);
  102. /**@brief Handles sd_ble_l2cap_ch_setup command and prepares response.
  103. *
  104. * @param[in] p_rx_buf Pointer to input buffer.
  105. * @param[in] rx_buf_len Size of @p p_rx_buf.
  106. * @param[out] p_tx_buf Pointer to output buffer.
  107. * @param[in,out] p_tx_buf_len \c in: Size of \p p_tx_buf buffer.
  108. * \c out: Length of valid data in \p p_tx_buf.
  109. *
  110. * @retval NRF_SUCCESS Handler success.
  111. * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied.
  112. * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length.
  113. * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type.
  114. */
  115. uint32_t conn_mw_l2cap_ch_setup(uint8_t const * const p_rx_buf,
  116. uint32_t rx_buf_len,
  117. uint8_t * const p_tx_buf,
  118. uint32_t * const p_tx_buf_len);
  119. /**@brief Handles sd_ble_l2cap_ch_release command and prepares response.
  120. *
  121. * @param[in] p_rx_buf Pointer to input buffer.
  122. * @param[in] rx_buf_len Size of @p p_rx_buf.
  123. * @param[out] p_tx_buf Pointer to output buffer.
  124. * @param[in,out] p_tx_buf_len \c in: Size of \p p_tx_buf buffer.
  125. * \c out: Length of valid data in \p p_tx_buf.
  126. *
  127. * @retval NRF_SUCCESS Handler success.
  128. * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied.
  129. * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length.
  130. * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type.
  131. */
  132. uint32_t conn_mw_l2cap_ch_release(uint8_t const * const p_rx_buf,
  133. uint32_t rx_buf_len,
  134. uint8_t * const p_tx_buf,
  135. uint32_t * const p_tx_buf_len);
  136. /**@brief Handles sd_ble_l2cap_ch_rx command and prepares response.
  137. *
  138. * @param[in] p_rx_buf Pointer to input buffer.
  139. * @param[in] rx_buf_len Size of @p p_rx_buf.
  140. * @param[out] p_tx_buf Pointer to output buffer.
  141. * @param[in,out] p_tx_buf_len \c in: Size of \p p_tx_buf buffer.
  142. * \c out: Length of valid data in \p p_tx_buf.
  143. *
  144. * @retval NRF_SUCCESS Handler success.
  145. * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied.
  146. * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length.
  147. * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type.
  148. */
  149. uint32_t conn_mw_l2cap_ch_rx(uint8_t const * const p_rx_buf,
  150. uint32_t rx_buf_len,
  151. uint8_t * const p_tx_buf,
  152. uint32_t * const p_tx_buf_len);
  153. /**@brief Handles sd_ble_l2cap_ch_tx command and prepares response.
  154. *
  155. * @param[in] p_rx_buf Pointer to input buffer.
  156. * @param[in] rx_buf_len Size of @p p_rx_buf.
  157. * @param[out] p_tx_buf Pointer to output buffer.
  158. * @param[in,out] p_tx_buf_len \c in: Size of \p p_tx_buf buffer.
  159. * \c out: Length of valid data in \p p_tx_buf.
  160. *
  161. * @retval NRF_SUCCESS Handler success.
  162. * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied.
  163. * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length.
  164. * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type.
  165. */
  166. uint32_t conn_mw_l2cap_ch_tx(uint8_t const * const p_rx_buf,
  167. uint32_t rx_buf_len,
  168. uint8_t * const p_tx_buf,
  169. uint32_t * const p_tx_buf_len);
  170. /**@brief Handles sd_ble_l2cap_ch_flow_control command and prepares response.
  171. *
  172. * @param[in] p_rx_buf Pointer to input buffer.
  173. * @param[in] rx_buf_len Size of @p p_rx_buf.
  174. * @param[out] p_tx_buf Pointer to output buffer.
  175. * @param[in,out] p_tx_buf_len \c in: Size of \p p_tx_buf buffer.
  176. * \c out: Length of valid data in \p p_tx_buf.
  177. *
  178. * @retval NRF_SUCCESS Handler success.
  179. * @retval NRF_ERROR_NULL Handler failure. NULL pointer supplied.
  180. * @retval NRF_ERROR_INVALID_LENGTH Handler failure. Incorrect buffer length.
  181. * @retval NRF_ERROR_INVALID_PARAM Handler failure. Invalid operation type.
  182. */
  183. uint32_t conn_mw_l2cap_ch_flow_control(uint8_t const * const p_rx_buf,
  184. uint32_t rx_buf_len,
  185. uint8_t * const p_tx_buf,
  186. uint32_t * const p_tx_buf_len);
  187. /** @} */
  188. #ifdef __cplusplus
  189. }
  190. #endif
  191. #endif