BLUFI_DEVICE modify questions

hucuyuu
Posts: 1
Joined: Wed Aug 10, 2022 5:44 am

BLUFI_DEVICE modify questions

Postby hucuyuu » Wed Aug 10, 2022 6:06 am

Hi,

I want to change the default device name "BLUFI_DEVICE" of esp32 in this sample blufi project

https://github.com/espressif/esp-idf/tr ... ooth/blufi

I modified esp_err_t esp_blufi_host_init(void) in blufi_init.c like this

Code: Select all

esp_err_t esp_blufi_host_init(void)
{
        int ret;
        ret = esp_bluedroid_init();
        if (ret)
        {
                BLUFI_ERROR("%s init bluedroid failed: %s\n", __func__, esp_err_to_name(ret));
                return ESP_FAIL;
        }

        ret = esp_bluedroid_enable();
        if (ret)
        {
                BLUFI_ERROR("%s init bluedroid failed: %s\n", __func__, esp_err_to_name(ret));
                return ESP_FAIL;
        }

        // I supposed change device name should like this
        ret = esp_bt_dev_set_device_name("test");
        if (ret)
        {
                BLUFI_ERROR("%s bt dev set device name failed: %s\n", __func__, esp_err_to_name(ret));
                return ESP_FAIL;
        }
        // end

        BLUFI_INFO("BD ADDR 2 : " ESP_BD_ADDR_STR "\n", ESP_BD_ADDR_HEX(esp_bt_dev_get_address()));

        return ESP_OK;
}
I put the function after esp_bluedroid_enable() as mentioned here https://docs.espressif.com/projects/esp ... evice.html

but esp_bt_dev_set_device_name("test") dosen't work at all.

It still appears the default name "BLUFI_DEVICE" on EspBlufi APP.

I am wondering if there is an esp-idf bug or some mistakes I've made that I didn't notice?

Thank you.

Who is online

Users browsing this forum: No registered users and 70 guests