Merge branch 'bugfix/error_param_in_BTA_AG_WBS_EVT_v5.1' into 'release/v5.1'

Bugfix/error param in bta ag wbs evt (v5.1)

See merge request espressif/esp-idf!26001
This commit is contained in:
Wang Meng Yang 2023-09-19 12:01:11 +08:00
commit c7132d3f15
3 changed files with 12 additions and 11 deletions

View File

@ -68,9 +68,9 @@ typedef enum
/// Dial type of ESP_HF_DIAL_EVT
typedef enum
{
ESP_HF_DIAL_MEM = 0, /*!< Dial with a memory position */
ESP_HF_DIAL_NUM = 0, /*!< Dial with a phone number */
ESP_HF_DIAL_VOIP, /*!< Dial with VoIP */
ESP_HF_DIAL_NUM, /*!< Dial with a phone number */
ESP_HF_DIAL_MEM, /*!< Dial with a memory position */
} esp_hf_dial_type_t;
/// HFP AG callback parameters

View File

@ -785,14 +785,17 @@ void bta_ag_rcvd_slc_ready(tBTA_AG_SCB *p_scb, tBTA_AG_DATA *p_data)
void bta_ag_setcodec(tBTA_AG_SCB *p_scb, tBTA_AG_DATA *p_data)
{
#if (BTM_WBS_INCLUDED == TRUE)
UINT16 handle = p_data->api_setcodec.hdr.layer_specific;
tBTA_AG_PEER_CODEC codec_type = p_data->api_setcodec.codec;
tBTA_AG_VAL val;
val.hdr.handle = handle;
val.num = codec_type;
/* Check if the requested codec type is valid */
if((codec_type != BTA_AG_CODEC_NONE) &&
(codec_type != BTA_AG_CODEC_CVSD) &&
(codec_type != BTA_AG_CODEC_MSBC)) {
val.num = codec_type;
val.hdr.status = BTA_AG_FAIL_RESOURCES;
APPL_TRACE_ERROR("%s error: unsupported codec type %d", __func__, codec_type);
(*bta_ag_cb.p_cback)(BTA_AG_WBS_EVT, (tBTA_AG *) &val);
@ -804,11 +807,9 @@ void bta_ag_setcodec(tBTA_AG_SCB *p_scb, tBTA_AG_DATA *p_data)
(codec_type == BTA_AG_CODEC_CVSD)) {
p_scb->sco_codec = codec_type;
p_scb->codec_updated = TRUE;
val.num = codec_type;
val.hdr.status = BTA_AG_SUCCESS;
APPL_TRACE_DEBUG("%s: Updated codec type %d", __func__, codec_type);
} else {
val.num = codec_type;
val.hdr.status = BTA_AG_FAIL_RESOURCES;
APPL_TRACE_ERROR("%s error: unsupported codec type %d",__func__, codec_type);
}

View File

@ -134,12 +134,12 @@ do {
hf_local_param[idx].btc_hf_cb.num_active = 0; \
hf_local_param[idx].btc_hf_cb.num_held = 0;
#define CHECK_HF_IDX(idx) \
do { \
if ((idx < 0) || (idx >= BTC_HF_NUM_CB)) { \
BTC_TRACE_ERROR("%s: Invalid index %d", __FUNCTION__, idx); \
return; \
} \
#define CHECK_HF_IDX(idx) \
do { \
if ((idx < 0) || (idx >= BTC_HF_NUM_CB)) { \
BTC_TRACE_ERROR("%s:%d Invalid index %d", __FUNCTION__, __LINE__, idx); \
return; \
} \
} while (0)
/************************************************************************************