Giter VIP home page Giter VIP logo

Comments (12)

 avatar commented on August 16, 2024 1

Yes, it's happening always after a 133 error

I'm testing on Nexus 6P

public void connect() throws FailureReason {
    bleManager.setGattCallbacks(this);

    try {
      bleManager.connect(bluetoothDevice).await();
    } catch (InvalidRequestException
        | RequestFailedException
        | DeviceDisconnectedException
        | BluetoothDisabledException e) {
      throw new FailureReason(e);
    }
  }
Completable.create(
              emitter -> {
                try {
                  deviceDriver.connect();

                  if (!emitter.isDisposed()) {
                    emitter.onComplete();
                  }
                } catch (Exception e) {
                  emitter.tryOnError(e);
                }
              })
          .subscribeOn(Schedulers.io())
          .retryWhen(new RetryWithDelay(3, 600))

And the exception

16:13:14.735 W/System.err: com.mycompany.sdk.error.FailureReason: Critical error : Request failed with status -5
16:13:14.736 W/System.err:     at com.mycompany.sdk.core.driver.ble.MyBleDriver.connect(MyBleDriver.java:127)
16:13:14.736 W/System.err:     at com.mycompany.sdk.core.driver.ble.ModelDriver.connect(ModelDriver.java:17)
16:13:14.737 W/System.err:     at com.mycompany.sdk.core.KLTBConnectionImpl.lambda$establish$0(ConnectionImpl.java:271)
16:13:14.738 W/System.err:     at com.mycompany.sdk.core.-$$Lambda$ConnectionImpl$M-xyHm1uT6ux5XLimu1x5Qxi-EE.subscribe(Unknown Source:2)
16:13:14.738 W/System.err:     at io.reactivex.internal.operators.completable.CompletableCreate.subscribeActual(CompletableCreate.java:39)
16:13:14.738 24675-24675/com.mycompany.debug D/BluetoothGatt: close()
16:13:14.739 24675-24675/com.mycompany.debug D/BluetoothGatt: unregisterApp() - mClientIf=7
16:13:14.739 W/System.err:     at io.reactivex.Completable.subscribe(Completable.java:2185)
16:13:14.739 W/System.err:     at io.reactivex.internal.operators.completable.CompletableSubscribeOn$SubscribeOnObserver.run(CompletableSubscribeOn.java:64)
16:13:14.739 W/System.err:     at io.reactivex.Scheduler$DisposeTask.run(Scheduler.java:578)
16:13:14.740 W/System.err:     at io.reactivex.internal.schedulers.ScheduledRunnable.run(ScheduledRunnable.java:66)
16:13:14.740 W/System.err:     at io.reactivex.internal.schedulers.ScheduledRunnable.call(ScheduledRunnable.java:57)
16:13:14.741 W/System.err:     at java.util.concurrent.FutureTask.run(FutureTask.java:266)
16:13:14.741 W/System.err:     at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:301)
16:13:14.741 W/System.err:     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
16:13:14.742 W/System.err:     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
16:13:14.742 W/System.err:     at java.lang.Thread.run(Thread.java:764)
16:13:14.744 E/MyBleDriver: onError: a BLE error has occurred message = Error on connection state change, code = 133
16:13:14.745 D/AndroidRuntime: Shutting down VM


    --------- beginning of crash
16:13:14.751 E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.colgate.colgateconnect.debug, PID: 24675
    java.lang.NullPointerException: Attempt to invoke direct method 'void no.nordicsemi.android.ble.BleManager$BleManagerGattCallback.nextRequest(boolean)' on a null object reference
        at no.nordicsemi.android.ble.BleManager$BleManagerGattCallback.access$1300(BleManager.java:1836)
        at no.nordicsemi.android.ble.BleManager.lambda$enqueue$4(BleManager.java:1804)
        at no.nordicsemi.android.ble.-$$Lambda$BleManager$KDSxdgn5nClZRFe_FvyLUfX8mWc.run(Unknown Source:2)
        at android.os.Handler.handleCallback(Handler.java:790)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loop(Looper.java:164)
        at android.app.ActivityThread.main(ActivityThread.java:6494)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)

from android-ble-library.

 avatar commented on August 16, 2024 1

Yep, that's the scenario

from android-ble-library.

 avatar commented on August 16, 2024 1

I'm going to do it right now

from android-ble-library.

 avatar commented on August 16, 2024 1

I haven't been able to reproduce the issue, congrats!

Also, I'd say this branch works much better, I'd say there was a stability decrease in beta 3, I don't know if it makes sense 🤷‍♂️

from android-ble-library.

philips77 avatar philips77 commented on August 16, 2024

There is no callback for close(). What exactly did you do? You actually don't need to call close(), it does it automatically after you disconnect/fail to connect.

from android-ble-library.

 avatar commented on August 16, 2024

I was referring to those BluetoothGatt log lines. I edited the description with more details.

I'm still occasionally seeing the NPE when attempting to retry a connection to a disconnected device, even after introducing a 600ms delay

from android-ble-library.

philips77 avatar philips77 commented on August 16, 2024

Does it happen on error 133? Do you try to reconnect to the device there, or what are you doing? Could you, please, post some of your code related to this issue?

from android-ble-library.

philips77 avatar philips77 commented on August 16, 2024

You are still trying to connect to a switched-off device, yes? And time-outing after 30 sec, yes?

from android-ble-library.

philips77 avatar philips77 commented on August 16, 2024

Hi, could you load the BLE library from the project instead of jcenter? I could send you the BleManager.java file for testing. Ok?

from android-ble-library.

philips77 avatar philips77 commented on August 16, 2024

Please, check out branch bugfix/29.

from android-ble-library.

 avatar commented on August 16, 2024

I'll try to do it later today 👍

from android-ble-library.

philips77 avatar philips77 commented on August 16, 2024

Hi, I've added some more features to the mentioned branch, including automatic connection retries with delay. I've just pushed my recent changes. Did you have time to check the fix?

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.