MAVLink2.Transport behaviour (mavlink2 v0.1.0)

Copy Markdown View Source

The byte transport under a MAVLink2.Link: MAVLink2.Transport.UART for a serial port, MAVLink2.Transport.Loopback for tests.

open/1 gets the link's options with :owner, the link process. Bytes arrive at the owner as {:mavlink_data, binary}.

Summary

Callbacks

The options open/1 takes, as [{name, type}] for MAVLink2.Link to check before opening, so a misspelled option is an error rather than ignored. Optional: without it, the link passes any option through.

Types

t()

@type t() :: term()

Callbacks

close(t)

@callback close(t()) :: :ok

open(keyword)

@callback open(keyword()) :: {:ok, t()} | {:error, term()}

options()

(optional)
@callback options() :: keyword()

The options open/1 takes, as [{name, type}] for MAVLink2.Link to check before opening, so a misspelled option is an error rather than ignored. Optional: without it, the link passes any option through.

write(t, iodata)

@callback write(t(), iodata()) :: :ok | {:error, term()}