elizarov
06/22/2017, 8:38 AMpipe
function for channel-to-channel transfer. Using pipe
the code can be made even more natural without constraint on the ordering:
fun BluetoothSocket.asyncListen() = produce(context) { ... } // natural-looking producer
fun configIncomingData(): BroadcastChannel<String> { ... } // broadcast consumer
// use it like this:
val producer = asyncListen()
val consumer = configIncomingData()
pipe(producer, consumer)