File tree 1 file changed +3
-4
lines changed
libraries/BLE/examples/BLE_Beacon_Scanner
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
87
87
{
88
88
Serial.println (" Found an EddystoneURL beacon!" );
89
89
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));
93
92
std::string bareURL = foundEddyURL.getURL ();
94
93
if (bareURL[0 ] == 0x00 )
95
94
{
@@ -98,7 +97,7 @@ class MyAdvertisedDeviceCallbacks : public BLEAdvertisedDeviceCallbacks
98
97
uint8_t *payLoad = advertisedDevice.getPayload ();
99
98
for (int idx = 0 ; idx < payLoadLen; idx++)
100
99
{
101
- Serial.printf (" 0x%08X " , payLoad[idx]);
100
+ Serial.printf (" 0x%02X " , payLoad[idx]);
102
101
}
103
102
Serial.println (" \n Invalid Data" );
104
103
return ;
You can’t perform that action at this time.
0 commit comments