From e64937f7f6d2dc3be02dece46b81122ff951c8c0 Mon Sep 17 00:00:00 2001 From: Zhang Hai Peng Date: Tue, 27 May 2025 15:13:38 +0800 Subject: [PATCH] fix(ble/bluedroid): Fixed clear BLE device recored (cherry picked from commit 21391a45fd4252c41818451da5cbe81338c633b5) Co-authored-by: zhanghaipeng --- components/bt/host/bluedroid/btc/core/btc_main.c | 6 +++--- components/bt/host/bluedroid/btc/include/btc/btc_main.h | 2 +- components/bt/host/bluedroid/stack/btm/btm_ble.c | 8 +++++++- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/components/bt/host/bluedroid/btc/core/btc_main.c b/components/bt/host/bluedroid/btc/core/btc_main.c index 5fe01627fc..cb92ff9bea 100644 --- a/components/bt/host/bluedroid/btc/core/btc_main.c +++ b/components/bt/host/bluedroid/btc/core/btc_main.c @@ -154,9 +154,9 @@ uint32_t btc_get_ble_status(void) #if (SMP_INCLUDED == TRUE) // Number of recorded devices - extern uint8_t btm_ble_sec_dev_active_count(void); - if (btm_ble_sec_dev_active_count()) { - status |= BIT(BTC_BLE_STATUS_KEYS); + extern uint8_t btm_ble_sec_dev_record_count(void); + if (btm_ble_sec_dev_record_count()) { + status |= BIT(BTC_BLE_STATUS_DEVICE_REC); } // Number of saved bonded devices diff --git a/components/bt/host/bluedroid/btc/include/btc/btc_main.h b/components/bt/host/bluedroid/btc/include/btc/btc_main.h index e9b6f5ba2a..4cc7784141 100644 --- a/components/bt/host/bluedroid/btc/include/btc/btc_main.h +++ b/components/bt/host/bluedroid/btc/include/btc/btc_main.h @@ -34,7 +34,7 @@ typedef enum { BTC_BLE_STATUS_EXT_ADV, // Extended advertising exist BTC_BLE_STATUS_SCAN, // Scanning exist BTC_BLE_STATUS_CONN, // Connection exist - BTC_BLE_STATUS_KEYS, // Device keys record exist + BTC_BLE_STATUS_DEVICE_REC, // Device record exist BTC_BLE_STATUS_BOND, // Bond info exist BTC_BLE_STATUS_GATTC_CACHE, // GATTC cache exist BTC_BLE_STATUS_GATTC_APP, // GATTC application exist diff --git a/components/bt/host/bluedroid/stack/btm/btm_ble.c b/components/bt/host/bluedroid/stack/btm/btm_ble.c index c24a111ee4..8f676a655a 100644 --- a/components/bt/host/bluedroid/stack/btm/btm_ble.c +++ b/components/bt/host/bluedroid/stack/btm/btm_ble.c @@ -2946,7 +2946,7 @@ uint8_t btm_ble_scan_active_count(void) } #if (SMP_INCLUDED == TRUE) -uint8_t btm_ble_sec_dev_active_count(void) +uint8_t btm_ble_sec_dev_record_count(void) { tBTM_SEC_DEV_REC *p_dev_rec = NULL; list_node_t *p_node = NULL; @@ -2962,6 +2962,12 @@ uint8_t btm_ble_sec_dev_active_count(void) return count; } + +void btm_ble_clear_sec_dev_record(void) +{ + /* only used when connection is closed */ + if(btm_cb.p_sec_dev_rec_list) list_clear(btm_cb.p_sec_dev_rec_list); +} #endif #if (BLE_PRIVACY_SPT == TRUE)