asCoroutine
A helper function to wrap a MavConnection as a CoroutinesMavConnection. The returned CoroutinesMavConnection uses the provided context to perform the IO operations of reading and sending the messages.
fun MavConnection.asCoroutine(context: CoroutineContext = IoDispatcher, onFailure: CoroutinesMavConnection.() -> Unit = {}): CoroutinesMavConnection
Deprecated
CoroutinesMavConnection with onFailure callback is deprecated and will be removed in the future releases. For checking the states including failure, use CoroutinesMavConnection.streamState.
Replace with
import com.divpundir.mavlink.adapters.coroutines.asCoroutine
Content copied to clipboard
asCoroutine(context)
Content copied to clipboard
A helper function to wrap a MavConnection as a CoroutinesMavConnection. The returned CoroutinesMavConnection uses the provided context to perform the IO operations of reading and sending the messages. The onFailure callback is invoked when an exception is thrown while reading the messages. This can be used to implement a custom reconnection strategy.