File tree Expand file tree Collapse file tree 1 file changed +3
-4
lines changed
libraries/BLE/examples/BLE_Beacon_Scanner Expand file tree Collapse file tree 1 file changed +3
-4
lines changed Original file line number Diff line number Diff line change @@ -87,9 +87,8 @@ class MyAdvertisedDeviceCallbacks : public BLEAdvertisedDeviceCallbacks
8787 {
8888 Serial.println (" Found an EddystoneURL beacon!" );
8989 BLEEddystoneURL foundEddyURL = BLEEddystoneURL ();
90- std::string eddyContent ((char *)payLoad); // incomplete EddystoneURL struct!
91-
92- foundEddyURL.setData (eddyContent);
90+ uint8_t URLLen = *(payLoad - 4 ) - 3 ; // Get Field Length less 3 bytes (type and UUID)
91+ foundEddyURL.setData (std::string ((char *)payLoad, URLLen));
9392 std::string bareURL = foundEddyURL.getURL ();
9493 if (bareURL[0 ] == 0x00 )
9594 {
@@ -98,7 +97,7 @@ class MyAdvertisedDeviceCallbacks : public BLEAdvertisedDeviceCallbacks
9897 uint8_t *payLoad = advertisedDevice.getPayload ();
9998 for (int idx = 0 ; idx < payLoadLen; idx++)
10099 {
101- Serial.printf (" 0x%08X " , payLoad[idx]);
100+ Serial.printf (" 0x%02X " , payLoad[idx]);
102101 }
103102 Serial.println (" \n Invalid Data" );
104103 return ;
You can’t perform that action at this time.
0 commit comments