fix(bt/bluedroid): Fixed NULL Bluetooth device address in HF-AG events was reported to application layer

This commit is contained in:
Jin Cheng 2023-08-18 15:08:30 +08:00
parent 5538b12d31
commit 3e7a47a566

View File

@ -1368,6 +1368,7 @@ void btc_hf_cb_handler(btc_msg_t *msg)
do {
memset(&param, 0, sizeof(esp_hf_cb_param_t));
param.vra_rep.value = p_data->val.num;
memcpy(param.vra_rep.remote_addr, &hf_local_param[idx].btc_hf_cb.connected_bda,sizeof(esp_bd_addr_t));
btc_hf_cb_to_app(ESP_HF_BVRA_RESPONSE_EVT, &param);
if (p_data->val.num) {
btc_hf_connect_audio(&hf_local_param[idx].btc_hf_cb.connected_bda);
@ -1463,9 +1464,12 @@ void btc_hf_cb_handler(btc_msg_t *msg)
case BTA_AG_AT_BLDN_EVT:
case BTA_AG_AT_D_EVT:
{
idx = p_data->hdr.handle - 1;
CHECK_HF_IDX(idx);
do {
if (event == BTA_AG_AT_D_EVT) { // dial_number_or_memory
memset(&param, 0, sizeof(esp_hf_cb_param_t));
memcpy(param.out_call.remote_addr, &hf_local_param[idx].btc_hf_cb.connected_bda,sizeof(esp_bd_addr_t));
param.out_call.num_or_loc = osi_malloc((strlen(p_data->val.str) + 1) * sizeof(char));
sprintf(param.out_call.num_or_loc, "%s", p_data->val.str);
btc_hf_cb_to_app(ESP_HF_DIAL_EVT, &param);