diff --git a/components/bt/host/bluedroid/api/esp_bt_device.c b/components/bt/host/bluedroid/api/esp_bt_device.c index ae4ff8ec93..d3229e5f5c 100644 --- a/components/bt/host/bluedroid/api/esp_bt_device.c +++ b/components/bt/host/bluedroid/api/esp_bt_device.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -95,6 +95,11 @@ esp_err_t esp_bt_dev_coex_status_config(esp_bt_dev_coex_type_t type, esp_bt_dev_ } #endif +esp_err_t esp_bt_config_file_path_get(char *file_path) +{ + return btc_config_file_path_get(file_path); +} + esp_err_t esp_bt_config_file_path_update(const char *file_path) { ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_UNINITIALIZED); diff --git a/components/bt/host/bluedroid/api/include/api/esp_bt_device.h b/components/bt/host/bluedroid/api/include/api/esp_bt_device.h index 6e12765ce8..60758f1e59 100644 --- a/components/bt/host/bluedroid/api/include/api/esp_bt_device.h +++ b/components/bt/host/bluedroid/api/include/api/esp_bt_device.h @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -128,6 +128,17 @@ esp_err_t esp_bt_dev_get_device_name(void) __attribute__((deprecated("Please use */ esp_err_t esp_bt_dev_coex_status_config(esp_bt_dev_coex_type_t type, esp_bt_dev_coex_op_t op, uint8_t status); +/** + * @brief This function is used to get the path name of the Bluetooth bond keys + * saved in the NVS module. + * @param[out] file_path: buffer to store the config file path, max length NVS_KEY_NAME_MAX_SIZE + * + * @return + * - ESP_OK: success + * + */ +esp_err_t esp_bt_config_file_path_get(char *file_path); + /** * @brief This function is used to update the path name of bluetooth bond keys saved in the NVS module * and need to be called before esp_bluedroid_init(). diff --git a/components/bt/host/bluedroid/btc/core/btc_config.c b/components/bt/host/bluedroid/btc/core/btc_config.c index f46aef89b0..e2cce6da73 100644 --- a/components/bt/host/bluedroid/btc/core/btc_config.c +++ b/components/bt/host/bluedroid/btc/core/btc_config.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -29,6 +29,17 @@ static void btc_key_value_to_string(uint8_t *key_value, char *value_str, int key static osi_mutex_t lock; // protects operations on |config|. static config_t *config; + +int btc_config_file_path_get(char *file_path) +{ + if (file_path == NULL) { + return -1; + } + + strcpy(file_path, CONFIG_FILE_PATH); + return 0; +} + int btc_config_file_path_update(const char *file_path) { if (file_path != NULL && strlen(file_path) < NVS_NS_NAME_MAX_SIZE) { diff --git a/components/bt/host/bluedroid/btc/include/btc/btc_config.h b/components/bt/host/bluedroid/btc/include/btc/btc_config.h index 8467ced83c..6727c0caea 100644 --- a/components/bt/host/bluedroid/btc/include/btc/btc_config.h +++ b/components/bt/host/bluedroid/btc/include/btc/btc_config.h @@ -49,4 +49,6 @@ void btc_config_lock(void); void btc_config_unlock(void); int btc_config_file_path_update(const char *file_path); + +int btc_config_file_path_get(char *file_path); #endif