MavConnection

interface MavConnection : Closeable

A connection interface with a MAVLink device.

All the methods are blocking and can throw IOException. This is a design decision to keep the interface simple and to allow the user to decide how to handle the blocking calls and the IO errors.

Normally, the users will use wrappers/adapters like the com.divpundir.mavlink.adapters.coroutines which provides a coroutine based api to the underlying connection.

See also

com.divpundir.mavlink.adapters.coroutines.CoroutinesMavConnection
com.divpundir.mavlink.adapters.rxjava2.Rx2MavConnection
com.divpundir.mavlink.adapters.rxjava3.Rx3MavConnection

Inheritors

Functions

Link copied to clipboard
expect abstract fun close()
Link copied to clipboard
abstract fun connect()

Creates the underlying connection so that the implementation have the resources to manage the input and output of data according to the protocol used. E.g. for TCP connections this would open the socket.

Link copied to clipboard
abstract fun next(): MavFrame<out MavMessage<*>>

Reads a MAVLink frame from for the underlying connection.

Link copied to clipboard
abstract fun <T : MavMessage<T>> sendSignedV2(systemId: UByte, componentId: UByte, payload: T, linkId: UByte, timestamp: UInt, secretKey: ByteArray)

Sends the provided payload wrapped in a signed MAVLink v2 frame.

Link copied to clipboard
abstract fun <T : MavMessage<T>> sendUnsignedV2(systemId: UByte, componentId: UByte, payload: T)

Sends the provided payload wrapped in an unsigned MAVLink v2 frame.

Link copied to clipboard
abstract fun <T : MavMessage<T>> sendV1(systemId: UByte, componentId: UByte, payload: T)

Sends the provided payload wrapped in a Mavlink v1 frame.