mirror of
https://github.com/esphome/esphome.git
synced 2024-11-10 09:17:46 +01:00
Avoid 128bit uuid loop for 16/32 bit uuids (#4068)
This commit is contained in:
parent
7623f63846
commit
b2e6b9d31f
1 changed files with 7 additions and 4 deletions
|
@ -449,10 +449,13 @@ ESPBTUUID ESPBTUUID::from_raw(const std::string &data) {
|
||||||
ESPBTUUID ESPBTUUID::from_uuid(esp_bt_uuid_t uuid) {
|
ESPBTUUID ESPBTUUID::from_uuid(esp_bt_uuid_t uuid) {
|
||||||
ESPBTUUID ret;
|
ESPBTUUID ret;
|
||||||
ret.uuid_.len = uuid.len;
|
ret.uuid_.len = uuid.len;
|
||||||
ret.uuid_.uuid.uuid16 = uuid.uuid.uuid16;
|
if (uuid.len == ESP_UUID_LEN_16) {
|
||||||
ret.uuid_.uuid.uuid32 = uuid.uuid.uuid32;
|
ret.uuid_.uuid.uuid16 = uuid.uuid.uuid16;
|
||||||
for (size_t i = 0; i < ESP_UUID_LEN_128; i++)
|
} else if (uuid.len == ESP_UUID_LEN_32) {
|
||||||
ret.uuid_.uuid.uuid128[i] = uuid.uuid.uuid128[i];
|
ret.uuid_.uuid.uuid32 = uuid.uuid.uuid32;
|
||||||
|
} else if (uuid.len == ESP_UUID_LEN_128) {
|
||||||
|
memcpy(ret.uuid_.uuid.uuid128, uuid.uuid.uuid128, ESP_UUID_LEN_128);
|
||||||
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
ESPBTUUID ESPBTUUID::as_128bit() const {
|
ESPBTUUID ESPBTUUID::as_128bit() const {
|
||||||
|
|
Loading…
Reference in a new issue