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) diff --git a/components/bt/host/bluedroid/stack/btm/btm_dev.c b/components/bt/host/bluedroid/stack/btm/btm_dev.c index 169dcc1449..f705a8dc69 100644 --- a/components/bt/host/bluedroid/stack/btm/btm_dev.c +++ b/components/bt/host/bluedroid/stack/btm/btm_dev.c @@ -187,8 +187,10 @@ BOOLEAN BTM_SecDeleteDevice (BD_ADDR bd_addr, tBT_TRANSPORT transport) } if ((p_dev_rec = btm_find_dev(bd_addr)) != NULL) { +#if (CLASSIC_BT_INCLUDED == TRUE) /* Tell controller to get rid of the link key, if it has one stored */ BTM_DeleteStoredLinkKey (p_dev_rec->bd_addr, NULL); +#endif // (CLASSIC_BT_INCLUDED == TRUE) btm_sec_free_dev(p_dev_rec, transport); } diff --git a/components/bt/host/bluedroid/stack/btm/btm_devctl.c b/components/bt/host/bluedroid/stack/btm/btm_devctl.c index 99b30bce11..2250c78bd4 100644 --- a/components/bt/host/bluedroid/stack/btm/btm_devctl.c +++ b/components/bt/host/bluedroid/stack/btm/btm_devctl.c @@ -1149,6 +1149,7 @@ tBTM_STATUS BTM_EnableTestMode(void) } #endif // #if (BLE_HOST_ENABLE_TEST_MODE_EN == TRUE) +#if (CLASSIC_BT_INCLUDED == TRUE) /******************************************************************************* ** ** Function BTM_DeleteStoredLinkKey @@ -1223,6 +1224,7 @@ void btm_delete_stored_link_key_complete (UINT8 *p) } } +#endif // (CLASSIC_BT_INCLUDED == TRUE) /******************************************************************************* ** ** Function btm_report_device_status diff --git a/components/bt/host/bluedroid/stack/btm/btm_sec.c b/components/bt/host/bluedroid/stack/btm/btm_sec.c index 1cd0e66833..3ed5d4b13f 100644 --- a/components/bt/host/bluedroid/stack/btm/btm_sec.c +++ b/components/bt/host/bluedroid/stack/btm/btm_sec.c @@ -1001,12 +1001,12 @@ tBTM_STATUS btm_sec_bond_by_transport (BD_ADDR bd_addr, tBT_TRANSPORT transport, return (BTM_SUCCESS); } +#if (CLASSIC_BT_INCLUDED == TRUE) /* Tell controller to get rid of the link key if it has one stored */ if ((BTM_DeleteStoredLinkKey (bd_addr, NULL)) != BTM_SUCCESS) { return (BTM_NO_RESOURCES); } -#if (CLASSIC_BT_INCLUDED == TRUE) /* Save the PIN code if we got a valid one */ if (p_pin && (pin_len <= PIN_CODE_LEN) && (pin_len != 0)) { btm_cb.pin_code_len = pin_len;