Lilly
09/01/2022, 11:27 AMJavier
09/01/2022, 11:51 AMsuspend fun main() {
val something = someSuspend()
… // this will not be executed until someSuspend() ends
}
Lilly
09/01/2022, 11:56 AMJavier
09/01/2022, 12:11 PMzip
or something similar can help youCasey Brooks
09/01/2022, 2:42 PMLilly
09/01/2022, 6:24 PMtransformWhile
) while flow1 sends data to the bluetooth socket. It is like ping pong...flow1 send request, flow2 listen to response and every successful request needs to be confirmed by receiving an Acknowledgement byte. flow1 has to wait for this confirmation. I can merge the code together but then I have requesting and receiving logic tightly coupled and that does not representing my current implementation which decouples both in a clean wayPaul Woitaschek
09/02/2022, 4:37 AMNick Allen
09/02/2022, 6:47 AMcoroutineScope {
val channel2 = flow2.produceIn(this)
try {
flow1.collectWhile {
sendRequest(it)
handleResponse(channel2.receiveCatching())
}
} finally {
channel2.close()
}
}
Javier
09/02/2022, 8:19 AM