AbstractMavConnection

A connection state aware abstract implementation of MavConnection.

All operations that don't explicitly happen in the correct state maintained by the user throw IOException. For example, calling close again while the previous connection is closed results in an IOException being thrown.

The benefit of using this class is that it makes the state management of the underlying connection saved in the State.Open.connection field more easy and predictable. Also, the inheritors of this class only need to implement the open method.

Constructors

Link copied to clipboard
constructor()

Functions

Link copied to clipboard
override fun close()
Link copied to clipboard
override 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
override fun next(): MavFrame<out MavMessage<*>>

Reads a MAVLink frame from for the underlying connection.

Link copied to clipboard
override 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
override 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
override fun <T : MavMessage<T>> sendV1(systemId: UByte, componentId: UByte, payload: T)

Sends the provided payload wrapped in a Mavlink v1 frame.