Skip to content

Commit

Permalink
Fixes Eddystone URL decoding
Browse files Browse the repository at this point in the history
  • Loading branch information
SuGlider authored Feb 18, 2023
1 parent c9bf68d commit aa5486b
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,8 @@ class MyAdvertisedDeviceCallbacks : public BLEAdvertisedDeviceCallbacks
{
Serial.println("Found an EddystoneURL beacon!");
BLEEddystoneURL foundEddyURL = BLEEddystoneURL();
std::string eddyContent((char *)payLoad); // incomplete EddystoneURL struct!

foundEddyURL.setData(eddyContent);
uint8_t URLLen = *(payLoad - 4) - 3; // Get Field Length less 3 bytes (type and UUID)
foundEddyURL.setData(std::string((char*)payLoad, URLLen));
std::string bareURL = foundEddyURL.getURL();
if (bareURL[0] == 0x00)
{
Expand All @@ -98,7 +97,7 @@ class MyAdvertisedDeviceCallbacks : public BLEAdvertisedDeviceCallbacks
uint8_t *payLoad = advertisedDevice.getPayload();
for (int idx = 0; idx < payLoadLen; idx++)
{
Serial.printf("0x%08X ", payLoad[idx]);
Serial.printf("0x%02X ", payLoad[idx]);
}
Serial.println("\nInvalid Data");
return;
Expand Down

0 comments on commit aa5486b

Please sign in to comment.