Packages

An elixir library for MAVLink, an application that enables communication with other systems using the MAVLink protocol over serial, UDP and TCP connections, and utility modules for performing common MAVLink commands and tasks with one or more remote vehicles.

Current section

Files

Jump to
xmavlink lib mavlink message.ex
Raw

lib/mavlink/message.ex

defprotocol XMAVLink.Message do
@fallback_to_any true
@spec pack(XMAVLink.Message.t(), 1 | 2) ::
{
:ok,
XMAVLink.Types.message_id(),
{
:ok,
XMAVLink.Types.crc_extra(),
pos_integer,
:broadcast | :system | :system_component | :component
},
binary()
}
| {:error, String.t()}
def pack(message, version)
end
defimpl XMAVLink.Message, for: Any do
def pack(not_a_message = %{__struct__: _}, _) do
raise Protocol.UndefinedError, protocol: XMAVLink.Message, value: not_a_message
end
def pack(not_a_message, _),
do: {:error, "pack(): #{inspect(not_a_message)} is not a MAVLink message"}
end