chipweinberger / flutter_blue_plus

Flutter plugin for connecting and communicationg with Bluetooth Low Energy devices, on Android, iOS, macOS
Other
791 stars 479 forks source link

[Bug]: iOS 17.1.1 | manufacturereData is empty in ScanResult.advertisementData.manufacturerData #698

Closed DavorStajcer closed 1 year ago

DavorStajcer commented 1 year ago

Requirements

Have you checked this problem on the example app?

No

FlutterBluePlus Version

1.29.4

Flutter Version

3.16.0

What OS?

iOS

OS Version

17.1.1

Bluetooth Module

Not sure

What is your problem?

I have an IOT product. When scanning, the product is found. From the ScanResult object I take ScanResult.advertisementData.manufacturerData[2775] to decode information about the product article and serial number. This key is not present in the manufacturerData (map is empty)

Things to consider:

Screenshot 2023-11-23 at 11 29 59

Code:

Screenshot 2023-11-23 at 11 39 02

Logs

There is no logs
seymooreth3myth commented 1 year ago

The same is happening here.

seymooreth3myth commented 1 year ago

@DavorStajcer here using the example flutter_blue_plus the manufactureData isn't empty. The reason? I don't know.

seymooreth3myth commented 1 year ago

@DavorStajcer Here works with:

await FlutterBluePlus.startScan(
      timeout: const Duration(seconds: 6),
      continuousUpdates: true,
      continuousDivisor: 1,
    );

I have recently noticed that following an update, the functionality to access manufacturerData on iOS has been impacted unless the continuousUpdates and continuousDivisor parameters are specified. Prior to this change, these parameters were not required to retrieve this data.

While I understand that updates and improvements are essential to the development of any library, changes that affect existing functionality can cause significant inconvenience for developers relying on your library. It would be helpful if such changes were clearly documented, and if possible, provide a smoother transition or alternatives to maintain compatibility with previous implementations.

FlutterBluePlus Team, thank you for your continued work in improving the library, and I hope you will consider this feedback for future updates.

chipweinberger commented 1 year ago

you should not need continuousUpdates and continuousDivisor

the only reason you might need those is if your ble device advertises nothing and but then later changes the advertisement data.

that said, there's a change i should make so you should only have to set a withMsd scan filter.

Works on lower iOS versions

this suggests it is a bug in ios.

please provide logs. verbose logs.

also, all breaking changes are listed in MIGRATION.md

seymooreth3myth commented 1 year ago
flutter: [FBP] \^[[1;30m<setLogLevel>\^[[0m args: \^[[1;35<…>
flutter: [FBP] \^[[1;30m<setLogLevel>\^[[0m result: \^[[1;33mtr<…>
flutter: [FBP] \^[[1;30m<getAdapterState>\^[[0m args: \^[[1;35mnu<…>
flutter: [FBP] \^[[1;30m[[ OnAdapterStateChanged ]]\^[[0m result: \^[[1;33m{adapter_state: <…>
flutter: [FBP] \^[[1;30m<getAdapterState>\^[[0m result: \^[[1;33m{adapter_state: <…>
flutter: [FBP] \^[[1;30m<getSystemDevices>\^[[0m args: \^[[1;35mnu<…>
flutter: [FBP] \^[[1;30m<getSystemDevices>\^[[0m result: \^[[1;33m{devices: [<…>
flutter: [FBP] \^[[1;30m<startScan>\^[[0m args: \^[[1;35m{with_services: [], with_remote_ids: [], with_names: [], with_keywords: [], with_msd: [], with_service_data: [], continuous_updates: false, continuous_divisor: 4, android_scan_mode: 2, android_uses_fine_location: fals<…>
flutter: [FBP] \^[[1;30m<startScan>\^[[0m result: \^[[1;33mtr<…>
flutter: [FBP] \^[[1;30m[[ OnScanResponse ]]\^[[0m result: \^[[1;33m{advertisements: [{rssi: -95, remote_id: 1ED30DF4-FB03-3395-B181-FBC8830F950D, manufacturer_data: {6: 010f2022a854462240f8a377ced2732c86b0f6f5af4ad5aebc1156}}<…>
flutter: [FBP] \^[[1;30m[[ OnScanResponse ]]\^[[0m result: \^[[1;33m{advertisements: [{rssi: -40, remote_id: 9F63C197-36D3-3D47-12F1-EB471C121E54}<…>
flutter: [FBP] \^[[1;30m[[ OnScanResponse ]]\^[[0m result: \^[[1;33m{advertisements: [{remote_id: 7B41903C-582C-65F1-6C0A-EF663C68CC66, platform_name: 287-2B, service_uuids: [6e400001-b5a3-f393-e0a9-e50e24dcca3e], connectable: 1, rssi: -75, adv_name: 287-2B}<…>
flutter: [FBP] \^[[1;30m[[ OnScanResponse ]]\^[[0m result: \^[[1;33m{advertisements: [{remote_id: AC04D4FE-E134-2A2F-A590-3CF0FFADE603, platform_name: F1 WATCH, rssi: -61, connectable: 1, adv_name: F1 WATCH}<…>
flutter: [FBP] \^[[1;30m[[ OnScanResponse ]]\^[[0m result: \^[[1;33m{advertisements: [{remote_id: 465FA1C5-C625-03BD-0F19-1C1BF3F9C321, rssi: -41, connectable: 1, tx_power_level: 12}<…>
flutter: [FBP] \^[[1;30m[[ OnScanResponse ]]\^[[0m result: \^[[1;33m{advertisements: [{remote_id: 3239DA7B-B689-261C-B137-D17FBA9B146A, platform_name: Mac Pro de Fábio, rssi: -41, connectable: 1, tx_power_level: 12}<…>
flutter: [FBP] \^[[1;30m[[ OnScanResponse ]]\^[[0m result: \^[[1;33m{advertisements: [{remote_id: 001C5E4B-FC9C-A45D-4519-29F7F5907709, platform_name: F1 WATCH, rssi: -53, connectable: 1, adv_name: F1 WATCH}<…>
flutter: [FBP] \^[[1;30m[[ OnScanResponse ]]\^[[0m result: \^[[1;33m{advertisements: [{remote_id: 148371E1-0ED5-7E6C-6EF6-44243BC30418, rssi: -95, connectable: 1, tx_power_level: 6}<…>
flutter: [FBP] \^[[1;30m[[ OnScanResponse ]]\^[[0m result: \^[[1;33m{advertisements: [{remote_id: B81B8BC5-4E98-A52F-81D8-64002CEFD4E8, rssi: -92, connectable: 1, tx_power_level: 12}<…>
flutter: [FBP] \^[[1;30m[[ OnScanResponse ]]\^[[0m result: \^[[1;33m{advertisements: [{rssi: -43, remote_id: A1EAD4C2-41FF-1673-07F5-503CC697065C}<…>
flutter: [FBP] \^[[1;30m<stopScan>\^[[0m args: \^[[1;35mnu<…>
flutter: [FBP] \^[[1;30m<stopScan>\^[[0m result: \^[[1;33mtr<…>

like this?

chipweinberger commented 1 year ago

try 1.29.6

seymooreth3myth commented 1 year ago

Working perfectly now without passing arguments. Good job. Thank you!

DavorStajcer commented 1 year ago

@chipweinberger Thanks!