Fixed iBeacon struct and major and minor parsing (#987)

Co-authored-by: sekkr1 <dekel.reches@pm.me>
This commit is contained in:
sekkr1 2020-03-12 02:25:54 +02:00 committed by GitHub
parent 66083c5e97
commit 426e6a1b46
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -46,14 +46,15 @@ class ESPBLEiBeacon {
ESPBLEiBeacon(const uint8_t *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_minor() { return reverse_bits_16(this->beacon_data_.minor); }
uint16_t get_major() { return ((this->beacon_data_.major & 0xFF) << 8) | (this->beacon_data_.major >> 8); }
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; }
ESPBTUUID get_uuid() { return ESPBTUUID::from_raw(this->beacon_data_.proximity_uuid); }
protected:
struct {
uint8_t sub_type;
uint8_t length;
uint8_t proximity_uuid[16];
uint16_t major;
uint16_t minor;