Jason Hartley
02/28/2023, 5:52 PMCasey Brooks
02/28/2023, 6:19 PMCasey Brooks
02/28/2023, 6:24 PMCoroutineScope
which includes a Dispatcher (such as <http://Dispatchers.IO|Dispatchers.IO>
). One of your Runnables would be a coroutine started with coroutineScope.launch { }
. Rather than passing data to listeners, you might use a Channel
or Flow
to pass data around. If the USB connection is lost, then you would cancel the CoroutineScope to stop processing the data and shut down the tasks that were launched into it.
This of course glosses over many of the details, but hopefully it gives you a place to start and some specific terms/APIs to look intoJason Hartley
02/28/2023, 6:40 PM