From e4e46b8384a58c68af8df7a48e68a0c17f806c1c Mon Sep 17 00:00:00 2001 From: liqigan Date: Wed, 23 Sep 2020 11:55:12 +0800 Subject: [PATCH] 1. fix read rssi delta bug in bredr 2. modify read rssi related function names Closes https://github.com/espressif/esp-idf/issues/5660 --- components/bt/host/bluedroid/bta/dm/bta_dm_act.c | 4 +--- components/bt/host/bluedroid/bta/dm/bta_dm_api.c | 4 ++-- components/bt/host/bluedroid/bta/dm/bta_dm_main.c | 2 +- components/bt/host/bluedroid/bta/dm/include/bta_dm_int.h | 6 +++--- components/bt/host/bluedroid/bta/include/bta/bta_api.h | 2 +- .../bt/host/bluedroid/btc/profile/std/gap/btc_gap_ble.c | 2 +- .../bt/host/bluedroid/btc/profile/std/gap/btc_gap_bt.c | 2 +- 7 files changed, 10 insertions(+), 12 deletions(-) diff --git a/components/bt/host/bluedroid/bta/dm/bta_dm_act.c b/components/bt/host/bluedroid/bta/dm/bta_dm_act.c index 12ac548377..f0cc85a503 100644 --- a/components/bt/host/bluedroid/bta/dm/bta_dm_act.c +++ b/components/bt/host/bluedroid/bta/dm/bta_dm_act.c @@ -831,15 +831,13 @@ void bta_dm_ble_read_adv_tx_power(tBTA_DM_MSG *p_data) #endif ///BLE_INCLUDED == TRUE } -void bta_dm_ble_read_rssi(tBTA_DM_MSG *p_data) +void bta_dm_read_rssi(tBTA_DM_MSG *p_data) { -#if (BLE_INCLUDED == TRUE) if (p_data->rssi.read_rssi_cb != NULL) { BTM_ReadRSSI(p_data->rssi.remote_addr, p_data->rssi.transport, p_data->rssi.read_rssi_cb); } else { APPL_TRACE_ERROR("%s(), the callback function can't be NULL.", __func__); } -#endif ///BLE_INCLUDED == TRUE } /******************************************************************************* diff --git a/components/bt/host/bluedroid/bta/dm/bta_dm_api.c b/components/bt/host/bluedroid/bta/dm/bta_dm_api.c index 5cbeb80d73..aeeadb0983 100644 --- a/components/bt/host/bluedroid/bta/dm/bta_dm_api.c +++ b/components/bt/host/bluedroid/bta/dm/bta_dm_api.c @@ -326,11 +326,11 @@ void BTA_DmBleReadAdvTxPower(tBTA_CMPL_CB *cmpl_cb) } #endif ///BLE_INCLUDED == TRUE -void BTA_DmBleReadRSSI(BD_ADDR remote_addr, tBTA_TRANSPORT transport, tBTA_CMPL_CB *cmpl_cb) +void BTA_DmReadRSSI(BD_ADDR remote_addr, tBTA_TRANSPORT transport, tBTA_CMPL_CB *cmpl_cb) { tBTA_DM_API_READ_RSSI *p_msg; if ((p_msg = (tBTA_DM_API_READ_RSSI *)osi_malloc(sizeof(tBTA_DM_API_READ_RSSI))) != NULL) { - p_msg->hdr.event = BTA_DM_API_BLE_READ_RSSI_EVT; + p_msg->hdr.event = BTA_DM_API_READ_RSSI_EVT; memcpy(p_msg->remote_addr, remote_addr, sizeof(BD_ADDR)); p_msg->transport = transport; p_msg->read_rssi_cb = cmpl_cb; diff --git a/components/bt/host/bluedroid/bta/dm/bta_dm_main.c b/components/bt/host/bluedroid/bta/dm/bta_dm_main.c index a234f31148..a282fd7855 100644 --- a/components/bt/host/bluedroid/bta/dm/bta_dm_main.c +++ b/components/bt/host/bluedroid/bta/dm/bta_dm_main.c @@ -165,7 +165,7 @@ const tBTA_DM_ACTION bta_dm_action[BTA_DM_MAX_EVT] = { bta_dm_ble_set_channels, /* BTA_DM_API_BLE_SET_CHANNELS_EVT */ bta_dm_update_white_list, /* BTA_DM_API_UPDATE_WHITE_LIST_EVT */ bta_dm_ble_read_adv_tx_power, /* BTA_DM_API_BLE_READ_ADV_TX_POWER_EVT */ - bta_dm_ble_read_rssi, /* BTA_DM_API_BLE_READ_RSSI_EVT */ + bta_dm_read_rssi, /* BTA_DM_API_READ_RSSI_EVT */ #if BLE_INCLUDED == TRUE bta_dm_ble_update_duplicate_exceptional_list,/* BTA_DM_API_UPDATE_DUPLICATE_EXCEPTIONAL_LIST_EVT */ #endif diff --git a/components/bt/host/bluedroid/bta/dm/include/bta_dm_int.h b/components/bt/host/bluedroid/bta/dm/include/bta_dm_int.h index 001346f621..b6de9fd973 100644 --- a/components/bt/host/bluedroid/bta/dm/include/bta_dm_int.h +++ b/components/bt/host/bluedroid/bta/dm/include/bta_dm_int.h @@ -161,7 +161,7 @@ enum { BTA_DM_API_BLE_SET_CHANNELS_EVT, BTA_DM_API_UPDATE_WHITE_LIST_EVT, BTA_DM_API_BLE_READ_ADV_TX_POWER_EVT, - BTA_DM_API_BLE_READ_RSSI_EVT, + BTA_DM_API_READ_RSSI_EVT, #if BLE_INCLUDED == TRUE BTA_DM_API_UPDATE_DUPLICATE_EXCEPTIONAL_LIST_EVT, #endif @@ -844,8 +844,8 @@ typedef union { tBTA_DM_API_BLE_SET_CHANNELS ble_set_channels; tBTA_DM_API_UPDATE_WHITE_LIST white_list; tBTA_DM_API_READ_ADV_TX_POWER read_tx_power; - tBTA_DM_API_READ_RSSI rssi; #endif ///BLE_INCLUDED == TRUE + tBTA_DM_API_READ_RSSI rssi; tBTA_DM_API_SET_VISIBILITY set_visibility; @@ -1304,7 +1304,7 @@ extern void bta_dm_read_rmt_name(tBTA_DM_MSG *p_data); extern void bta_dm_ble_set_channels (tBTA_DM_MSG *p_data); extern void bta_dm_update_white_list(tBTA_DM_MSG *p_data); extern void bta_dm_ble_read_adv_tx_power(tBTA_DM_MSG *p_data); -extern void bta_dm_ble_read_rssi(tBTA_DM_MSG *p_data); +extern void bta_dm_read_rssi(tBTA_DM_MSG *p_data); extern void bta_dm_set_visibility (tBTA_DM_MSG *p_data); extern void bta_dm_set_scan_config(tBTA_DM_MSG *p_data); diff --git a/components/bt/host/bluedroid/bta/include/bta/bta_api.h b/components/bt/host/bluedroid/bta/include/bta/bta_api.h index e4c4e1f90a..2ff0e0a97d 100644 --- a/components/bt/host/bluedroid/bta/include/bta/bta_api.h +++ b/components/bt/host/bluedroid/bta/include/bta/bta_api.h @@ -1528,7 +1528,7 @@ extern void BTA_DmUpdateWhiteList(BOOLEAN add_remove, BD_ADDR remote_addr, tBLE extern void BTA_DmBleReadAdvTxPower(tBTA_CMPL_CB *cmpl_cb); #endif ///BLE_INCLUDED == TRUE -extern void BTA_DmBleReadRSSI(BD_ADDR remote_addr, tBTA_TRANSPORT transport, tBTA_CMPL_CB *cmpl_cb); +extern void BTA_DmReadRSSI(BD_ADDR remote_addr, tBTA_TRANSPORT transport, tBTA_CMPL_CB *cmpl_cb); /******************************************************************************* ** diff --git a/components/bt/host/bluedroid/btc/profile/std/gap/btc_gap_ble.c b/components/bt/host/bluedroid/btc/profile/std/gap/btc_gap_ble.c index 181e26ec53..6d8484302b 100644 --- a/components/bt/host/bluedroid/btc/profile/std/gap/btc_gap_ble.c +++ b/components/bt/host/bluedroid/btc/profile/std/gap/btc_gap_ble.c @@ -1154,7 +1154,7 @@ void btc_gap_ble_call_handler(btc_msg_t *msg) BTA_DmUpdateWhiteList(arg->update_white_list.add_remove, arg->update_white_list.remote_bda, arg->update_white_list.wl_addr_type, btc_add_whitelist_complete_callback); break; case BTC_GAP_BLE_ACT_READ_RSSI: - BTA_DmBleReadRSSI(arg->read_rssi.remote_addr, BTA_TRANSPORT_LE, btc_read_ble_rssi_cmpl_callback); + BTA_DmReadRSSI(arg->read_rssi.remote_addr, BTA_TRANSPORT_LE, btc_read_ble_rssi_cmpl_callback); break; case BTC_GAP_BLE_ACT_SET_CONN_PARAMS: BTA_DmSetBlePrefConnParams(arg->set_conn_params.bd_addr, arg->set_conn_params.min_conn_int, diff --git a/components/bt/host/bluedroid/btc/profile/std/gap/btc_gap_bt.c b/components/bt/host/bluedroid/btc/profile/std/gap/btc_gap_bt.c index 9061818162..69e433378f 100644 --- a/components/bt/host/bluedroid/btc/profile/std/gap/btc_gap_bt.c +++ b/components/bt/host/bluedroid/btc/profile/std/gap/btc_gap_bt.c @@ -639,7 +639,7 @@ static void btc_gap_bt_read_rssi_delta_cmpl_callback(void *p_data) static void btc_gap_bt_read_rssi_delta(btc_gap_bt_args_t *arg) { - BTA_DmBleReadRSSI(arg->read_rssi_delta.bda.address, BTA_TRANSPORT_BR_EDR, btc_gap_bt_read_rssi_delta_cmpl_callback); + BTA_DmReadRSSI(arg->read_rssi_delta.bda.address, BTA_TRANSPORT_BR_EDR, btc_gap_bt_read_rssi_delta_cmpl_callback); } static esp_err_t btc_gap_bt_remove_bond_device(btc_gap_bt_args_t *arg)