设备注册RTC服务时,设备名称从Wi-Fi的MAC地址改为使用蓝牙的MAC地址

This commit is contained in:
Rdzleo 2026-03-05 13:31:59 +08:00
parent b9bbcc456c
commit 180057d427
2 changed files with 570 additions and 725 deletions

File diff suppressed because it is too large Load Diff

View File

@ -111,14 +111,14 @@ void VolcRtcProtocol::Start() {
iot_info_.device_name = (char*)CONFIG_VOLC_DEVICE_NAME;
ESP_LOGI(TAG, "使用配置文件中的设备名称: %s", iot_info_.device_name);
} else {
// 配置文件中的设备名称为空,使用MAC地址作为设备名称
std::string mac_address = SystemInfo::GetMacAddress();
// 配置文件中的设备名称为空,使用蓝牙MAC地址作为设备名称
std::string mac_address = SystemInfo::GetBleMacAddress();
// MAC地址中替换冒号为下划线,避免文件名中包含冒号
std::replace(mac_address.begin(), mac_address.end(), ':', '_');
char* mac_buffer = (char*)malloc(mac_address.length() + 1);
strcpy(mac_buffer, mac_address.c_str());
iot_info_.device_name = mac_buffer;
ESP_LOGI(TAG, "使用Wi-Fi MAC地址作为设备名称(已替换冒号为下划线): %s", iot_info_.device_name);
ESP_LOGI(TAG, "使用蓝牙MAC地址作为设备名称(已替换冒号为下划线): %s", iot_info_.device_name);
}
Settings s("volc");