Struct MavlinkFrame

Namespace
MavNet.Protocol
Assembly
MavNet.Protocol.dll

MAVLink v2 wire frame: [0xFD][len][incompat][compat][seq][sysid][compid][msgid(3)][payload][crc(2)].

public readonly ref struct MavlinkFrame
Inherited Members

Properties

CompatFlags

Compatibility flags; unknown bits are ignored by receivers.

public byte CompatFlags { get; }

Property Value

byte

ComponentId

Sender component id.

public byte ComponentId { get; }

Property Value

byte

IncompatFlags

Incompatibility flags; any unknown bit causes the frame to be dropped.

public byte IncompatFlags { get; }

Property Value

byte

MessageId

24-bit MAVLink message id.

public uint MessageId { get; }

Property Value

uint

Payload

Decoded payload bytes (length = PayloadLength). Slice of the original buffer — do not hold past the buffer's lifetime.

public ReadOnlySpan<byte> Payload { get; }

Property Value

ReadOnlySpan<byte>

PayloadLength

Number of payload bytes on the wire (0–255).

public byte PayloadLength { get; }

Property Value

byte

Sequence

Packet sequence number, wraps at 255.

public byte Sequence { get; }

Property Value

byte

SystemId

Sender system id (1–255).

public byte SystemId { get; }

Property Value

byte

Methods

TryDecode(ReadOnlySpan<byte>, out MavlinkFrame)

Attempt to decode a MAVLink v2 frame. Returns false if:

  • data too short / not v2 magic / signed frame (we don't handle signatures yet)
  • msgid is unknown to the registry — without CrcExtra we can't verify the frame
  • payload length is outside [MinPayloadLength, MaxPayloadLength] for this msgid
  • declared payload length doesn't fit in the buffer
  • CRC doesn't match the per-msgid CRC_EXTRA from MessageRegistry
public static bool TryDecode(ReadOnlySpan<byte> data, out MavlinkFrame frame)

Parameters

data ReadOnlySpan<byte>
frame MavlinkFrame

Returns

bool