mavlink v0.7.0 MAVLink.Router View Source
Connect to serial, udp and tcp ports and listen for, validate and forward MAVLink messages towards their destinations on other connections and/or Elixir processes subscribing to messages.
The rules for MAVLink packet forwarding are described here:
https://mavlink.io/en/guide/routing.html
and here:
http://ardupilot.org/dev/docs/mavlink-routing-in-ardupilot.html
Link to this section Summary
Functions
Returns a specification to start this module under a supervisor.
Send a MAVLink message to one or more recipients using available connections. For now if destination is unreachable it will fail silently.
Subscribes the calling process to messages matching the query. Zero or more of the following query keywords are supported
Un-subscribes calling process from all existing subscriptions
Link to this section Types
mavlink_address()
View Source
mavlink_address() :: MAVLink.Types.mavlink_address()
mavlink_address() :: MAVLink.Types.mavlink_address()
mavlink_connection()
View Source
mavlink_connection() :: MAVLink.Types.connection()
mavlink_connection() :: MAVLink.Types.connection()
subscribe_query_id_key()
View Source
subscribe_query_id_key() ::
:source_system | :source_component | :target_system | :target_component
subscribe_query_id_key() :: :source_system | :source_component | :target_system | :target_component
t()
View Source
t() :: %MAVLink.Router{
component: non_neg_integer(),
connection_strings: [String.t()],
connections: %{},
dialect: module() | nil,
routes: %{mavlink_address: {mavlink_connection(), MAVLink.Types.version()}},
sequence_number: MAVLink.Types.sequence_number(),
subscriptions: [],
system: non_neg_integer(),
uarts: [pid()]
}
t() :: %MAVLink.Router{ component: non_neg_integer(), connection_strings: [String.t()], connections: %{}, dialect: module() | nil, routes: %{mavlink_address: {mavlink_connection(), MAVLink.Types.version()}}, sequence_number: MAVLink.Types.sequence_number(), subscriptions: [], system: non_neg_integer(), uarts: [pid()] }
Link to this section Functions
child_spec(init_arg) View Source
Returns a specification to start this module under a supervisor.
See Supervisor
.
pack_and_send(message, version \\ 2) View Source
Send a MAVLink message to one or more recipients using available connections. For now if destination is unreachable it will fail silently.
start_link(state, opts \\ [])
View Source
start_link(
%{
dialect: module(),
system: non_neg_integer(),
component: non_neg_integer(),
connection_strings: [String.t()]
},
[{atom(), any()}]
) :: {:ok, pid()}
start_link( %{ dialect: module(), system: non_neg_integer(), component: non_neg_integer(), connection_strings: [String.t()] }, [{atom(), any()}] ) :: {:ok, pid()}
subscribe(query \\ [])
View Source
subscribe([{:message, MAVLink.Message.t()} | {subscribe_query_id_key(), 0..255}]) ::
:ok
subscribe([{:message, MAVLink.Message.t()} | {subscribe_query_id_key(), 0..255}]) :: :ok
Subscribes the calling process to messages matching the query. Zero or more of the following query keywords are supported:
message: message_module source_system: integer 0..255 source_component: integer 0..255 target_system: integer 0..255 target_component: integer 0..255 as_frame: true|false (default false)
For example:
MAVLink.Router.subscribe message: MAVLink.Message.Heartbeat, source_system: 1
unsubscribe()
View Source
unsubscribe() :: :ok
unsubscribe() :: :ok
Un-subscribes calling process from all existing subscriptions