dotintent / FlutterBleLib

Bluetooth Low Energy library for Flutter with support for simulating peripherals
Apache License 2.0
530 stars 194 forks source link

Not standard manufacturer data #612

Open darrillaga opened 2 years ago

darrillaga commented 2 years ago

Hi,

I'm working with specific hardware which advertises two manufacturer data payloads but for same manufacturer id. For some reason iOS takes the one I need and everything works, but android library takes the other one (since there are two 0xFF types overrides the first with the second), so it does not work, ref at: https://github.com/dotintent/MultiPlatformBleAdapter/blob/669e438acb384eee74f3f1ada3ba259cf7b7965b/android/library/src/main/java/com/polidea/multiplatformbleadapter/AdvertisementData.java#L197.

I'm not pretending a change for this behavior since it does not seem to be standard, but I saw that MultiPlatformBLEAdapter exposes the raw data of the scan result which is enough to manage this custom scenario and I think it would be of help to other in same non standard situations.

Would you accept to start exposing to flutter layer also the raw bytes of the advertisement data?

I tried to imagine what the cons would be and I see that passing the bytes alongside some parsed data is already on it would be a little bit redundant. I also see iOS won't provide the exact same data on for this requirement than android does.

For reference I'm talking about data available in https://github.com/dotintent/MultiPlatformBleAdapter/blob/669e438acb384eee74f3f1ada3ba259cf7b7965b/android/library/src/main/java/com/polidea/multiplatformbleadapter/AdvertisementData.java#L49

In case this is seen as a good nice to have I could elaborate a little bit more and prepare a merge request.

Thanks!

darrillaga commented 2 years ago

Did some more investigation and it's seems the way the data arrives is due to android doing active BLE scan and it seems there is no easy way to turn it into passive