You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
I'm always frustrated when need to make additional data transformations if I want to simply read/write/observe bluetooth characteristics.
Describe the solution you'd like
I would like to have an extension of device flow which allows to access flow of bytes arrays or discovered characteristic for writing/reading.
For example:
operatorfun Flow<List<Service>>.get(uuidString:String) =this[uuidFrom(uuidString)] // Accss service with (string) id (so it can be used cross-platform)operatorfun Flow<List<Characteristic>>.get(uuidString:String) =this[uuidFrom(uuidString)] // Access characteristic with (string) idfun Flow<Device?>.dataFlow(serviceUUID:String, characteristicUUID:String) = characteristicsFlow(serviceUUID, characteristicUUID).flatMapConcat {
it.enableNotification()
it
}.map { it ?: bytesOf() }
fun Flow<Device?>.characteristicsFlow(serviceUUID:String, characteristicUUID:String) = services()[serviceUUID]
.characteristics()[characteristicUUID]
.filterNotNull()
Usage:
deviceFlow.characteristicsFlow(SERVICE_UUID, RX_CHARACTERISTIC_UUID)
val data = deviceFlow.dataFlow(SERVICE_UUID, TX_CHARACTERISTIC_UUID).take(10).toList()
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
I'm always frustrated when need to make additional data transformations if I want to simply read/write/observe bluetooth characteristics.
Describe the solution you'd like
I would like to have an extension of device flow which allows to access flow of bytes arrays or discovered characteristic for writing/reading.
For example:
Usage:
The text was updated successfully, but these errors were encountered: