mirror of
https://github.com/esphome/esphome.git
synced 2024-12-22 16:37:52 +01:00
Fixed iBeacon struct and major and minor parsing (#987)
Co-authored-by: sekkr1 <dekel.reches@pm.me>
This commit is contained in:
parent
66083c5e97
commit
426e6a1b46
@ -46,14 +46,15 @@ class ESPBLEiBeacon {
|
|||||||
ESPBLEiBeacon(const uint8_t *data);
|
ESPBLEiBeacon(const uint8_t *data);
|
||||||
static optional<ESPBLEiBeacon> from_manufacturer_data(const ServiceData &data);
|
static optional<ESPBLEiBeacon> from_manufacturer_data(const ServiceData &data);
|
||||||
|
|
||||||
uint16_t get_major() { return reverse_bits_16(this->beacon_data_.major); }
|
uint16_t get_major() { return ((this->beacon_data_.major & 0xFF) << 8) | (this->beacon_data_.major >> 8); }
|
||||||
uint16_t get_minor() { return reverse_bits_16(this->beacon_data_.minor); }
|
uint16_t get_minor() { return ((this->beacon_data_.minor & 0xFF) << 8) | (this->beacon_data_.minor >> 8); }
|
||||||
int8_t get_signal_power() { return this->beacon_data_.signal_power; }
|
int8_t get_signal_power() { return this->beacon_data_.signal_power; }
|
||||||
ESPBTUUID get_uuid() { return ESPBTUUID::from_raw(this->beacon_data_.proximity_uuid); }
|
ESPBTUUID get_uuid() { return ESPBTUUID::from_raw(this->beacon_data_.proximity_uuid); }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
struct {
|
struct {
|
||||||
uint8_t sub_type;
|
uint8_t sub_type;
|
||||||
|
uint8_t length;
|
||||||
uint8_t proximity_uuid[16];
|
uint8_t proximity_uuid[16];
|
||||||
uint16_t major;
|
uint16_t major;
|
||||||
uint16_t minor;
|
uint16_t minor;
|
||||||
|
Loading…
Reference in New Issue
Block a user