bta_pan_co.h 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  1. /******************************************************************************
  2. *
  3. * Copyright 2004-2012 Broadcom Corporation
  4. *
  5. * Licensed under the Apache License, Version 2.0 (the "License");
  6. * you may not use this file except in compliance with the License.
  7. * You may obtain a copy of the License at:
  8. *
  9. * http://www.apache.org/licenses/LICENSE-2.0
  10. *
  11. * Unless required by applicable law or agreed to in writing, software
  12. * distributed under the License is distributed on an "AS IS" BASIS,
  13. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. * See the License for the specific language governing permissions and
  15. * limitations under the License.
  16. *
  17. ******************************************************************************/
  18. /******************************************************************************
  19. *
  20. * This is the interface file for data gateway call-out functions.
  21. *
  22. ******************************************************************************/
  23. #ifndef BTA_PAN_CO_H
  24. #define BTA_PAN_CO_H
  25. #include "bta_pan_api.h"
  26. /*****************************************************************************
  27. * Constants
  28. ****************************************************************************/
  29. /* BT_HDR buffer offset */
  30. #define BTA_PAN_MIN_OFFSET PAN_MINIMUM_OFFSET
  31. /* Data Flow Mask */
  32. #define BTA_PAN_RX_PUSH 0x00 /* RX push. */
  33. #define BTA_PAN_RX_PUSH_BUF 0x01 /* RX push with zero copy. */
  34. #define BTA_PAN_RX_PULL 0x02 /* RX pull. */
  35. #define BTA_PAN_TX_PUSH 0x00 /* TX push. */
  36. #define BTA_PAN_TX_PUSH_BUF 0x10 /* TX push with zero copy. */
  37. #define BTA_PAN_TX_PULL 0x20 /* TX pull. */
  38. /*****************************************************************************
  39. * Function Declarations
  40. ****************************************************************************/
  41. /*******************************************************************************
  42. *
  43. * Function bta_pan_co_init
  44. *
  45. * Description This callout function is executed by PAN when a server is
  46. * started by calling BTA_PanEnable(). This function can be
  47. * used by the phone to initialize data paths or for other
  48. * initialization purposes. The function must return the
  49. * data flow mask as described below.
  50. *
  51. *
  52. * Returns Data flow mask.
  53. *
  54. ******************************************************************************/
  55. extern uint8_t bta_pan_co_init(uint8_t* q_level);
  56. /*******************************************************************************
  57. *
  58. * Function bta_pan_co_open
  59. *
  60. * Description This function is executed by PAN when a connection
  61. * is opened. The phone can use this function to set
  62. * up data paths or perform any required initialization.
  63. *
  64. *
  65. * Returns void
  66. *
  67. ******************************************************************************/
  68. extern void bta_pan_co_open(uint16_t handle, uint8_t app_id,
  69. tBTA_PAN_ROLE local_role, tBTA_PAN_ROLE peer_role,
  70. const RawAddress& peer_addr);
  71. /*******************************************************************************
  72. *
  73. * Function bta_pan_co_close
  74. *
  75. * Description This function is called by PAN when a connection to a
  76. * server is closed.
  77. *
  78. *
  79. * Returns void
  80. *
  81. ******************************************************************************/
  82. extern void bta_pan_co_close(uint16_t handle, uint8_t app_id);
  83. /*******************************************************************************
  84. *
  85. * Function bta_pan_co_tx_path
  86. *
  87. * Description This function is called by PAN to transfer data on the
  88. * TX path; that is, data being sent from BTA to the phone.
  89. * This function is used when the TX data path is configured
  90. * to use the pull interface.
  91. *
  92. *
  93. * Returns void
  94. *
  95. ******************************************************************************/
  96. extern void bta_pan_co_tx_path(uint16_t handle, uint8_t app_id);
  97. /*******************************************************************************
  98. *
  99. * Function bta_pan_co_rx_path
  100. *
  101. * Description This function is called by PAN to transfer data on the
  102. * RX path; that is, data being sent from the phone to BTA.
  103. * This function is used when the RX data path is configured
  104. * to use the pull interface.
  105. *
  106. *
  107. * Returns void
  108. *
  109. ******************************************************************************/
  110. extern void bta_pan_co_rx_path(uint16_t handle, uint8_t app_id);
  111. /*******************************************************************************
  112. *
  113. * Function bta_pan_co_tx_write
  114. *
  115. * Description This function is called by PAN to send data to the phone
  116. * when the TX path is configured to use a push interface.
  117. * The implementation of this function must copy the data to
  118. * the phone's memory.
  119. *
  120. *
  121. * Returns void
  122. *
  123. ******************************************************************************/
  124. extern void bta_pan_co_tx_write(uint16_t handle, uint8_t app_id,
  125. const RawAddress& src, const RawAddress& dst,
  126. uint16_t protocol, uint8_t* p_data,
  127. uint16_t len, bool ext, bool forward);
  128. /*******************************************************************************
  129. *
  130. * Function bta_pan_co_tx_writebuf
  131. *
  132. * Description This function is called by PAN to send data to the phone
  133. * when the TX path is configured to use a push interface with
  134. * zero copy. The phone must free the buffer using function
  135. * osi_free() when it is through processing the buffer.
  136. *
  137. *
  138. * Returns void
  139. *
  140. ******************************************************************************/
  141. extern void bta_pan_co_tx_writebuf(uint16_t handle, uint8_t app_id,
  142. const RawAddress& src, const RawAddress& dst,
  143. uint16_t protocol, BT_HDR* p_buf, bool ext,
  144. bool forward);
  145. /*******************************************************************************
  146. *
  147. * Function bta_pan_co_rx_flow
  148. *
  149. * Description This function is called by PAN to enable or disable
  150. * data flow on the RX path when it is configured to use
  151. * a push interface. If data flow is disabled the phone must
  152. * not call bta_pan_ci_rx_write() or bta_pan_ci_rx_writebuf()
  153. * until data flow is enabled again.
  154. *
  155. *
  156. * Returns void
  157. *
  158. ******************************************************************************/
  159. extern void bta_pan_co_rx_flow(uint16_t handle, uint8_t app_id, bool enable);
  160. /*******************************************************************************
  161. *
  162. * Function bta_pan_co_filt_ind
  163. *
  164. * Description protocol filter indication from peer device
  165. *
  166. * Returns void
  167. *
  168. ******************************************************************************/
  169. extern void bta_pan_co_pfilt_ind(uint16_t handle, bool indication,
  170. tBTA_PAN_STATUS result, uint16_t len,
  171. uint8_t* p_filters);
  172. /*******************************************************************************
  173. *
  174. * Function bta_pan_co_mfilt_ind
  175. *
  176. * Description multicast filter indication from peer device
  177. *
  178. * Returns void
  179. *
  180. ******************************************************************************/
  181. extern void bta_pan_co_mfilt_ind(uint16_t handle, bool indication,
  182. tBTA_PAN_STATUS result, uint16_t len,
  183. uint8_t* p_filters);
  184. #endif /* BTA_PAN_CO_H */