设备注册RTC服务时,设备名称从Wi-Fi的MAC地址改为使用蓝牙的MAC地址
This commit is contained in:
parent
b9bbcc456c
commit
180057d427
1289
05-最新日志.txt
1289
05-最新日志.txt
File diff suppressed because it is too large
Load Diff
@ -111,14 +111,14 @@ void VolcRtcProtocol::Start() {
|
|||||||
iot_info_.device_name = (char*)CONFIG_VOLC_DEVICE_NAME;
|
iot_info_.device_name = (char*)CONFIG_VOLC_DEVICE_NAME;
|
||||||
ESP_LOGI(TAG, "使用配置文件中的设备名称: %s", iot_info_.device_name);
|
ESP_LOGI(TAG, "使用配置文件中的设备名称: %s", iot_info_.device_name);
|
||||||
} else {
|
} else {
|
||||||
// 配置文件中的设备名称为空,使用MAC地址作为设备名称
|
// 配置文件中的设备名称为空,使用蓝牙MAC地址作为设备名称
|
||||||
std::string mac_address = SystemInfo::GetMacAddress();
|
std::string mac_address = SystemInfo::GetBleMacAddress();
|
||||||
// MAC地址中替换冒号为下划线,避免文件名中包含冒号
|
// MAC地址中替换冒号为下划线,避免文件名中包含冒号
|
||||||
std::replace(mac_address.begin(), mac_address.end(), ':', '_');
|
std::replace(mac_address.begin(), mac_address.end(), ':', '_');
|
||||||
char* mac_buffer = (char*)malloc(mac_address.length() + 1);
|
char* mac_buffer = (char*)malloc(mac_address.length() + 1);
|
||||||
strcpy(mac_buffer, mac_address.c_str());
|
strcpy(mac_buffer, mac_address.c_str());
|
||||||
iot_info_.device_name = mac_buffer;
|
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");
|
Settings s("volc");
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user