MAVLink2.XML (mavlink2 v0.1.0)

Copy Markdown View Source

Reads a MAVLink message definition file, following its <include>s, into messages and enums with their wire layout.

A message's wire layout is its base fields stable-sorted by type size, largest first, then its extension fields in the order written. Its crc_extra is the MAVLink CRC over "NAME " and, for each base field in wire order, "type name " and an array's length as one byte, folded to a byte as low ^^^ high.

Summary

Functions

Reads path and every file it includes.

Types

base_type()

@type base_type() ::
  :int8
  | :uint8
  | :char
  | :int16
  | :uint16
  | :int32
  | :uint32
  | :int64
  | :uint64
  | :float
  | :double

field()

@type field() :: %{
  name: String.t(),
  type: base_type(),
  array: pos_integer() | nil,
  enum: String.t() | nil,
  extension: boolean(),
  mavlink_version: boolean()
}

message()

@type message() :: %{
  id: non_neg_integer(),
  name: String.t(),
  fields: [field()],
  wire: [field()],
  length: pos_integer(),
  min_length: pos_integer(),
  crc_extra: 0..255
}

t()

@type t() :: %{
  version: non_neg_integer() | nil,
  files: [Path.t()],
  messages: [message()],
  enums: %{required(String.t()) => %{required(String.t()) => integer()}}
}

Functions

read!(path)

@spec read!(Path.t()) :: t()

Reads path and every file it includes.

size(type)

@spec size(base_type()) :: pos_integer()