1 /****************************************************************************** 2 * 3 * Copyright (C) 2003-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 audio gateway call-out and call-in functions. 22 * 23 ******************************************************************************/ 24 #ifndef BTA_AG_CO_H 25 #define BTA_AG_CO_H 26 27 #include "bta/bta_ag_api.h" 28 #include "hci/hci_audio.h" 29 30 #if (BTA_AG_INCLUDED == TRUE) 31 #if (BTM_SCO_HCI_INCLUDED == TRUE) 32 /******************************************************************************* 33 ** 34 ** Function bta_ag_sco_audio_state 35 ** 36 ** Description This function is called by the AG before the audio connection 37 ** is brought up, after it comes up, and after it goes down. 38 ** 39 ** Parameters handle - handle of the AG instance 40 ** state - Audio state 41 ** codec - if WBS support is compiled in, codec to going to be used is provided 42 ** and when in SCO_STATE_SETUP, BTM_I2SPCMConfig() must be called with 43 ** the correct platform parameters. 44 ** in the other states codec type should not be ignored 45 ** 46 ** Returns void 47 ** 48 *******************************************************************************/ 49 #if (BTM_WBS_INCLUDED == TRUE) 50 void bta_ag_sco_audio_state(UINT16 handle, UINT8 app_id, UINT8 state, tBTA_AG_PEER_CODEC codec); 51 #else 52 void bta_ag_sco_audio_state(UINT16 handle, UINT8 app_id, UINT8 state); 53 #endif 54 55 /******************************************************************************* 56 ** 57 ** Function bta_ag_sco_co_init 58 ** 59 ** Description Set default data path for SCO/eSCO. 60 ** This callout function is executed by AG when it is 61 ** started by calling BTA_AgEnable(). This function can be 62 ** used by the phone to initialize audio paths or for other 63 ** initialization purposes. 64 ** 65 ** 66 ** Returns Void. 67 ** 68 *******************************************************************************/ 69 tBTA_HFP_SCO_ROUTE_TYPE bta_ag_sco_co_init(UINT32 rx_bw, UINT32 tx_bw, tBTA_HFP_CODEC_INFO *p_codec_info, UINT8 app_id); 70 71 /******************************************************************************* 72 ** 73 ** Function bta_ag_sco_co_open 74 ** 75 ** Description This function is executed by AG when a service level connection 76 ** is opened. 77 ** 78 ** 79 ** Returns void 80 ** 81 *******************************************************************************/ 82 void bta_ag_sco_co_open(UINT16 handle, tBTM_SCO_AIR_MODE_TYPE air_mode, UINT8 inout_pkt_size, UINT16 event); 83 84 /******************************************************************************* 85 ** 86 ** Function bta_ag_sco_co_close 87 ** 88 ** Description This function is called by AG when a service level 89 ** connection is closed. 90 ** 91 ** 92 ** Returns void 93 ** 94 *******************************************************************************/ 95 void bta_ag_sco_co_close(void); 96 97 /******************************************************************************* 98 ** 99 ** Function bta_ag_sco_co_out_data 100 ** 101 ** Description This function is called to send SCO data over HCI. 102 ** 103 ** Returns number of bytes got from application 104 ** 105 *******************************************************************************/ 106 uint32_t bta_ag_sco_co_out_data(UINT8 *p_buf); 107 108 /******************************************************************************* 109 ** 110 ** Function bta_hf_client_sco_co_in_data 111 ** 112 ** Description This function is called to send incoming SCO data to application. 113 ** 114 ** Returns void 115 ** 116 *******************************************************************************/ 117 void bta_ag_sco_co_in_data(BT_HDR *p_buf, tBTM_SCO_DATA_FLAG status); 118 119 /******************************************************************************* 120 ** 121 ** Function bta_ag_co_tx_write 122 ** 123 ** Description This function is called by the AG to send data to the 124 ** phone when the AG is configured for AT command pass-through. 125 ** The implementation of this function must copy the data to 126 ** the phones memory. 127 ** 128 ** Returns void 129 ** 130 *******************************************************************************/ 131 void bta_ag_co_tx_write(UINT16 handle, UINT8 *p_data, UINT16 len); 132 133 /******************************************************************************* 134 ** 135 ** Function bta_ag_ci_rx_write 136 ** 137 ** Description This function is called to send data to the AG when the AG 138 ** is configured for AT command pass-through. The function 139 ** copies data to an event buffer and sends it. 140 ** 141 ** Returns void 142 ** 143 *******************************************************************************/ 144 extern void bta_ag_ci_rx_write(UINT16 handle, char *p_data, UINT16 len); 145 146 /****************************************************************************** 147 ** 148 ** Function bta_ag_ci_slc_ready 149 ** 150 ** Description This function is called to notify AG that SLC is up at 151 ** the application. This funcion is only used when the app 152 ** is running in pass-through mode. 153 ** 154 ** Returns void 155 ** 156 ******************************************************************************/ 157 extern void bta_ag_ci_slc_ready(UINT16 handle); 158 159 #endif /* #if (BTM_SCO_HCI_INCLUDED == TRUE) */ 160 161 #endif /* #if (BTA_AG_INCLUDED == TRUE) */ 162 163 #endif /* BTA_AG_CO_H */ 164