mirror of
https://github.com/esphome/esphome.git
synced 2024-12-18 15:57:58 +01:00
Fix BLE UUID matching (#1637)
Co-authored-by: Ben Buxton <bb@cactii.net>
This commit is contained in:
parent
fb6c5ebe9a
commit
46356cbc4a
@ -241,7 +241,7 @@ ESPBTUUID ESPBTUUID::as_128bit() const {
|
|||||||
}
|
}
|
||||||
bool ESPBTUUID::contains(uint8_t data1, uint8_t data2) const {
|
bool ESPBTUUID::contains(uint8_t data1, uint8_t data2) const {
|
||||||
if (this->uuid_.len == ESP_UUID_LEN_16) {
|
if (this->uuid_.len == ESP_UUID_LEN_16) {
|
||||||
return (this->uuid_.uuid.uuid16 >> 8) == data2 || (this->uuid_.uuid.uuid16 & 0xFF) == data1;
|
return (this->uuid_.uuid.uuid16 >> 8) == data2 && (this->uuid_.uuid.uuid16 & 0xFF) == data1;
|
||||||
} else if (this->uuid_.len == ESP_UUID_LEN_32) {
|
} else if (this->uuid_.len == ESP_UUID_LEN_32) {
|
||||||
for (uint8_t i = 0; i < 3; i++) {
|
for (uint8_t i = 0; i < 3; i++) {
|
||||||
bool a = ((this->uuid_.uuid.uuid32 >> i * 8) & 0xFF) == data1;
|
bool a = ((this->uuid_.uuid.uuid32 >> i * 8) & 0xFF) == data1;
|
||||||
|
Loading…
Reference in New Issue
Block a user