Comments (10)
I think I have figured out why it is not reconnecting automatically anymore.
There is a conceptual change how to react on BluetoothProfile.STATE_DISCONNECTED
in the Gatt-callback: you destroy every time there is a "disconnection" all connection-data by calling gatt.close()
although the connection was "only" lost for example because being out of range. In this case a later re-connection is not possible. The "old" version (until version 1.4.0) only called gatt.close()
when the disconnection was initiated by the user but kept the connection-data in all other cases of disconnection.
@chipweinberger Can you confirm my analysis? Do you see any problem to change back to the previous concept of calling gatt.close()
only when disconnect was initiated by the user?
from flutter_blue_plus.
thanks for your analysis
yes we changed the behavior of
gatt.close
to free up resources. Most phones only have enough resources for 6 connections, and will deny new connections. It is best to free resources automatically when the connection is lost.that said, we could change the code to not call
gatt.close
if autoconnect is enabled for that connection.in this case, the user will have to manually call disconnect to free up resources.
perhaps you can try that and let me know if it works.
That is a good idea and even an improvement to the "old" concept which kept the connection-data unnecessarily even without "autoConnect" activated.
I will create a PR.
from flutter_blue_plus.
should be fixed in 1.14.12
from flutter_blue_plus.
thanks for filing. I'm not sure the problem to be honest.
from flutter_blue_plus.
Same for me: in older versions of flutter_blue_plus (I can not say until which version) the auto-re-connect worked, too, and now it does work anymore.
from flutter_blue_plus.
I probably will not fix this issue myself.
if you figure it out, open a PR please.
from flutter_blue_plus.
thanks for your analysis
yes we changed the behavior of gatt.close
to free up resources.
Most phones only have enough resources for 6 connections, and will deny new connections. It is best to free resources automatically when the connection is lost.
that said, we could change the code to not call gatt.close
if autoconnect is enabled for that connection.
in this case, the user will have to manually call disconnect to free up resources.
perhaps you can try that and let me know if it works.
from flutter_blue_plus.
Well done @MartinXBcn. I'm sorry I can't help you guys on this. I don't have too much knowledge with native code.
Ets el rei Martin!
from flutter_blue_plus.
fixed in master: 9c44bc4
from flutter_blue_plus.
Thanks, @MartinXBcn @chipweinberger
from flutter_blue_plus.
Related Issues (20)
- [Help]: The second time cannot be written HOT 3
- [Bug]: secondary services dont work HOT 6
- [Help]: Empty scan result on HiOS v14.0.0 HOT 5
- [Help]: Why can't my reading and listening receive any information HOT 2
- [Help]: onValueReceived stops receiving data if screen turned off or app moved in the background
- [Help]: Auto connect only works when scanning after disconnection HOT 1
- [Feature]: read/write/notify value as raw bytes HOT 1
- [Bug]: Certain Bluetooth devices crash with GATT_INSUFFICIENT_RESOURCES on Android because of iOS compatibility code HOT 6
- [Help]: Handling Android limiting 5 scans in 30 seconds HOT 3
- [Help]: Problems when using with "flutter_ble_peripheral" packge HOT 1
- Bluetooth permission
- [Help]: Delay when disconnect HOT 2
- [Help]: Bluetooth device shows up in iOS "Other Devices" but not through FlutterBluePlus HOT 1
- [Feature]: Refresh cache without connected HOT 1
- [Help]: Unused UUID on the BLE device causes error code 14 on IOS ONLY. HOT 2
- [Feature]: Is it possible to increase the minSdk Version HOT 2
- [Help]: Samsung mobile phone HOT 2
- [Help]: ble pairing request popup appears twice HOT 4
- Unable to obtain Bluetooth devices connected to the system HOT 2
- [Help]: BluetoothDevice.fromProto::platformName HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flutter_blue_plus.