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

[Help]: Unable to disconnect cached connection #678

Closed mengzhidaren closed 1 year ago

mengzhidaren commented 1 year ago

Requirements

Have you checked this problem on the example app?

No

FlutterBluePlus Version

1.28.10

Flutter Version

Flutter 3.13.9

What OS?

Android

OS Version

android9

Bluetooth Module

none

What is your problem?

Question 1:

 final cache = await FlutterBluePlus.systemDevices
 for (var element in cache) {
 //await element.disconnect(queue: true);
 await element.disconnect(queue: false);
}

Unable to disconnect cached connection

Question 2: If connecting a cache device:

 final cache = await FlutterBluePlus.systemDevices
 for (var element in cache) {
element .connect()......
//....
await characteristic.setNotifyValue(true)
characteristic.onValueReceived.listen(e){
//There will be duplicate callback data here
//The device's callback will send the same data twice each time
}
}

Logs

no
chipweinberger commented 1 year ago

for question 1. you are correct. Those devices are not connected to your app. you cannot disconnect them. You can try connecting then disconnecting, im not sure what will happen tbh.

for question 2, see README. duplicate data is common problem.

mengzhidaren commented 1 year ago

Thank you so much