Git Product home page Git Product logo

Comments (10)

MartinXBcn avatar MartinXBcn commented on August 17, 2024 3

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.

MartinXBcn avatar MartinXBcn commented on August 17, 2024 2

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.

chipweinberger avatar chipweinberger commented on August 17, 2024 1

should be fixed in 1.14.12

from flutter_blue_plus.

chipweinberger avatar chipweinberger commented on August 17, 2024

thanks for filing. I'm not sure the problem to be honest.

from flutter_blue_plus.

MartinXBcn avatar MartinXBcn commented on August 17, 2024

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.

chipweinberger avatar chipweinberger commented on August 17, 2024

I probably will not fix this issue myself.

if you figure it out, open a PR please.

from flutter_blue_plus.

chipweinberger avatar chipweinberger commented on August 17, 2024

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.

ericaig avatar ericaig commented on August 17, 2024

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.

chipweinberger avatar chipweinberger commented on August 17, 2024

fixed in master: 9c44bc4

from flutter_blue_plus.

ericaig avatar ericaig commented on August 17, 2024

Thanks, @MartinXBcn @chipweinberger

from flutter_blue_plus.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.