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.


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
asCoroutine(context)

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.