Giter VIP home page Giter VIP logo

Comments (8)

 avatar commented on August 16, 2024

This fixes the issue for now, but it's not pretty

This is a wrapper that holds the BleManager class

public void connect() {
    forceDisconnect.set(false);
    bleManager.setGattCallbacks(this);

    try {
      bleManager.connect(bluetoothDevice).await();
    } catch (RequestFailedException | DeviceDisconnectedException | BluetoothDisabledException e) {
      if (forceDisconnect.get()) {
        bleManager.setGattCallbacks(this);

        bleManager.close();
      }

      e.printStackTrace();
    }
  }

public void disconnect() {
    forceDisconnect.set(true);

    bleManager.disconnectWithoutReconnect();
  }

from android-ble-library.

philips77 avatar philips77 commented on August 16, 2024

Hi, I'll look into it. Thanks for the report!

from android-ble-library.

philips77 avatar philips77 commented on August 16, 2024

Hi @maragues-kolibree,
I was thinking about what should actually happen in this case.
First of all, the correct way of closing pending connection attempt is by setting a timeout. This may be set wither using enqueue(int) or await(int). The PR makes sure the connection gets cancelled in such case.
Also, the lib won't start another connection if the first one failed dues to a timeout.

from android-ble-library.

 avatar commented on August 16, 2024

If you release a new beta, I can test next Monday

from android-ble-library.

philips77 avatar philips77 commented on August 16, 2024

I released beta3.

from android-ble-library.

philips77 avatar philips77 commented on August 16, 2024

Fixed in beta4 :)

from android-ble-library.

 avatar commented on August 16, 2024

It's fixed, congrats and thanks!!

It's beta3, not beta4, just to keep track for the future.

from android-ble-library.

 avatar commented on August 16, 2024

After this change, is there a way to invoke connect in a way that it keeps trying to reconnect after an error?

I know we can do it manually, just wondering.

from android-ble-library.

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.