Skip to content

Commit

Permalink
Merge branch 'bugfix/error_param_in_BTA_AG_WBS_EVT' into 'master'
Browse files Browse the repository at this point in the history
Bugfix/error param in bta ag wbs evt

Closes BTQABR2023-102 and BTQABR2023-103

See merge request espressif/esp-idf!25913
  • Loading branch information
wmy-espressif committed Sep 13, 2023
2 parents 82cb4d5 + 62f6af0 commit 965af35
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
4 changes: 2 additions & 2 deletions components/bt/host/bluedroid/api/include/api/esp_hf_ag_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 4 additions & 3 deletions components/bt/host/bluedroid/bta/hf_ag/bta_ag_act.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
}
Expand Down
12 changes: 6 additions & 6 deletions components/bt/host/bluedroid/btc/profile/std/hf_ag/btc_hf_ag.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)

/************************************************************************************
Expand Down

0 comments on commit 965af35

Please sign in to comment.