https://kotlinlang.org logo
#android
Title
# android
d

Darrinps

07/06/2019, 8:18 PM
Does anyone know how to use the BleGattCoroutines notifications? I can't find any example of it. Normally you'll have a BluetoothGattCallback to intercept a notification change and can read the data there. Don't see how this is done with BleGattCoroutines though.
l

louiscad

07/06/2019, 10:24 PM
Look at the
GattConnection
interface, and search for "notification", you'll find two ways to do it. I'll update it to kotlinx.coroutines 1.3.0-M2 later today BTW.
d

Darrinps

07/08/2019, 1:37 PM
Thank you Louis
l

louiscad

07/08/2019, 1:42 PM
Sorry for being late, I still plan to update kotlinx.coroutines. You can "Watch releases" on GitHub to be notified about it.
d

Darrinps

07/08/2019, 1:44 PM
I just checked it. Thanks for letting me know. I'll do that.
l

louiscad

07/14/2019, 3:53 PM
I wasn't sure but I didn't use
Flow
preview in BleGattCoroutines, so I don't need to update it. I'll probably add support for it in 1.3.0 though. I hope it's working well for you.
d

Darrinps

07/16/2019, 1:50 PM
I ended up rolling my own for most of the reading, but I am using it for discovery and printing/debugging. That Print is a great tool to see what's going on. I'll probably refactor to fully integrate with BleCoroutines in the future. I just had the examples I needed in place using the callback so it was quicker to get going (tight deadline for that part).
8 Views