feat(bluedroid): Support get bt config path

(cherry picked from commit d6bb90b453)

Co-authored-by: zhanghaipeng <zhanghaipeng@espressif.com>
This commit is contained in:
Zhang Hai Peng
2025-04-07 21:14:16 +08:00
parent 03e87e18f7
commit 44f3208a49
4 changed files with 32 additions and 3 deletions

View File

@ -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);

View File

@ -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().

View File

@ -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) {

View File

@ -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