BufferedMavConnection

class BufferedMavConnection(source: BufferedSource, sink: BufferedSink, resource: Closeable, dialect: MavDialect) : MavConnection

A MavConnection implementation that reads MavFrames form a BufferedSource and writes them to a BufferedSink. The dialect is used to deserialize the raw frame to a MavFrame. The resource is the origin of the source and the sink. For example, a TCP Socket or a serial port.

Constructors

Link copied to clipboard
constructor(source: BufferedSource, sink: BufferedSink, resource: Closeable, dialect: MavDialect)

Functions

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

Reads a MAVLink frame from for the underlying connection.

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

Sends the provided payload wrapped in a Mavlink v1 frame.