1 /****************************************************************************** 2 * 3 * Copyright (C) 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 * 21 * This is the interface file for data gateway call-out functions. 22 * 23 ******************************************************************************/ 24 #ifndef BTA_PAN_CO_H 25 #define BTA_PAN_CO_H 26 27 #include "bta_pan_api.h" 28 29 /***************************************************************************** 30 * Constants 31 ****************************************************************************/ 32 33 /* BT_HDR buffer offset */ 34 #define BTA_PAN_MIN_OFFSET PAN_MINIMUM_OFFSET 35 36 /* Data Flow Mask */ 37 #define BTA_PAN_RX_PUSH 0x00 /* RX push. */ 38 #define BTA_PAN_RX_PUSH_BUF 0x01 /* RX push with zero copy. */ 39 #define BTA_PAN_RX_PULL 0x02 /* RX pull. */ 40 #define BTA_PAN_TX_PUSH 0x00 /* TX push. */ 41 #define BTA_PAN_TX_PUSH_BUF 0x10 /* TX push with zero copy. */ 42 #define BTA_PAN_TX_PULL 0x20 /* TX pull. */ 43 44 /***************************************************************************** 45 * Function Declarations 46 ****************************************************************************/ 47 48 /******************************************************************************* 49 * 50 * Function bta_pan_co_init 51 * 52 * Description This callout function is executed by PAN when a server is 53 * started by calling BTA_PanEnable(). This function can be 54 * used by the phone to initialize data paths or for other 55 * initialization purposes. The function must return the 56 * data flow mask as described below. 57 * 58 * 59 * Returns Data flow mask. 60 * 61 ******************************************************************************/ 62 extern uint8_t bta_pan_co_init(uint8_t* q_level); 63 64 /******************************************************************************* 65 * 66 * Function bta_pan_co_open 67 * 68 * Description This function is executed by PAN when a connection 69 * is opened. The phone can use this function to set 70 * up data paths or perform any required initialization. 71 * 72 * 73 * Returns void 74 * 75 ******************************************************************************/ 76 extern void bta_pan_co_open(uint16_t handle, uint8_t app_id, 77 tBTA_PAN_ROLE local_role, tBTA_PAN_ROLE peer_role, 78 BD_ADDR peer_addr); 79 80 /******************************************************************************* 81 * 82 * Function bta_pan_co_close 83 * 84 * Description This function is called by PAN when a connection to a 85 * server is closed. 86 * 87 * 88 * Returns void 89 * 90 ******************************************************************************/ 91 extern void bta_pan_co_close(uint16_t handle, uint8_t app_id); 92 93 /******************************************************************************* 94 * 95 * Function bta_pan_co_tx_path 96 * 97 * Description This function is called by PAN to transfer data on the 98 * TX path; that is, data being sent from BTA to the phone. 99 * This function is used when the TX data path is configured 100 * to use the pull interface. 101 * 102 * 103 * Returns void 104 * 105 ******************************************************************************/ 106 extern void bta_pan_co_tx_path(uint16_t handle, uint8_t app_id); 107 108 /******************************************************************************* 109 * 110 * Function bta_pan_co_rx_path 111 * 112 * Description This function is called by PAN to transfer data on the 113 * RX path; that is, data being sent from the phone to BTA. 114 * This function is used when the RX data path is configured 115 * to use the pull interface. 116 * 117 * 118 * Returns void 119 * 120 ******************************************************************************/ 121 extern void bta_pan_co_rx_path(uint16_t handle, uint8_t app_id); 122 123 /******************************************************************************* 124 * 125 * Function bta_pan_co_tx_write 126 * 127 * Description This function is called by PAN to send data to the phone 128 * when the TX path is configured to use a push interface. 129 * The implementation of this function must copy the data to 130 * the phone's memory. 131 * 132 * 133 * Returns void 134 * 135 ******************************************************************************/ 136 extern void bta_pan_co_tx_write(uint16_t handle, uint8_t app_id, BD_ADDR src, 137 BD_ADDR dst, uint16_t protocol, uint8_t* p_data, 138 uint16_t len, bool ext, bool forward); 139 140 /******************************************************************************* 141 * 142 * Function bta_pan_co_tx_writebuf 143 * 144 * Description This function is called by PAN to send data to the phone 145 * when the TX path is configured to use a push interface with 146 * zero copy. The phone must free the buffer using function 147 * osi_free() when it is through processing the buffer. 148 * 149 * 150 * Returns void 151 * 152 ******************************************************************************/ 153 extern void bta_pan_co_tx_writebuf(uint16_t handle, uint8_t app_id, BD_ADDR src, 154 BD_ADDR dst, uint16_t protocol, 155 BT_HDR* p_buf, bool ext, bool forward); 156 157 /******************************************************************************* 158 * 159 * Function bta_pan_co_rx_flow 160 * 161 * Description This function is called by PAN to enable or disable 162 * data flow on the RX path when it is configured to use 163 * a push interface. If data flow is disabled the phone must 164 * not call bta_pan_ci_rx_write() or bta_pan_ci_rx_writebuf() 165 * until data flow is enabled again. 166 * 167 * 168 * Returns void 169 * 170 ******************************************************************************/ 171 extern void bta_pan_co_rx_flow(uint16_t handle, uint8_t app_id, bool enable); 172 173 /******************************************************************************* 174 * 175 * Function bta_pan_co_filt_ind 176 * 177 * Description protocol filter indication from peer device 178 * 179 * Returns void 180 * 181 ******************************************************************************/ 182 extern void bta_pan_co_pfilt_ind(uint16_t handle, bool indication, 183 tBTA_PAN_STATUS result, uint16_t len, 184 uint8_t* p_filters); 185 186 /******************************************************************************* 187 * 188 * Function bta_pan_co_mfilt_ind 189 * 190 * Description multicast filter indication from peer device 191 * 192 * Returns void 193 * 194 ******************************************************************************/ 195 extern void bta_pan_co_mfilt_ind(uint16_t handle, bool indication, 196 tBTA_PAN_STATUS result, uint16_t len, 197 uint8_t* p_filters); 198 199 #endif /* BTA_PAN_CO_H */ 200