GithubHelp home page GithubHelp logo

Comments (4)

manolofdez avatar manolofdez commented on September 28, 2024

HI! I'm not sure I follow. The CentralManager is not an Actor, only the waitUntilReadyExecutor. I think it might be more correct to pass in a conditional block to the enqueue function, so that after it awaits it checks the given conditional block before enqueuing. I haven't encountered this issue yet, but I'll put it in the backlog.

For now timeouts are not handled by the library. But yes, I hope to eventually add convenience overloads.

from asyncbluetooth.

VincentBeltman avatar VincentBeltman commented on September 28, 2024

Hi! We've encountered this bug now too. Unfortunately we don't see this on all devices and it doesn't happen every time. We couldn't find the common denominator. I created a timeout mechanism around the waitUntilReady that retries it it times out. If the bug presents itself and the retry happens, the waitUntilReady always returns directly. I did walk through this repo trying to find out why this happens, but unfortunately your "magic" is too difficult for me :).
Please let me know if you could use more information.

from asyncbluetooth.

VincentBeltman avatar VincentBeltman commented on September 28, 2024

Did some extra digging. I guess there is a very small window inside waitUntilReady where first you check the state and afterwards you enqueue to the waitUntilReadyExecutor. If centralManagerDidUpdateState is called in between, then to my knowledge the executor will never be called (until the state changes, but that'd only happen when bluetooth is manually disabled/enabled). @manolofdez What do you think?

from asyncbluetooth.

manolofdez avatar manolofdez commented on September 28, 2024

Yeah. Actually, it should only hold up that first call to waitUntilReady. If it changed before enqueuing it, subsequent calls should be able to continue because the waitUntilReady function will first check immediately before enqueuing.

That said, we can check whether Bluetooth is ready in the enqueued block to avoid waiting indefinitely on that first call. I'll merge this. If you can, please let me know if this fixes it.

from asyncbluetooth.

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.