Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android low level library crash when the BLE device disconnects unexpectedly #860

Open
cmillauriaux opened this issue Apr 26, 2024 · 1 comment

Comments

@cmillauriaux
Copy link

Describe the bug
When I connect my Flutter application to a BLE object on battery, when the object runs out of battery and shuts down unexpectedly, the application crashes with a Java error stack

To Reproduce
Steps to reproduce the behavior:

  1. Connect to one device using connectTo()
  2. subscribe to a protected characteristic
  3. BLE peripheral shutdown because it runs out of battery
  4. Observe a failure with exception
io.reactivex.exceptions.UndeliverableException: The exception could not be delivered to the consumer because it has already canceled/disposed the flow or the exception has nowhere to go to begin with. Further reading: https://github.com/ReactiveX/RxJava/wiki/What's-different-in-2.0#error-handling | com.polidea.rxandroidble2.exceptions.BleDisconnectedException: Disconnected from MAC='XX:XX:XX:XX:XX:XX' with status 133 (GATT_ERROR)
                                                                                                    	at io.reactivex.plugins.RxJavaPlugins.onError(RxJavaPlugins.java:367)
                                                                                                    	at io.reactivex.internal.observers.LambdaObserver.onError(LambdaObserver.java:83)
                                                                                                    	at io.reactivex.internal.operators.observable.ObservableRetryPredicate$RepeatObserver.onError(ObservableRetryPredicate.java:90)
                                                                                                    	at io.reactivex.observers.SerializedObserver.onError(SerializedObserver.java:153)
                                                                                                    	at io.reactivex.internal.operators.observable.ObservableDelay$DelayObserver$OnError.run(ObservableDelay.java:128)
                                                                                                    	at io.reactivex.internal.schedulers.ScheduledRunnable.run(ScheduledRunnable.java:66)
                                                                                                    	at io.reactivex.internal.schedulers.ScheduledRunnable.call(ScheduledRunnable.java:57)
                                                                                                    	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
                                                                                                    	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:301)
                                                                                                    	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
                                                                                                    	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
                                                                                                    	at java.lang.Thread.run(Thread.java:919)
                                                                                                    Caused by: com.polidea.rxandroidble2.exceptions.BleDisconnectedException: Disconnected from MAC='XX:XX:XX:XX:XX:XX' with status 133 (GATT_ERROR)
                                                                                                    	at com.polidea.rxandroidble2.internal.connection.RxBleGattCallback$2.onConnectionStateChange(RxBleGattCallback.java:81)
                                                                                                    	at android.bluetooth.BluetoothGatt$1$4.run(BluetoothGatt.java:272)
                                                                                                    	at android.bluetooth.BluetoothGatt.runOrQueueCallback(BluetoothGatt.java:780)
                                                                                                    	at android.bluetooth.BluetoothGatt.access$200(BluetoothGatt.java:41)
                                                                                                    	at android.bluetooth.BluetoothGatt$1.onClientConnectionState(BluetoothGatt.java:267)
                                                                                                    	at android.bluetooth.IBluetoothGattCallback$Stub.onTransact(IBluetoothGattCallback.java:192)
                                                                                                    	at android.os.Binder.execTransactInternal(Binder.java:1021)
                                                                                                    	at android.os.Binder.execTransact(Binder.java:994)

Expected behavior
A catchable error to close the connexion on Flutter side

Smartphone / tablet

  • Device: Famoco
  • OS: Android 10
  • Package version: 5.2.0

Peripheral device

  • Vendor, model: Custom STMicroElectronics BLE device
  • Does it run a custom firmware / software: yes
@Giovanni-Fantin
Copy link

@cmillauriaux have you found the solution? If not, I can help you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants