mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
Merge branch 'bugfix/hfp_ag' into 'master'
component bt/ Bugfix for hfp ag See merge request espressif/esp-idf!6742
This commit is contained in:
commit
1fbeb8c9a4
@ -49,10 +49,11 @@ typedef enum
|
||||
{
|
||||
ESP_HF_CONNECTION_STATE_EVT = 0, /*!< Connection state changed event */
|
||||
ESP_HF_AUDIO_STATE_EVT, /*!< Audio connection state change event */
|
||||
ESP_HF_BVRA_EVT, /*!< Voice recognition state change event */
|
||||
ESP_HF_BVRA_RESPONSE_EVT, /*!< Voice recognition state change event */
|
||||
ESP_HF_VOLUME_CONTROL_EVT, /*!< Audio volume control command from HF Client, provided by +VGM or +VGS message */
|
||||
|
||||
ESP_HF_UNAT_RESPONSE_EVT, /*!< Unknown AT cmd Response*/
|
||||
ESP_HF_IND_UPDATE_EVT, /*!< Indicator Update Event*/
|
||||
ESP_HF_CIND_RESPONSE_EVT, /*!< Call And Device Indicator Response*/
|
||||
ESP_HF_COPS_RESPONSE_EVT, /*!< Current operator information */
|
||||
ESP_HF_CLCC_RESPONSE_EVT, /*!< List of current calls notification */
|
||||
@ -67,7 +68,7 @@ typedef enum
|
||||
ESP_HF_BCS_RESPONSE_EVT, /*!< Codec Negotiation */
|
||||
} esp_hf_cb_event_t;
|
||||
|
||||
// HF callback parameters of corresponding esp event in esp_hf_cb_event_t
|
||||
/// HFP AG callback parameters
|
||||
typedef union
|
||||
{
|
||||
/**
|
||||
@ -75,98 +76,85 @@ typedef union
|
||||
*/
|
||||
struct hf_conn_stat_param {
|
||||
esp_bd_addr_t remote_bda; /*!< remote bluetooth device address */
|
||||
esp_hf_connection_state_t state; /*!< HF connection state */
|
||||
uint32_t peer_feat; /*!< AG supported features */
|
||||
esp_hf_connection_state_t state; /*!< Connection state */
|
||||
uint32_t peer_feat; /*!< HF supported features */
|
||||
uint32_t chld_feat; /*!< AG supported features on call hold and multiparty services */
|
||||
} conn_stat; /*!< AG callback param of ESP_AG_CONNECTION_STATE_EVT */
|
||||
} conn_stat; /*!< AG callback param of ESP_HF_CONNECTION_STATE_EVT */
|
||||
|
||||
/**
|
||||
* @brief ESP_HF_AUDIO_STATE_EVT
|
||||
*/
|
||||
struct hf_audio_stat_param {
|
||||
esp_bd_addr_t remote_addr; /*!< remote bluetooth device address */
|
||||
esp_bd_addr_t remote_addr; /*!< remote bluetooth device address */
|
||||
esp_hf_audio_state_t state; /*!< audio connection state */
|
||||
} audio_stat; /*!< AG callback param of ESP_AG_AUDIO_STATE_EVT */
|
||||
} audio_stat; /*!< AG callback param of ESP_HF_AUDIO_STATE_EVT */
|
||||
|
||||
/**
|
||||
* @brief ESP_HF_BVRA_EVT
|
||||
* @brief ESP_HF_BVRA_RESPONSE_EVT
|
||||
*/
|
||||
struct hf_bvra_param {
|
||||
esp_bd_addr_t remote_addr;
|
||||
struct hf_vra_rep_param {
|
||||
esp_bd_addr_t remote_addr; /*!< remote bluetooth device address */
|
||||
esp_hf_vr_state_t value; /*!< voice recognition state */
|
||||
} vra_rep; /*!< AG callback param of ESP_AG_BVRA_EVT */
|
||||
} vra_rep; /*!< AG callback param of ESP_HF_BVRA_RESPONSE_EVT */
|
||||
|
||||
/**
|
||||
* @brief ESP_HF_VOLUME_CONTROL_EVT
|
||||
*/
|
||||
struct hf_volume_control_param {
|
||||
esp_hf_volume_type_t type; /*!< volume control target, speaker or microphone */
|
||||
int volume; /*!< gain, ranges from 0 to 15 */
|
||||
} volume_control; /*!< AG callback param of ESP_AG_VOLUME_CONTROL_EVT */
|
||||
esp_hf_volume_type_t type; /*!< volume control target, speaker or microphone */
|
||||
int volume; /*!< gain, ranges from 0 to 15 */
|
||||
} volume_control; /*!< AG callback param of ESP_HF_VOLUME_CONTROL_EVT */
|
||||
|
||||
/**
|
||||
* @brief ESP_HF_UNAT_RESPOSNE_EVT
|
||||
*/
|
||||
struct hf_unat_param {
|
||||
char *unat;
|
||||
}unat_rep;
|
||||
struct hf_unat_rep_param {
|
||||
char *unat; /*!< unknown AT command string */
|
||||
}unat_rep; /*!< AG callback param of ESP_HF_UNAT_RESPONSE_EVT */
|
||||
|
||||
/**
|
||||
* @brief ESP_HF_AT_RESPONSE_EVT
|
||||
*/
|
||||
struct hf_at_code_param {
|
||||
esp_hf_at_response_code_t code; /*!< AT response code */
|
||||
esp_hf_cme_err_t cme; /*!< Extended Audio Gateway Error Result Code */
|
||||
} at; /*!< AG callback param of ESP_HF_EXT_AT_EVT */
|
||||
|
||||
/**
|
||||
* @brief ESP_HF_CIND_CALL_EVT
|
||||
* @brief ESP_HF_CIND_RESPONSE_EVT
|
||||
*/
|
||||
struct hf_cind_param {
|
||||
esp_hf_call_status_t call_status; /*!< call status indicator */
|
||||
esp_hf_call_setup_status_t call_setup_status; /*!< call setup status indicator */
|
||||
esp_hf_network_state_t svc; /*!< bluetooth proprietary call hold status indicator */
|
||||
esp_hf_network_state_t svc; /*!< bluetooth proprietary call hold status indicator */
|
||||
int signal_strength; /*!< bluetooth proprietary call hold status indicator */
|
||||
esp_hf_roaming_status_t roam; /*!< bluetooth proprietary call hold status indicator */
|
||||
int battery_level; /*!< battery charge value, ranges from 0 to 5 */
|
||||
esp_hf_call_held_status_t call_held_status; /*!< bluetooth proprietary call hold status indicator */
|
||||
} cind;
|
||||
} cind; /*!< AG callback param of ESP_HF_CIND_RESPONSE_EVT */
|
||||
|
||||
/**
|
||||
* @brief ESP_HF_DIAL_EVT
|
||||
*/
|
||||
struct hf_out_call_param {
|
||||
esp_bd_addr_t remote_addr; /*!< remote bluetooth device address */
|
||||
char *num_or_loc; /*!< location in phone memory */
|
||||
} out_call; /*!< AG callback param of ESP_HF_DIAL_EVT */
|
||||
|
||||
/**
|
||||
* @brief ESP_HF_VTS_RESPOSNE_EVT
|
||||
*/
|
||||
struct hf_vts_param {
|
||||
char *code;
|
||||
}vts_rep;
|
||||
struct hf_vts_rep_param {
|
||||
char *code; /*!< MTF code from HF Client */
|
||||
}vts_rep; /*!< AG callback param of ESP_HF_VTS_RESPONSE_EVT */
|
||||
|
||||
/**
|
||||
* @brief ESP_HF_NREC_RESPOSNE_EVT
|
||||
*/
|
||||
struct hf_nrec_param {
|
||||
esp_hf_nrec_t state;
|
||||
} nrec;
|
||||
|
||||
struct hf_outcall_param {
|
||||
esp_bd_addr_t remote_addr;
|
||||
char *num_or_loc;
|
||||
} out_call;
|
||||
|
||||
/**
|
||||
* @brief ESP_HF_BSIR_EVT
|
||||
*/
|
||||
struct hf_bsir_param {
|
||||
esp_bd_addr_t remote_addr;
|
||||
esp_hf_in_band_ring_state_t state; /*!< setting state of in-band ring tone */
|
||||
} bsir;
|
||||
esp_hf_nrec_t state; /*!< NREC enabled or disabled */
|
||||
} nrec; /*!< AG callback param of ESP_HF_NREC_RESPONSE_EVT */
|
||||
|
||||
/**
|
||||
* @brief ESP_HF_BCS_RESPONSE_EVT
|
||||
*/
|
||||
struct hf_codec_param {
|
||||
esp_hf_wbs_config_t mode;
|
||||
} codec;
|
||||
esp_hf_wbs_config_t mode; /*!< codec mode CVSD or mSBC */
|
||||
} codec; /*!< AG callback param of ESP_HF_BAC_RESPONSE_EVT */
|
||||
|
||||
} esp_hf_cb_param_t;
|
||||
} esp_hf_cb_param_t; /*!< HFP AG callback param compound*/
|
||||
|
||||
/**
|
||||
* @brief AG incoming data callback function, the callback is useful in case of
|
||||
@ -206,8 +194,8 @@ typedef void (* esp_hf_cb_t) (esp_hf_cb_event_t event, esp_hf_cb_param_t *param)
|
||||
** ESP HF API
|
||||
************************************************************************************/
|
||||
/**
|
||||
* @brief Register application callback function to HFP client module. This function should be called
|
||||
* only after esp_bluedroid_enable() completes successfully, used by HFP client
|
||||
* @brief Register application callback function to HFP AG module. This function should be called
|
||||
* only after esp_bluedroid_enable() completes successfully, used by HFP AG
|
||||
*
|
||||
* @param[in] callback: HFP AG event callback function
|
||||
*
|
||||
@ -224,6 +212,7 @@ esp_err_t esp_bt_hf_register_callback(esp_hf_cb_t callback);
|
||||
* @brief Initialize the bluetooth HF AG module. This function should be called
|
||||
* after esp_bluedroid_enable() completes successfully
|
||||
*
|
||||
* @param[in] remote_addr: remote bluetooth device address
|
||||
* @return
|
||||
* - ESP_OK: if the initialization request is sent successfully
|
||||
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
@ -237,6 +226,7 @@ esp_err_t esp_bt_hf_init(esp_bd_addr_t remote_addr);
|
||||
* @brief De-initialize for HF AG module. This function
|
||||
* should be called only after esp_bluedroid_enable() completes successfully
|
||||
*
|
||||
* @param[in] remote_addr: remote bluetooth device address
|
||||
* @return
|
||||
* - ESP_OK: success
|
||||
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
@ -304,8 +294,8 @@ esp_err_t esp_bt_hf_disconnect_audio(esp_bd_addr_t remote_bda);
|
||||
* @brief Response of Volume Recognition Command(AT+VRA) from HFP client. As a precondition to use this API,
|
||||
* Service Level Connection shall exist with HFP client.
|
||||
*
|
||||
* @param[in] remote: volume control target, speaker or microphone
|
||||
* @param[in] volume: gain of the speaker of microphone, ranges 0 to 15
|
||||
* @param[in] remote_bda: volume control target, speaker or microphone
|
||||
* @param[in] value: gain of the speaker of microphone, ranges 0 to 15
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: disconnect request is sent to lower layer
|
||||
@ -318,8 +308,9 @@ esp_err_t esp_bt_hf_vra(esp_bd_addr_t remote_bda, esp_hf_vr_state_t value);
|
||||
/**
|
||||
*
|
||||
* @brief Volume synchronization with HFP client. As a precondition to use this API,
|
||||
* Service Level Connection shall exist with HFP client
|
||||
* Service Level Connection shall exist with HFP client.
|
||||
*
|
||||
* @param[in] remote_bda: remote bluetooth device address
|
||||
* @param[in] type: volume control target, speaker or microphone
|
||||
* @param[in] volume: gain of the speaker of microphone, ranges 0 to 15
|
||||
*
|
||||
@ -334,8 +325,10 @@ esp_err_t esp_bt_hf_volume_control(esp_bd_addr_t remote_bda, esp_hf_volume_contr
|
||||
/**
|
||||
*
|
||||
* @brief Handle Unknown AT command from HFP Client.
|
||||
* As a precondition to use this API, Service Level Connection shall exist between AG and HF Client
|
||||
* As a precondition to use this API, Service Level Connection shall exist between AG and HF Client.
|
||||
*
|
||||
* @param[in] remote_addr: remote bluetooth device address
|
||||
* @param[in] unat: AT command string from HF Client
|
||||
* @return
|
||||
* - ESP_OK: disconnect request is sent to lower layer
|
||||
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
@ -347,8 +340,11 @@ esp_err_t esp_hf_unat_response(esp_bd_addr_t remote_addr, char *unat);
|
||||
/**
|
||||
*
|
||||
* @brief Unsolicited send extend AT error code to HFP Client.
|
||||
* As a precondition to use this API, Service Level Connection shall exist between AG and HF Client
|
||||
* As a precondition to use this API, Service Level Connection shall exist between AG and HF Client.
|
||||
*
|
||||
* @param[in] remote_bda: remote bluetooth device address
|
||||
* @param[in] response_code: AT command response code
|
||||
* @param[in] error_code: CME error code
|
||||
* @return
|
||||
* - ESP_OK: disconnect request is sent to lower layer
|
||||
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
@ -362,6 +358,11 @@ esp_err_t esp_bt_hf_cmee_response(esp_bd_addr_t remote_bda, esp_hf_at_response_c
|
||||
* @brief Usolicited send device status notificationto HFP Client.
|
||||
* As a precondition to use this API, Service Level Connection shall exist between AG and HF Client
|
||||
*
|
||||
* @param[in] remote_addr: remote bluetooth device address
|
||||
* @param[in] call_state: call state
|
||||
* @param[in] call_setup_state: call setup state
|
||||
* @param[in] ntk_state: network service state
|
||||
* @param[in] signal: signal strength from 0 to 5
|
||||
* @return
|
||||
* - ESP_OK: disconnect request is sent to lower layer
|
||||
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
@ -377,6 +378,14 @@ esp_err_t esp_bt_hf_indchange_notification(esp_bd_addr_t remote_addr, esp_hf_cal
|
||||
* @brief Response to device individual indicatiors to HFP Client.
|
||||
* As a precondition to use this API, Service Level Connection shall exist between AG and HF Client.
|
||||
*
|
||||
* @param[in] remote_addr: remote bluetooth device address
|
||||
* @param[in] call_state: call state
|
||||
* @param[in] call_setup_state: call setup state
|
||||
* @param[in] ntk_state: network service state
|
||||
* @param[in] signal: signal strength from 0 to 5
|
||||
* @param[in] roam: roam state
|
||||
* @param[in] batt_lev: batery level from 0 to 5
|
||||
* @param[in] call_held_status: call held status
|
||||
* @return
|
||||
* - ESP_OK: disconnect request is sent to lower layer
|
||||
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
@ -391,9 +400,11 @@ esp_err_t esp_bt_hf_cind_response(esp_bd_addr_t remote_addr,
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief Query the name of currently selected network operator in AG,
|
||||
* As a precondition to use this API, Service Level Connection shall exist with HFP Client
|
||||
* @brief Reponse for AT+COPS command from HF Client.
|
||||
* As a precondition to use this API, Service Level Connection shall exist with HFP Client.
|
||||
*
|
||||
* @param[in] remote_addr: remote bluetooth device address
|
||||
* @param[in] name: current operator name
|
||||
* @return
|
||||
* - ESP_OK: disconnect request is sent to lower layer
|
||||
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
@ -404,9 +415,17 @@ esp_err_t esp_bt_hf_cops_response(esp_bd_addr_t remote_addr, char *name);
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief Response to Query list of current calls from HFP Client (use AT+CLCC command),
|
||||
* As a precondition to use this API, Service Level Connection shall exist between AG and HF Client
|
||||
* @brief Response to AT+CLCC command from HFP Client.
|
||||
* As a precondition to use this API, Service Level Connection shall exist between AG and HF Client.
|
||||
*
|
||||
* @param[in] remote_addr: remote bluetooth device address
|
||||
* @param[in] index: the index of current call
|
||||
* @param[in] dir: call direction (incoming/outgoing)
|
||||
* @param[in] current_call_state: current call state
|
||||
* @param[in] mode: current call mode (voice/data/fax)
|
||||
* @param[in] mpty: single or multi type
|
||||
* @param[in] number: current call number
|
||||
* @param[in] type: international type or unknow
|
||||
* @return
|
||||
* - ESP_OK: disconnect request is sent to lower layer
|
||||
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
@ -419,9 +438,12 @@ esp_err_t esp_bt_hf_clcc_response(esp_bd_addr_t remote_addr, int index, esp_hf_c
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief Get subscriber information number from HFP client(send AT+CNUM command),
|
||||
* As a precondition to use this API, Service Level Connection shall exist with AG
|
||||
* @brief Response for AT+CNUM command from HF Client.
|
||||
* As a precondition to use this API, Service Level Connection shall exist with AG.
|
||||
*
|
||||
* @param[in] remote_addr: remote bluetooth device address
|
||||
* @param[in] number: registration number
|
||||
* @param[in] type: service type (unknown/voice/fax)
|
||||
* @return
|
||||
* - ESP_OK: disconnect request is sent to lower layer
|
||||
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
@ -432,9 +454,11 @@ esp_err_t esp_bt_hf_cnum_response(esp_bd_addr_t remote_addr, char *number, esp_h
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief Inform HF Client of Provided or not Inband Ring Tone.
|
||||
* As a precondition to use this API, Service Level Connection shall exist with AG
|
||||
* @brief Inform HF Client that AG Provided in-band ring tone or not.
|
||||
* As a precondition to use this API, Service Level Connection shall exist with AG.
|
||||
*
|
||||
* @param[in] remote_addr: remote bluetooth device address
|
||||
* @param[in] state: in-band ring tone state
|
||||
* @return
|
||||
* - ESP_OK: disconnect request is sent to lower layer
|
||||
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
@ -445,9 +469,16 @@ esp_err_t esp_bt_hf_bsir(esp_bd_addr_t remote_addr, esp_hf_in_band_ring_state_t
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief Answer Incoming Call by AG or response to the AT+A command from Hands-Free Unit.
|
||||
* @brief Answer Incoming Call from AG.
|
||||
* As a precondition to use this API, Service Level Connection shall exist with AG.
|
||||
*
|
||||
* @param[in] remote_addr: remote bluetooth device address
|
||||
* @param[in] num_active: the number of active call
|
||||
* @param[in] num_held: the number of held call
|
||||
* @param[in] call_state: call state
|
||||
* @param[in] call_setup_state: call setup state
|
||||
* @param[in] number: number of the incoming call
|
||||
* @param[in] call_addr_type: call address type
|
||||
* @return
|
||||
* - ESP_OK: disconnect request is sent to lower layer
|
||||
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
@ -460,9 +491,16 @@ esp_err_t esp_bt_hf_answer_call(esp_bd_addr_t remote_addr, int num_active, int n
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief Reject Incoming Call by AG or response to the AT+CHUP command from Hands-Free Unit.
|
||||
* @brief Reject Incoming Call from AG.
|
||||
* As a precondition to use this API, Service Level Connection shall exist with AG.
|
||||
*
|
||||
* @param[in] remote_addr: remote bluetooth device address
|
||||
* @param[in] num_active: the number of active call
|
||||
* @param[in] num_held: the number of held call
|
||||
* @param[in] call_state: call state
|
||||
* @param[in] call_setup_state: call setup state
|
||||
* @param[in] number: number of the incoming call
|
||||
* @param[in] call_addr_type: call address type
|
||||
* @return
|
||||
* - ESP_OK: disconnect request is sent to lower layer
|
||||
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
@ -475,9 +513,16 @@ esp_err_t esp_bt_hf_reject_call(esp_bd_addr_t remote_addr, int num_active, int n
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief Reject Incoming Call by AG or response to the AT+CHUP command from Hands-Free Unit.
|
||||
* @brief Reject incoming call from AG.
|
||||
* As a precondition to use this API, Service Level Connection shall exist with AG.
|
||||
*
|
||||
* @param[in] remote_addr: remote bluetooth device address
|
||||
* @param[in] num_active: the number of active call
|
||||
* @param[in] num_held: the number of held call
|
||||
* @param[in] call_state: call state
|
||||
* @param[in] call_setup_state: call setup state
|
||||
* @param[in] number: number of the outgoing call
|
||||
* @param[in] call_addr_type: call address type
|
||||
* @return
|
||||
* - ESP_OK: disconnect request is sent to lower layer
|
||||
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
@ -490,9 +535,16 @@ esp_err_t esp_bt_hf_out_call(esp_bd_addr_t remote_addr, int num_active, int num_
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief Reject Incoming Call by AG or response to the AT+CHUP command from Hands-Free Unit.
|
||||
* @brief End an ongoing call.
|
||||
* As a precondition to use this API, Service Level Connection shall exist with AG.
|
||||
*
|
||||
* @param[in] remote_addr: remote bluetooth device address
|
||||
* @param[in] num_active: the number of active call
|
||||
* @param[in] num_held: the number of held call
|
||||
* @param[in] call_state: call state
|
||||
* @param[in] call_setup_state: call setup state
|
||||
* @param[in] number: number of the call
|
||||
* @param[in] call_addr_type: call address type
|
||||
* @return
|
||||
* - ESP_OK: disconnect request is sent to lower layer
|
||||
* - ESP_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||
|
@ -398,8 +398,9 @@ void bta_ag_rfc_close(tBTA_AG_SCB *p_scb, tBTA_AG_DATA *p_data)
|
||||
bta_sys_conn_close(BTA_ID_AG, p_scb->app_id, p_scb->peer_addr);
|
||||
|
||||
/* call close call-out */
|
||||
// bta_ag_sco_co_close(close.hdr.handle);
|
||||
#if (BTM_SCO_HCI_INCLUDED == TRUE)
|
||||
bta_ag_sco_co_close();
|
||||
#endif
|
||||
/* call close cback */
|
||||
(*bta_ag_cb.p_cback)(BTA_AG_CLOSE_EVT, (tBTA_AG *) &close);
|
||||
|
||||
@ -463,7 +464,9 @@ void bta_ag_rfc_open(tBTA_AG_SCB *p_scb, tBTA_AG_DATA *p_data)
|
||||
bta_ag_at_init(&p_scb->at_cb);
|
||||
|
||||
/* call app open call-out */
|
||||
#if (BTM_SCO_HCI_INCLUDED == TRUE)
|
||||
bta_ag_sco_co_open(bta_ag_scb_to_idx(p_scb), p_scb->air_mode, BTA_HFP_SCO_OUT_PKT_SIZE, bta_ag_svc_id[p_scb->conn_service]);
|
||||
#endif
|
||||
bta_sys_conn_open(BTA_ID_AG, p_scb->app_id, p_scb->peer_addr);
|
||||
bta_ag_cback_open(p_scb, NULL, BTA_AG_SUCCESS);
|
||||
|
||||
|
@ -262,8 +262,6 @@ void BTA_AgResult(UINT16 handle, tBTA_AG_RES result, tBTA_AG_RES_DATA *p_data)
|
||||
{
|
||||
tBTA_AG_API_RESULT *p_buf;
|
||||
|
||||
// printf("BTA_AgReslut: %d\n",result);
|
||||
|
||||
if ((p_buf = (tBTA_AG_API_RESULT *) osi_malloc(sizeof(tBTA_AG_API_RESULT))) != NULL) {
|
||||
p_buf->hdr.event = BTA_AG_API_RESULT_EVT;
|
||||
p_buf->hdr.layer_specific = handle;
|
||||
|
@ -991,6 +991,8 @@ void bta_ag_at_hfp_cback(tBTA_AG_SCB *p_scb, UINT16 cmd, UINT8 arg_type,
|
||||
if (!(p_scb->features & BTA_AG_FEAT_VREC)) {
|
||||
event = 0;
|
||||
bta_ag_send_error(p_scb, BTA_AG_ERR_OP_NOT_SUPPORTED);
|
||||
} else {
|
||||
bta_ag_send_ok(p_scb);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -1536,6 +1538,12 @@ void bta_ag_hfp_result(tBTA_AG_SCB *p_scb, tBTA_AG_API_RESULT *p_result)
|
||||
|
||||
case BTA_AG_BVRA_RES:
|
||||
bta_ag_send_result(p_scb, code, NULL, p_result->data.state);
|
||||
if (p_result->data.ok_flag!= BTA_AG_OK_ERROR)
|
||||
{
|
||||
bta_ag_send_ok(p_scb);
|
||||
} else {
|
||||
bta_ag_send_error(p_scb, p_result->data.errcode);
|
||||
}
|
||||
break;
|
||||
|
||||
case BTA_AG_BTRH_RES: // Not supported yet
|
||||
|
@ -24,6 +24,7 @@
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include "bta_ag_int.h"
|
||||
#include "bta/bta_api.h"
|
||||
#include "bta/bta_sys.h"
|
||||
#include "bta/bta_ag_api.h"
|
||||
@ -32,7 +33,6 @@
|
||||
#include "common/bt_defs.h"
|
||||
#include "common/bt_trace.h"
|
||||
#include "osi/allocator.h"
|
||||
#include "bta_ag_int.h"
|
||||
|
||||
#if (BTA_AG_INCLUDED == TRUE)
|
||||
/*****************************************************************************
|
||||
@ -272,7 +272,7 @@ const tBTA_AG_ST_TBL bta_ag_st_tbl[] =
|
||||
/*****************************************************************************
|
||||
** Global data
|
||||
*****************************************************************************/
|
||||
const char *bta_ag_version = "1.5"; //"1.6"
|
||||
const char *bta_ag_version = "1.6";
|
||||
/* AG control block */
|
||||
#if BTA_DYNAMIC_MEMORY == FALSE
|
||||
tBTA_AG_CB bta_ag_cb;
|
||||
|
@ -188,7 +188,9 @@ static int bta_ag_data_cback(UINT16 port_handle, void *p_data, UINT16 len, UINT1
|
||||
UNUSED(port_handle);
|
||||
|
||||
/* call data call-out directly */
|
||||
#if (BTM_SCO_HCI_INCLUDED == TRUE)
|
||||
bta_ag_co_tx_write(handle, (UINT8 *) p_data, len);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -66,9 +66,7 @@ enum
|
||||
BTA_AG_SCO_SHUTDOWN_E, /* shutdown request */
|
||||
BTA_AG_SCO_CONN_OPEN_E, /* sco open */
|
||||
BTA_AG_SCO_CONN_CLOSE_E, /* sco closed */
|
||||
#if (BTM_SCO_HCI_INCLUDED == TRUE)
|
||||
BTA_AG_SCO_CI_DATA_E /* SCO data ready */
|
||||
#endif
|
||||
};
|
||||
|
||||
#if (BTM_WBS_INCLUDED == TRUE )
|
||||
@ -323,7 +321,6 @@ static void bta_ag_sco_read_cback(UINT16 sco_inx, BT_HDR *p_data, tBTM_SCO_DATA_
|
||||
|
||||
/* Callout function must free the data. */
|
||||
bta_ag_sco_co_in_data(p_data, status);
|
||||
osi_free(p_data);
|
||||
}
|
||||
#endif
|
||||
/*******************************************************************************
|
||||
@ -579,6 +576,7 @@ static void bta_ag_create_sco(tBTA_AG_SCB *p_scb, BOOLEAN is_orig)
|
||||
/* tell sys to stop av if any */
|
||||
bta_sys_sco_use(BTA_ID_AG, p_scb->app_id, p_scb->peer_addr);
|
||||
|
||||
#if (BTM_SCO_HCI_INCLUDED == TRUE)
|
||||
#if (BTM_WBS_INCLUDED == TRUE)
|
||||
/* Allow any platform specific pre-SCO set up to take place */
|
||||
bta_ag_sco_audio_state(bta_ag_scb_to_idx(p_scb), p_scb->app_id, SCO_STATE_SETUP, esco_codec);
|
||||
@ -595,6 +593,7 @@ static void bta_ag_create_sco(tBTA_AG_SCB *p_scb, BOOLEAN is_orig)
|
||||
/* Allow any platform specific pre-SCO set up to take place */
|
||||
bta_ag_sco_audio_state(bta_ag_scb_to_idx(p_scb), p_scb->app_id, SCO_STATE_SETUP);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if (BTM_SCO_HCI_INCLUDED == TRUE)
|
||||
#if (BTM_WBS_INCLUDED == TRUE)
|
||||
@ -735,10 +734,7 @@ void bta_ag_codec_negotiate(tBTA_AG_SCB *p_scb)
|
||||
*******************************************************************************/
|
||||
static void bta_ag_sco_event(tBTA_AG_SCB *p_scb, UINT8 event)
|
||||
{
|
||||
#if (BTM_SCO_HCI_INCLUDED == TRUE)
|
||||
tBTA_AG_SCO_CB *p_sco = &bta_ag_cb.sco;
|
||||
BT_HDR *p_buf;
|
||||
#endif
|
||||
#if (BTM_WBS_INCLUDED == TRUE)
|
||||
tBTA_AG_SCB *p_cn_scb = NULL; /* For codec negotiation */
|
||||
#endif
|
||||
@ -748,6 +744,7 @@ static void bta_ag_sco_event(tBTA_AG_SCB *p_scb, UINT8 event)
|
||||
bta_ag_sco_state_str(p_sco->state), event, bta_ag_sco_evt_str(event));
|
||||
|
||||
#if (BTM_SCO_HCI_INCLUDED == TRUE)
|
||||
BT_HDR *p_buf;
|
||||
if (event == BTA_AG_SCO_CI_DATA_E)
|
||||
{
|
||||
UINT16 pkt_offset = 1 + HCI_SCO_PREAMBLE_SIZE;
|
||||
@ -1512,7 +1509,9 @@ void bta_ag_sco_conn_open(tBTA_AG_SCB *p_scb, tBTA_AG_DATA *p_data)
|
||||
*******************************************************************************/
|
||||
void bta_ag_sco_conn_close(tBTA_AG_SCB *p_scb, tBTA_AG_DATA *p_data)
|
||||
{
|
||||
#if (BTM_SCO_HCI_INCLUDED == TRUE)
|
||||
UINT16 handle = bta_ag_scb_to_idx(p_scb);
|
||||
#endif
|
||||
UNUSED(p_data);
|
||||
|
||||
/* clear current scb */
|
||||
@ -1542,6 +1541,7 @@ void bta_ag_sco_conn_close(tBTA_AG_SCB *p_scb, tBTA_AG_DATA *p_data)
|
||||
#endif
|
||||
else
|
||||
{
|
||||
#if (BTM_SCO_HCI_INCLUDED == TRUE)
|
||||
sco_state_t sco_state = bta_ag_cb.sco.p_xfer_scb ? SCO_STATE_OFF_TRANSFER : SCO_STATE_OFF;
|
||||
#if (BTM_WBS_INCLUDED == TRUE)
|
||||
/* Indicate if the closing of audio is because of transfer */
|
||||
@ -1549,6 +1549,7 @@ void bta_ag_sco_conn_close(tBTA_AG_SCB *p_scb, tBTA_AG_DATA *p_data)
|
||||
#else
|
||||
/* Indicate if the closing of audio is because of transfer */
|
||||
bta_ag_sco_audio_state(handle, p_scb->app_id, sco_state);
|
||||
#endif
|
||||
#endif
|
||||
bta_ag_sco_event(p_scb, BTA_AG_SCO_CONN_CLOSE_E);
|
||||
|
||||
@ -1626,17 +1627,15 @@ void bta_ag_sco_conn_rsp(tBTA_AG_SCB *p_scb, tBTM_ESCO_CONN_REQ_EVT_DATA *p_data
|
||||
/* tell sys to stop av if any */
|
||||
bta_sys_sco_use(BTA_ID_AG, p_scb->app_id, p_scb->peer_addr);
|
||||
|
||||
#if (BTM_WBS_INCLUDED == FALSE)
|
||||
/* Allow any platform specific pre-SCO set up to take place */
|
||||
bta_ag_sco_audio_state(bta_ag_scb_to_idx(p_scb), p_scb->app_id, SCO_STATE_SETUP);
|
||||
#else
|
||||
#if (BTM_SCO_HCI_INCLUDED == TRUE)
|
||||
#if (BTM_WBS_INCLUDED == TRUE)
|
||||
/* When HS initiated SCO, it cannot be WBS. */
|
||||
/* Allow any platform specific pre-SCO set up to take place */
|
||||
bta_ag_sco_audio_state(bta_ag_scb_to_idx(p_scb), p_scb->app_id, SCO_STATE_SETUP,
|
||||
BTA_AG_CODEC_CVSD);
|
||||
bta_ag_sco_audio_state(bta_ag_scb_to_idx(p_scb), p_scb->app_id, SCO_STATE_SETUP, BTA_AG_CODEC_CVSD);
|
||||
#else
|
||||
/* Allow any platform specific pre-SCO set up to take place */
|
||||
bta_ag_sco_audio_state(bta_ag_scb_to_idx(p_scb), p_scb->app_id, SCO_STATE_SETUP);
|
||||
#endif
|
||||
|
||||
#if (BTM_SCO_HCI_INCLUDED == TRUE)
|
||||
pcm_sample_rate = BTA_HFP_SCO_SAMP_RATE_8K;
|
||||
/* initialize SCO setup, no voice setting for AG, data rate <==> sample rate */
|
||||
BTM_ConfigScoPath(bta_ag_sco_co_init(pcm_sample_rate, pcm_sample_rate, &codec_info, p_scb->app_id),
|
||||
|
@ -110,9 +110,7 @@ enum
|
||||
BTA_AG_CI_RX_WRITE_EVT,
|
||||
BTA_AG_RING_TOUT_EVT,
|
||||
BTA_AG_SVC_TOUT_EVT,
|
||||
#if (BTM_SCO_HCI_INCLUDED == TRUE )
|
||||
BTA_AG_CI_SCO_DATA_EVT,
|
||||
#endif /* (BTM_SCO_HCI_INCLUDED == TRUE ) */
|
||||
BTA_AG_CI_SLC_READY_EVT,
|
||||
BTA_AG_MAX_EVT,
|
||||
|
||||
|
@ -21,13 +21,14 @@
|
||||
* This is the interface file for audio gateway call-out and call-in functions.
|
||||
*
|
||||
******************************************************************************/
|
||||
#ifndef BTA_AG_CIO_H
|
||||
#define BTA_AG_CIO_H
|
||||
#ifndef BTA_AG_CO_H
|
||||
#define BTA_AG_CO_H
|
||||
|
||||
#include "bta/bta_ag_api.h"
|
||||
#include "hci/hci_audio.h"
|
||||
|
||||
#if (BTA_AG_INCLUDED == TRUE)
|
||||
#if (BTM_SCO_HCI_INCLUDED == TRUE)
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function bta_ag_sco_audio_state
|
||||
@ -155,6 +156,8 @@ extern void bta_ag_ci_rx_write(UINT16 handle, char *p_data, UINT16 len);
|
||||
******************************************************************************/
|
||||
extern void bta_ag_ci_slc_ready(UINT16 handle);
|
||||
|
||||
#endif /* #if (BTM_SCO_HCI_INCLUDED == TRUE) */
|
||||
|
||||
#endif /* #if (BTA_AG_INCLUDED == TRUE) */
|
||||
|
||||
#endif /* BTA_AG_CIO_H */
|
||||
#endif /* BTA_AG_CO_H */
|
@ -1301,7 +1301,12 @@ void btc_hf_cb_handler(btc_msg_t *msg)
|
||||
do {
|
||||
memset(¶m, 0, sizeof(esp_hf_cb_param_t));
|
||||
param.vra_rep.value = p_data->val.num;
|
||||
btc_hf_cb_to_app(ESP_HF_BVRA_EVT, ¶m);
|
||||
btc_hf_cb_to_app(ESP_HF_BVRA_RESPONSE_EVT, ¶m);
|
||||
if (p_data->val.num) {
|
||||
btc_hf_connect_audio(&hf_local_param[idx].btc_hf_cb.connected_bda);
|
||||
} else {
|
||||
btc_hf_disconnect_audio(&hf_local_param[idx].btc_hf_cb.connected_bda);
|
||||
}
|
||||
} while (0);
|
||||
break;
|
||||
}
|
||||
@ -1327,6 +1332,11 @@ void btc_hf_cb_handler(btc_msg_t *msg)
|
||||
}
|
||||
|
||||
case BTA_AG_AT_CBC_EVT:
|
||||
{
|
||||
btc_hf_cb_to_app(ESP_HF_IND_UPDATE_EVT, NULL);
|
||||
break;
|
||||
}
|
||||
|
||||
case BTA_AG_AT_CIND_EVT:
|
||||
{
|
||||
btc_hf_cind_evt(&p_data->ind);
|
||||
@ -1422,6 +1432,14 @@ void btc_hf_cb_handler(btc_msg_t *msg)
|
||||
break;
|
||||
}
|
||||
|
||||
case BTA_AG_AT_BCS_EVT:
|
||||
{
|
||||
BTC_TRACE_DEBUG("AG Bitmap of peer-codecs %d", p_data->val.num);
|
||||
memset(¶m, 0, sizeof(esp_hf_cb_param_t));
|
||||
param.codec.mode = p_data->val.num;
|
||||
btc_hf_cb_to_app(ESP_HF_BCS_RESPONSE_EVT, ¶m);
|
||||
break;
|
||||
}
|
||||
#if (BTM_WBS_INCLUDED == TRUE )
|
||||
case BTA_AG_WBS_EVT:
|
||||
{
|
||||
@ -1453,11 +1471,6 @@ void btc_hf_cb_handler(btc_msg_t *msg)
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
case BTA_AG_AT_BCS_EVT:
|
||||
BTC_TRACE_DEBUG("AG final seleded codec is %d 1=CVSD 2=MSBC", p_data->val.num);
|
||||
/* no ESP_HF_WBS_NONE case, becuase HF 1.6 supported device can send BCS */
|
||||
btc_hf_cb_to_app(ESP_HF_BCS_RESPONSE_EVT, ¶m);
|
||||
break;
|
||||
default:
|
||||
BTC_TRACE_WARNING("%s: Unhandled event: %d", __FUNCTION__, event);
|
||||
break;
|
||||
|
@ -228,14 +228,15 @@ static void hci_update_adv_report_flow_control(BT_HDR *packet)
|
||||
// update adv free number
|
||||
hci_hal_env.adv_free_num ++;
|
||||
if (esp_vhci_host_check_send_available()){
|
||||
#if (BLE_INCLUDED == TRUE)
|
||||
// send hci cmd
|
||||
btsnd_hcic_ble_update_adv_report_flow_control(hci_hal_env.adv_free_num);
|
||||
#endif
|
||||
hci_hal_env.adv_free_num = 0;
|
||||
} else {
|
||||
//do nothing
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -338,7 +339,7 @@ static int host_recv_pkt_cb(uint8_t *data, uint16_t len)
|
||||
|
||||
pkt_size = BT_HDR_SIZE + len;
|
||||
pkt = (BT_HDR *) osi_calloc(pkt_size);
|
||||
//pkt = (BT_HDR *)hci_hal_env.allocator->alloc(pkt_size);
|
||||
|
||||
if (!pkt) {
|
||||
HCI_TRACE_ERROR("%s couldn't aquire memory for inbound data buffer.\n", __func__);
|
||||
return -1;
|
||||
|
@ -152,6 +152,7 @@ static void btu_hci_msg_process(void *param)
|
||||
case BT_EVT_TO_BTU_HCI_SCO:
|
||||
#if BTM_SCO_INCLUDED == TRUE
|
||||
btm_route_sco_data (p_msg);
|
||||
osi_free(p_msg);
|
||||
break;
|
||||
#endif
|
||||
|
||||
|
@ -45,6 +45,7 @@ CONFIG_A2DP_ENABLE CONFIG_BT_A2DP_ENABL
|
||||
CONFIG_HFP_ENABLE CONFIG_BT_HFP_ENABLE
|
||||
CONFIG_HFP_ROLE CONFIG_BT_HFP_ROLE
|
||||
CONFIG_HFP_CLIENT_ENABLE CONFIG_BT_HFP_CLIENT_ENABLE
|
||||
CONFIG_HFP_AG_ENABLE CONFIG_BT_HFP_AG_ENABLE
|
||||
CONFIG_HFP_AUDIO_DATA_PATH CONFIG_BT_HFP_AUDIO_DATA_PATH
|
||||
CONFIG_HFP_AUDIO_DATA_PATH_PCM CONFIG_BT_HFP_AUDIO_DATA_PATH_PCM
|
||||
CONFIG_HFP_AUDIO_DATA_PATH_HCI CONFIG_BT_HFP_AUDIO_DATA_PATH_HCI
|
||||
|
@ -57,6 +57,7 @@ INPUT = \
|
||||
../../components/bt/host/bluedroid/api/include/api/esp_spp_api.h \
|
||||
../../components/bt/host/bluedroid/api/include/api/esp_hf_defs.h \
|
||||
../../components/bt/host/bluedroid/api/include/api/esp_hf_client_api.h \
|
||||
../../components/bt/host/bluedroid/api/include/api/esp_hf_ag_api.h \
|
||||
## NimBLE related Bluetooth APIs
|
||||
../../components/bt/host/nimble/esp-hci/include/esp_nimble_hci.h \
|
||||
## ESP BLE Mesh APIs
|
||||
|
@ -143,3 +143,4 @@ Various modules of the Bluetooth stack deliver events to applications via dedica
|
||||
* A2DP: :cpp:func:`esp_a2d_register_callback`, :cpp:type:`esp_a2d_cb_event_t`, :cpp:type:`esp_a2d_cb_param_t`.
|
||||
* AVRC: :cpp:func:`esp_avrc_ct_register_callback`, :cpp:type:`esp_avrc_ct_cb_event_t`, :cpp:type:`esp_avrc_ct_cb_param_t`.
|
||||
* HFP Client: :cpp:func:`esp_hf_client_register_callback`, :cpp:type:`esp_hf_client_cb_event_t`, :cpp:type:`esp_hf_client_cb_param_t`.
|
||||
* HFP AG: :cpp:func:`esp_hf_ag_register_callback`, :cpp:type:`esp_hf_ag_cb_event_t`, :cpp:type:`esp_hf_ag_cb_param_t`.
|
@ -10,3 +10,4 @@ CLASSIC BT
|
||||
BT SPP <esp_spp>
|
||||
BT HFP Define <esp_hf_defs>
|
||||
BT HFP Client <esp_hf_client>
|
||||
BT HFP AG <esp_hf_ag>
|
||||
|
14
docs/en/api-reference/bluetooth/esp_hf_ag.rst
Normal file
14
docs/en/api-reference/bluetooth/esp_hf_ag.rst
Normal file
@ -0,0 +1,14 @@
|
||||
HFP AG API
|
||||
==============
|
||||
|
||||
Overview
|
||||
--------
|
||||
|
||||
`Instructions`_
|
||||
|
||||
.. _Instructions: ../template.html
|
||||
|
||||
API Reference
|
||||
-------------
|
||||
|
||||
.. include:: /_build/inc/esp_hf_ag_api.inc
|
1
docs/zh_CN/api-reference/bluetooth/esp_hf_ag.rst
Normal file
1
docs/zh_CN/api-reference/bluetooth/esp_hf_ag.rst
Normal file
@ -0,0 +1 @@
|
||||
.. include:: ../../../en/api-reference/bluetooth/esp_hf_ag.rst
|
Loading…
x
Reference in New Issue
Block a user