kopia lustrzana https://github.com/espressif/esp-idf
BT HFP: Add AT+NREC=0 command for disabling AG echo cancellation.
rodzic
df5db07edf
commit
75578300f1
|
@ -432,6 +432,22 @@ esp_err_t esp_hf_client_request_last_voice_tag_number(void)
|
|||
return (stat == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL;
|
||||
}
|
||||
|
||||
esp_err_t esp_hf_client_send_nrec(void)
|
||||
{
|
||||
if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
|
||||
return ESP_ERR_INVALID_STATE;
|
||||
}
|
||||
|
||||
btc_msg_t msg;
|
||||
msg.sig = BTC_SIG_API_CALL;
|
||||
msg.pid = BTC_PID_HF_CLIENT;
|
||||
msg.act = BTC_HF_CLIENT_SEND_NREC_EVT;
|
||||
|
||||
/* Switch to BTC context */
|
||||
bt_status_t stat = btc_transfer_context(&msg, NULL, 0, NULL);
|
||||
return (stat == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL;
|
||||
}
|
||||
|
||||
esp_err_t esp_hf_client_register_data_callback(esp_hf_client_incoming_data_cb_t recv,
|
||||
esp_hf_client_outgoing_data_cb_t send)
|
||||
{
|
||||
|
|
|
@ -578,6 +578,20 @@ esp_err_t esp_hf_client_send_dtmf(char code);
|
|||
*/
|
||||
esp_err_t esp_hf_client_request_last_voice_tag_number(void);
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief Disable echo cancellation and noise reduction in the AG (use AT+NREC=0 command)
|
||||
* As a precondition to use this API, Service Level Connection shall exist with AG
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: NREC=0 request is sent to lower layer
|
||||
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
* - ESP_FAIL: others
|
||||
*
|
||||
*/
|
||||
esp_err_t esp_hf_client_send_nrec(void);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Register HFP client data output function; the callback is only used in
|
||||
* the case that Voice Over HCI is enabled.
|
||||
|
|
|
@ -630,6 +630,27 @@ static bt_status_t btc_hf_client_request_last_voice_tag_number(void)
|
|||
return BT_STATUS_UNSUPPORTED;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function btc_hf_client_send_nrec
|
||||
**
|
||||
** Description Request AG to disable echo cancellation & noise reduction
|
||||
**
|
||||
** Returns bt_status_t
|
||||
**
|
||||
*******************************************************************************/
|
||||
static bt_status_t btc_hf_client_send_nrec(void)
|
||||
{
|
||||
CHECK_HF_CLIENT_SLC_CONNECTED();
|
||||
|
||||
if (hf_client_local_param.btc_hf_client_cb.peer_feat & BTA_HF_CLIENT_PEER_FEAT_ECNR)
|
||||
{
|
||||
BTA_HfClientSendAT(hf_client_local_param.btc_hf_client_cb.handle, BTA_HF_CLIENT_AT_CMD_NREC, 0, 0, NULL);
|
||||
return BT_STATUS_SUCCESS;
|
||||
}
|
||||
return BT_STATUS_UNSUPPORTED;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function bte_hf_client_evt
|
||||
|
@ -1073,6 +1094,9 @@ void btc_hf_client_call_handler(btc_msg_t *msg)
|
|||
case BTC_HF_CLIENT_REGISTER_DATA_CALLBACK_EVT:
|
||||
btc_hf_client_reg_data_cb(arg->reg_data_cb.recv, arg->reg_data_cb.send);
|
||||
break;
|
||||
case BTC_HF_CLIENT_SEND_NREC_EVT:
|
||||
btc_hf_client_send_nrec();
|
||||
break;
|
||||
default:
|
||||
BTC_TRACE_WARNING("%s : unhandled event: %d\n", __FUNCTION__, msg->act);
|
||||
}
|
||||
|
|
|
@ -57,6 +57,7 @@ typedef enum {
|
|||
BTC_HF_CLIENT_SEND_DTMF_EVT,
|
||||
BTC_HF_CLIENT_REQUEST_LAST_VOICE_TAG_NUMBER_EVT,
|
||||
BTC_HF_CLIENT_REGISTER_DATA_CALLBACK_EVT,
|
||||
BTC_HF_CLIENT_SEND_NREC_EVT,
|
||||
} btc_hf_client_act_t;
|
||||
|
||||
/* btc_hf_client_args_t */
|
||||
|
|
Ładowanie…
Reference in New Issue