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