Interface IMavlinkMessage<TSelf>

Namespace
MavNet.Protocol
Assembly
MavNet.Protocol.dll

Contract implemented by every generated MAVLink message type. Lets senders encode and frame the message without runtime dictionary lookups (the protocol metadata is known at the call site through static abstracts).

Implementations are readonly record structs emitted by tools/MavNet.CodeGen. Library users normally never write one by hand — they're produced from a dialect XML.

public interface IMavlinkMessage<TSelf> where TSelf : IMavlinkMessage<TSelf>

Type Parameters

TSelf

The implementing message type itself (CRTP).

Properties

CrcExtra

Per-message CRC_EXTRA seed that MAVLink mixes into the frame CRC.

public static abstract byte CrcExtra { get; }

Property Value

byte

MaxPayloadLength

Untruncated payload length. Decoders zero-fill inbound payloads up to this length before deserialising; senders write this many bytes before truncating.

public static abstract byte MaxPayloadLength { get; }

Property Value

byte

MinPayloadLength

Truncation floor — MAVLink v2 senders may strip trailing zero bytes of extension fields down to this length. Inbound payloads shorter than this are malformed.

public static abstract byte MinPayloadLength { get; }

Property Value

byte

MsgId

24-bit MAVLink message id (e.g. 0 for HEARTBEAT).

public static abstract uint MsgId { get; }

Property Value

uint

Methods

Decode(ReadOnlySpan<byte>)

Deserialise from payload. Truncated payloads (length < MaxPayloadLength but ≥ MinPayloadLength) are zero-padded automatically. Payloads outside that range must be rejected by the caller before invoking Decode.

public static abstract TSelf Decode(ReadOnlySpan<byte> payload)

Parameters

payload ReadOnlySpan<byte>

Returns

TSelf

Encode(Span<byte>)

Serialise this message into payload. The span must be at least MaxPayloadLength bytes — the implementation writes the full untruncated layout. Senders are free to strip trailing zero bytes down to MinPayloadLength for on-wire truncation.

void Encode(Span<byte> payload)

Parameters

payload Span<byte>