flutter_reactive_ble icon indicating copy to clipboard operation
flutter_reactive_ble copied to clipboard

Is it possible to get all bytes from ScanRecord on Android?

Open GsMoMo opened this issue 3 years ago • 3 comments

Is your feature request related to a problem? (please describe) I'm trying to use this library to collect the manufacturer data on iOS and Android. But I noticed the manufacturer data of the same device received by iOS and Android is quite different. On iOS, I'm able to get the complete raw data. So is there any way to get a byte array of ScanRecord.getBytes() on Android?

Describe the solution you'd like We could have another property "rawData" in the DiscoveredDevice.

Describe alternatives you've considered N/A

Additional context Thank you for the time to improve this library and make it work smoothly on iOS and Android.

GsMoMo avatar Dec 20 '22 05:12 GsMoMo

Hi, I faced the same issue. My solution was to manually set MTU size to max (247).

When, trying to connect to device. inside the listener (when you get the state as connected) call requestMtu with mtu as 247.

Example code:

flutterReactiveBle.connectToDevice(id: deviceId,)
    .listen((ConnectionStateUpdate connectionState) {
        if (connectionState.connectionState.name == 'connected') {
          flutterReactiveBle.requestMtu(deviceId: deviceId, mtu: 247);
          // your functionality.
        } 
    }
);

This should give you whole data on android. Hope this helps.

PranayCelllabs avatar Dec 22 '22 11:12 PranayCelllabs

Hi, I faced the same issue. My solution was to manually set MTU size to max (247).

When, trying to connect to device. inside the listener (when you get the state as connected) call requestMtu with mtu as 247.

Example code:

flutterReactiveBle.connectToDevice(id: deviceId,)
    .listen((ConnectionStateUpdate connectionState) {
        if (connectionState.connectionState.name == 'connected') {
          flutterReactiveBle.requestMtu(deviceId: deviceId, mtu: 247);
          // your functionality.
        } 
    }
);

This should give you whole data on android. Hope this helps.

Hi, Thank you for the information 😁. But I'm trying to get the complete information from an unconnectable BLE device (Beacon broadcasting). Therefore, setting MUT to a larger size is not available to me. 😅

GsMoMo avatar Dec 23 '22 00:12 GsMoMo

If not the whole ScanRecord, I'd be interested in the TXPOWER value from there. Didn't find a way to currently get that...

ray007 avatar Feb 15 '24 09:02 ray007