chegewara / esp32-snippets

Sample ESP32 snippets and code fragments
https://leanpub.com/kolban-ESP32
Apache License 2.0
9 stars 4 forks source link

ESP32 client iBeacon Scan read major/minor and RSSI #11

Open fjfuente13 opened 5 years ago

fjfuente13 commented 5 years ago

Hi, try to scan iBeacon with an ESP32. I do it and I can read some parameters but major and minor, no. I will use major and minor, to filter the devices found. But when use sketch of blescan, I can’t be able to read major and minor. Please, any idea? Thanks in advance (I just star with iot, and my knowledge are limited.)

chegewara commented 5 years ago

Hi. In theory you could create BLEBeacon variable, then use this function with reaw advertising data: https://github.com/chegewara/esp32-snippets/blob/master/cpp_utils/BLEBeacon.cpp#L59

Then use functions to get data you need: https://github.com/chegewara/esp32-snippets/blob/master/cpp_utils/BLEBeacon.cpp#L36-L52

Raw advertisement data you can get with this function: https://github.com/chegewara/esp32-snippets/blob/master/cpp_utils/BLEAdvertisedDevice.h#L42

Just remember to change uint8_t* to std::string.

fjfuente13 commented 5 years ago

Hi, thanks for the answer.

I've tried what you tell me, but when I add it to the bluetooth scan, all the data that tells me are 0.

In any case, I have found another way to get the data: (attached, in case it's useful for someone)

char md = BLEUtils::buildHexData(nullptr, (uint8_t)advertisedDevice.getManufacturerData().data(), advertisedDevice.getManufacturerData().length());

thank you and greetings,

El vie., 19 jul. 2019 a las 14:02, chegewara (notifications@github.com) escribió:

Hi. In theory you could create BLEBeacon variable, then use this function with reaw advertising data:

https://github.com/chegewara/esp32-snippets/blob/master/cpp_utils/BLEBeacon.cpp#L59

Then use functions to get data you need:

https://github.com/chegewara/esp32-snippets/blob/master/cpp_utils/BLEBeacon.cpp#L36-L52

Raw advertisement data you can get with this function:

https://github.com/chegewara/esp32-snippets/blob/master/cpp_utils/BLEAdvertisedDevice.h#L42

Just remember to change uint8_t* to std::string.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/chegewara/esp32-snippets/issues/11?email_source=notifications&email_token=AMD45CM3VS7JXNG2D3RETBTQAGUMXA5CNFSM4IETYR5KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD2LNZ2A#issuecomment-513203432, or mute the thread https://github.com/notifications/unsubscribe-auth/AMD45CNQ7FAO43JW7UMQB5DQAGUMXANCNFSM4IETYR5A .