Interface IMavlinkMessage<TSelf>
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
TSelfThe 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
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
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
MsgId
24-bit MAVLink message id (e.g. 0 for HEARTBEAT).
public static abstract uint MsgId { get; }
Property Value
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
payloadReadOnlySpan<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)