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
Failed to read characteristic #22
Comments
I think the issue comes from the BluetoothCharacteristic class The method read uses gatt.readCharacteristic() of android library and this method is asynchronous : https://developer.android.com/reference/android/bluetooth/BluetoothGatt I tried with debugging and when I do breakpoints, it works and I get return value of the reading of characteristic. If I just run the app without breakpoint, it returns null value. So I think it's about a delay of the read() method of the BluetoothCharacteristic. But I'm too new in kotlin to provide you an correction but I hope someone will see this and help ! :) Thanks |
Hello there 🙂 I will take a look on your suggestions as soon as possible, thanks. |
FYI, your initial guess was spot on! Thank you :) |
You can check out a fix for it on #23 |
Please try v1.8.0 |
Are you using observe too? In non-notifiable characteristics, the library fallback to a legacy observe, which uses read. So when you call read you should wait until it returns to call read for the same characteristic again. Other characteristics will work fine. Are any of these edge scenarios affecting you? |
Would you be so kind to provide a minimum reproducible sample project? |
My bad, it's perfectly working when I read notifiable characteristic, but when I want to read a non notifiable characteristic it's not working, don't really know why, but pretty sure it's on my side Thanks again |
Hi there,
I'm pretty new with kotlin and bluetooth and I'm trying your nice library, scan device works perfectly, but when I want to connect to a device and read a characteristic I get a null return and this is what I get in log : (failed to read characteristic)
Here is my code :
I read that for reading 16 bits uuid with bluetooth low energy we have make uuid this form :
0000XXXX-0000-1000-8000–00805f9b34fb
But maybe I'm wrong ?
I got the uuid 0x180A with nrf Connect App and this is marked Read and correspond to the manufacturer brand name string.
I bet I'm doing something wrong but dont know what...
Thanks a lot !
The text was updated successfully, but these errors were encountered: