乐鑫技术交流
直播中

刘丰标

8年用户 1163经验值
私信 关注
[问答]

为blufi_device设置自定义名称,但是无法修改,为什么?

我想为blufi_device设置自定义名称,但是无法修改,依旧显示默认名称。后来我修改了...blufiincludeesp_blufi.c中的esp_ble_gap_set_device_name(BLUFI_DEVICE_NAME);,但在修改后,名称变成了ESP32。
另外,我还尝试修改了frameworksesp-idf-v4.4.3componentsbtcommonbtcprofileespblufiincludeesp_blufi.h头文件里的"BLUFI_DEVICE"名称,编译运行之后,手机蓝牙设置里面可以看到,但是在EspBlufi里面刷新看不到新的设备名,这是什么原因?

回帖(4)

陈刚

2024-6-11 10:38:52
  1-blufi 的重命名是通过修改宏 BLUFI_DEVICE_NAME 实现的,具体位置为:
esp-idf/components/bt/common/btc/profile/esp/blufi/include/esp_blufi.h
2-修改完名称,需要手机端刷新才能够看到新名字。
举报

胡秋阳

2024-6-11 17:08:03
以下是一些建议和可能的原因:

1. 确保您修改了正确的文件。在ESP-IDF中,通常需要修改`sdkconfig`文件来更改设备名称。您可以在项目的根目录下找到这个文件。在`sdkconfig`文件中,找到`CONFIG_BT_DEVICE_NAME`选项,并将其设置为您想要的设备名称。

2. 确保您已经保存了修改并重新编译了项目。在修改`sdkconfig`文件后,您需要重新编译项目以使更改生效。

3. 检查您的BLE配置。在ESP-IDF项目中,BLE配置通常在`app_main.c`或类似的文件中设置。确保您在初始化BLE之前设置了设备名称。

4. 关于您提到的`esp_blufi.h`头文件,这个文件定义了BLUFI设备的默认名称。如果您想要更改BLUFI设备的名称,您可以尝试修改这个文件中的`BLUFI_DEVICE_NAME`宏定义。但请注意,这可能不是最佳实践,因为这些宏定义可能会在ESP-IDF的更新中更改。

5. 确保您的手机蓝牙设置和EspBlufi应用程序是最新的。有时候,应用程序或手机系统的问题可能会导致无法正确显示设备名称。


举报

wzh469649067

2024-12-27 15:49:29
include_name=false in blufi_adv_data will not display the name. Since the mobile phone or computer display will have a cache, you can reset the network, or grab the original broadcast package to see that there is actually no name displayed. And other functions are normal and can be used.

static esp_ble_adv_data_t blufi_adv_data = {
    .set_scan_rsp = false,
    .include_name = false,
    .include_txpower = true,
    .min_interval = 0x0006, //slave connection min interval, Time = min_interval * 1.25 msec
    .max_interval = 0x0010, //slave connection max interval, Time = max_interval * 1.25 msec
    .appearance = 0x00,
    .manufacturer_len = 0,
    .p_manufacturer_data =  NULL,
    .service_data_len = 0,
    .p_service_data = NULL,
    .service_uuid_len = 16,
    .p_service_uuid = blufi_service_uuid128,
    .flag = 0x6,
};
举报

wzh469649067

2024-12-27 15:50:07
include_name=false in blufi_adv_data will not display the name. Since the mobile phone or computer display will have a cache, you can reset the network, or grab the original broadcast package to see that there is actually no name displayed. And other functions are normal and can be used.
举报

更多回帖

发帖
×
20
完善资料,
赚取积分