mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-03 03:31:41 +03:00
fix(bt/bluedroid): check HFP audio status before forwarding SCO data
This commit is contained in:
@@ -964,10 +964,10 @@ bt_status_t btc_hf_ci_sco_data(void)
|
||||
bt_status_t btc_hf_ag_audio_data_send(uint16_t sync_conn_hdl, uint8_t *p_buff_start, uint8_t *p_data, uint8_t data_len)
|
||||
{
|
||||
#if (BTM_SCO_HCI_INCLUDED == TRUE) && (BTA_HFP_EXT_CODEC == TRUE)
|
||||
/* currently, sync_conn_hdl is not used */
|
||||
int idx = btc_hf_latest_connected_idx();
|
||||
CHECK_HF_SLC_CONNECTED(idx);
|
||||
if (idx != BTC_HF_INVALID_IDX) {
|
||||
|
||||
if (sync_conn_hdl != ESP_INVALID_CONN_HANDLE && hf_local_param.btc_hf_cb[idx].sync_conn_hdl == sync_conn_hdl) {
|
||||
BTA_AgAudioDataSend(hf_local_param.btc_hf_cb[idx].handle, p_buff_start, p_data, data_len);
|
||||
return BT_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -352,6 +352,19 @@ bt_status_t btc_hf_client_disconnect_audio( bt_bdaddr_t *bd_addr )
|
||||
return BT_STATUS_FAIL;
|
||||
}
|
||||
|
||||
bt_status_t btc_hf_client_audio_data_send(uint16_t sync_conn_hdl, uint8_t *p_buff_start, uint8_t *p_data, uint8_t data_len)
|
||||
{
|
||||
#if (BTM_SCO_HCI_INCLUDED == TRUE) && (BTA_HFP_EXT_CODEC == TRUE)
|
||||
CHECK_HF_CLIENT_SLC_CONNECTED();
|
||||
|
||||
if (sync_conn_hdl != ESP_INVALID_CONN_HANDLE && hf_client_local_param.btc_hf_client_cb.sync_conn_hdl == sync_conn_hdl) {
|
||||
BTA_HfClientAudioDataSend(sync_conn_hdl, p_buff_start, p_data, data_len);
|
||||
return BT_STATUS_SUCCESS;
|
||||
}
|
||||
#endif
|
||||
return BT_STATUS_FAIL;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function btc_hf_client_start_voice_recognition
|
||||
|
||||
@@ -176,6 +176,8 @@ void btc_hf_client_incoming_data_cb_to_app(const uint8_t *data, uint32_t len);
|
||||
|
||||
uint32_t btc_hf_client_outgoing_data_cb_to_app(uint8_t *data, uint32_t len);
|
||||
|
||||
bt_status_t btc_hf_client_audio_data_send(uint16_t sync_conn_hdl, uint8_t *p_buff_start, uint8_t *p_data, uint8_t data_len);
|
||||
|
||||
void btc_hf_client_get_profile_status(esp_hf_client_profile_status_t *param);
|
||||
#endif ///BTC_HF_CLIENT_INCLUDED == TRUE
|
||||
|
||||
|
||||
Reference in New Issue
Block a user