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

Darrinps

07/11/2019, 1:19 AM
Performance question for reading a stream of bytes concurrently while in an app (coroutine here maybe)? I'm looking for the best way to read a characteristic (BLE) that in this case, has streaming data (yes, I know it can only emit packets of 20 on BLE 4). The data will mostly be 0's which I will ignore, but at some point a tag byte (0xFF let's say) hits the stream, then after that, the next 15 bytes have significance. It could return to more 0's after or be another tag byte (0xFF) to signify the start of another 15 bytes of valid data. Now, when the connection is established and the app starts to read, it has no way to know if the stream being omitted by the BLE device is in the middle of a packet or not. The only thing we know is that there won't be a tag within the packet...only at the beginning of one. So, it's basically a process of read...read....read until we see a 0xFF, grab the next 15 bytes, process it, then start again...read read read.... Thoughts?
r

rkeazor

07/11/2019, 4:21 AM
My thought is this has nothing to do with Kotlin lol
Try Android Slack
d

Darrinps

07/11/2019, 4:37 AM
Coroutines? That was my first thought, and I thought this was for Android Kotlin?