Skip to main content

Crate mavrouter

Crate mavrouter 

Source
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:

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§

EndpointId
Unique identifier for a routing endpoint.
EndpointStats
Per-endpoint traffic statistics tracked via atomic counters.
EndpointStatsSnapshot
A point-in-time snapshot of EndpointStats with plain u64 fields.
MessageBus
Message bus handle used to distribute Arc<RoutedMessage>s to all active endpoints and internal router components.
MessageTarget
Represents the target (system and component IDs) of a MAVLink message.
RoutedMessage
A routed MAVLink message with source information.
Router
A high-level handle to a running MAVLink router.
RoutingStats
Statistics about the current state of the routing table.
RoutingTable
Intelligent routing table that learns MAVLink network topology.