Comments (12)
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.
Yep, that's the scenario
from android-ble-library.
I'm going to do it right now
from android-ble-library.
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.
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.
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.
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.
You are still trying to connect to a switched-off device, yes? And time-outing after 30 sec, yes?
from android-ble-library.
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.
Please, check out branch bugfix/29.
from android-ble-library.
I'll try to do it later today 👍
from android-ble-library.
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)
- Is there any adaptation for Android 14? HOT 1
- What would cause GATT services to be invalidated on previously bonded peripherals? HOT 2
- Null reference exception when calling disconnect HOT 2
- Sometimes onServiceDiscoverd is not called when connecting. HOT 1
- Samsung Tab S6 Lite: Connection Parameter Negotiation HOT 1
- Catch SecurityException from setCharacteristicNotification HOT 2
- NullPointerException android.bluetooth.BluetoothGattServer.cancelConnection(android.bluetooth.BluetoothDevice)' on a null object reference HOT 3
- Library DefaultMtuSplitter is splitting incorrectly for android OS 14 HOT 8
- How to Catch Exception with RequestFailedException HOT 1
- Ask a question, thank you HOT 1
- Want to get the characteristic on which the data was received for the characteristics I have subscribed to get notified for HOT 2
- Concurrent modification exception while notifying device disconnected
- Disconnect not working on various Samsung devices HOT 2
- No response from writeCharacteristic HOT 5
- Question: Will this allow me to send HCI Level Commands? HOT 1
- I stoped receiving notifications even when i have still not get all data HOT 23
- Sometimes causing system Bluetooth to crash. HOT 4
- Notification does not clear after setup a device HOT 3
- Connection interval changes on its own HOT 3
- OTA upgrade problem HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from android-ble-library.