-
Notifications
You must be signed in to change notification settings - Fork 85
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
GATT_INVALID_PDU
can trigger between rapid disconnect/connect cycles on Android
#604
Comments
Thanks! ❤️
Yikes, and thanks for reporting this issue with such a detailed report.
The
Then updated from the kable/core/src/androidMain/kotlin/gatt/Callback.kt Lines 108 to 113 in f5bf08b
Any delay in propagating that state from kable/core/src/androidMain/kotlin/gatt/Callback.kt Lines 100 to 104 in f5bf08b
Perhaps it is another quark of the Android BLE system where if you reconnect too quickly that Android doesn't reset it's internal timer for allowing successive calls of Ultimately, something I'd like to look into further, but it is unlikely I'll have to time to prioritize this in the near future. |
Thank you for the response. I'll let you know if I observe anything else around this. 👍 |
Hey there. Just wanted to say awesome work on the library -- works very well so far.
So far, I've observed one interesting behavior around MTU requests: I wired up a simple connect/disconnect button in a test app for connecting to a device with an nRF chipset. This app is running on Android 13. Both connect and disconnect work fine in almost all cases. I was doing an MTU request in the
onServicesDiscovered
callback per the docs:Successful MTU Request (~1.5 seconds between attempts):
MTU Request Failure(~0.5 seconds between attempts):
I noticed that if I attempt to reconnect to the device within roughly 1 second of the peripheral state reporting a disconnect, I'll get the
GATT_INVALID_PDU
error. If I wait roughly 2 seconds or more, it successfully re-requests the MTU. Almost seems like there is a tiny ~1-second window between Kable reporting the disconnection state and the BLE peripheral actually being fully disconnected. I haven't gotten to test if this happens with other BLE peripherals just yet. Could very well be a nuance with Android Bluetooth / GATT or Nordic, but just thought I'd point it out.The text was updated successfully, but these errors were encountered: