pamoja_mavlink/protocol/mod.rs
1//! The MAVLink service protocols as pure, allocation-free state machines.
2//!
3//! A [`Frame`](crate::Frame) carries one message; a real exchange with an autopilot is a
4//! sequence of them with rules about order, matching, and retransmission. This module holds
5//! those rules as sans-IO logic: each machine is fed a decoded incoming message and returns
6//! the next message to send and a state transition, with no IO, no timers, and no allocation.
7//! The timing policy (when to time out and retransmit) is left to the caller that drives a
8//! machine over a link, so the same logic runs on a microcontroller and under an async host
9//! runtime alike.
10//!
11//! - [`command`] - the command protocol: send a command, match its acknowledgement, treat an
12//! in-progress result as "keep waiting", and count retries.
13//! - [`mission`] - the mission (plan) transfer protocol, as a [`MissionSender`]
14//! that answers item requests and a [`MissionReceiver`] that
15//! requests and collects items; a vehicle and a ground station play opposite roles with the
16//! same two machines.
17//! - [`offboard`] - the `type_mask` builder and setpoint constructors for offboard position,
18//! velocity, and acceleration control.
19//! - [`frames`] - the same machines driven by a [`Frame`](crate::Frame) at a time: the
20//! payload decoding, message-id dispatch, and reply encoding a caller with a link would
21//! otherwise write around every machine.
22
23pub mod command;
24pub mod frames;
25pub mod mission;
26pub mod offboard;
27
28pub use command::{AckOutcome, CommandProtocol};
29pub use frames::{ReceiverStep, SenderStep};
30pub use mission::{MissionReceiver, MissionSender, ReceiverAction};
31pub use offboard::TypeMask;
32
33/// The default number of times a request is retransmitted before a transfer is abandoned, as
34/// the mission protocol recommends.
35pub const MAX_RETRIES: u8 = 5;