Expand description
§mavrouter
MAVLink router: learns network topology from traffic, routes by
system_id/component_id, and supports Serial, UDP, and TCP endpoints
in either client or server mode. See the Router handle for the
entry points.
§Public API surface
The library exposes a small, opinionated surface. For nearly every use case, the only items you need are:
Router— start, stop, and interact with a running router.config::Config— parse or construct a configuration.error::RouterError/error::Result— the crate’s error type.
Everything else is internal. If you find yourself wanting a type from one of the private submodules, open an issue so the missing capability can be added to the public surface instead of leaking implementation details.
§Quick Start
use mavrouter::Router;
// Start from a TOML string
let router = Router::from_str(r#"
[[endpoint]]
type = "udp"
address = "0.0.0.0:14550"
mode = "server"
"#).await?;
// Or from a configuration file
// let router = Router::from_file("mavrouter.toml").await?;
// Access the message bus to subscribe to messages
let mut rx = router.bus().subscribe();
// ... do your work ...
// Gracefully shut down
router.stop().await;§Configuration
See config::Config for the TOML configuration structure. You can also
create configurations programmatically via config::Config::parse or
the standard FromStr trait.
Modules§
- config
- Router configuration and parsing utilities.
Router configuration: TOML parsing, defaults, merge semantics, and
validation, organised into per-concern submodules and stitched back
together here so that the public path
mavrouter::config::{Config, GeneralConfig, EndpointConfig, EndpointMode, FlowControl, BaudRate}stays stable. - error
- Custom error types for structured error handling. Custom error types for mavrouter-rs.
Structs§
- Endpoint
Id - Unique identifier for a routing endpoint.
- Endpoint
Stats - Per-endpoint traffic statistics tracked via atomic counters.
- Endpoint
Stats Snapshot - A point-in-time snapshot of
EndpointStatswith plainu64fields. - Message
Bus - Message bus handle used to distribute
Arc<RoutedMessage>s to all active endpoints and internal router components. - Message
Target - Represents the target (system and component IDs) of a MAVLink message.
- Routed
Message - A routed MAVLink message with source information.
- Router
- A high-level handle to a running MAVLink router.
- Routing
Stats - Statistics about the current state of the routing table.
- Routing
Table - Intelligent routing table that learns MAVLink network topology.