OpenBluetoothToolbox / SimpleBLE

SimpleBLE - the all-in-one Bluetooth library for MacOS, iOS, Windows, Linux and Android.
https://www.simpleble.org
Other
660 stars 111 forks source link

Manufacturer Specific AD Elements in Scan Callback Missing #194

Closed eriklins closed 1 year ago

eriklins commented 1 year ago

I found issues with manufacturer specific data with the SimpleBLE C library on Windows:

The scan callback never exposes more than two manufacturer specific data elements. Technically it is possible to have e.g., two MD elements in the advert report and another two in the scan report. I made such a device for testing and SimpleBLE exposes just the two MDs from the advert report but none from the scan report in the scan callback event. If I have just one MD in the advert report and one in the scan report, then both are exposed in the same callback event.

For the above I used four MD elements all having different manufacturer ids. If I change the situation to just two MD elements in one report with the SAME manufacturer id, then two subsequent callback events are thrown for each advert. One contains the first MD element, the other one contains the second MD element. Not sure if this is desired and we won't actually loose any advert information, but from an application perspective it looks like the content of the AD elements would change from advert to advert instead of realising it's two different AD elements.

However, all this might be picky and in the real world more than one AD element per report is an uncommon situation. Just wanted to raise it to let others know.

kdewald commented 1 year ago

@eriklins could you test this again with the latest release? There was a related bug on Windows, so it might already be solved.

eriklins commented 1 year ago

@kdewald I pulled the latest main as of today and still the same. Only the first MD element is shown per advert and scan report.

eriklins commented 1 year ago

@kdewald I finally found the root cause of this issue being not related to SimpleBLE but to my code.