XMAVLink.Dialect behaviour (xmavlink v0.14.3)

Copy Markdown View Source

Behaviour implemented by generated MAVLink dialect modules.

The generator already emits these functions for each dialect. This behaviour makes the runtime contract explicit without changing generated module names or message structs.

Summary

Types

target()

@type target() :: :broadcast | :system | :system_component | :component

Callbacks

decode(integer, atom)

@callback decode(integer(), atom()) :: atom() | integer()

describe(atom)

@callback describe(atom()) :: String.t()

describe_params(atom)

@callback describe_params(atom()) :: XMAVLink.Types.param_description_list()

encode(arg1, atom)

@callback encode(atom() | integer(), atom()) :: integer()

msg_attributes(message_id)

@callback msg_attributes(XMAVLink.Types.message_id()) ::
  {:ok, XMAVLink.Types.crc_extra(), pos_integer(), target()}
  | {:error, :unknown_message_id}

unpack(message_id, version, binary)

@callback unpack(XMAVLink.Types.message_id(), XMAVLink.Types.version(), binary()) ::
  {:ok, XMAVLink.Message.t()} | {:error, :unknown_message}