### Maviola Message Signing (Sync) Source: https://github.com/istalabs/maviola/blob/main/maviola/examples/README.md Demonstrates a basic synchronous example of message signing using the Maviola library. This requires the Maviola package and is run via cargo. ```shell cargo run --package maviola --example message_signing ``` -------------------------------- ### Maviola Network Node (Sync) Source: https://github.com/istalabs/maviola/blob/main/maviola/examples/README.md Provides a synchronous example of a network node with multiple connections using the Maviola library. This requires the Maviola package and is run via cargo. ```shell cargo run --package maviola --example network ``` -------------------------------- ### Maviola Multiple Devices per Connection (Sync) Source: https://github.com/istalabs/maviola/blob/main/maviola/examples/README.md Provides a basic synchronous example of handling multiple devices per connection using the Maviola library. This requires the Maviola package and is run via cargo. ```shell cargo run --package maviola --example multiple_devices ``` -------------------------------- ### Maviola Multiple Devices per Connection (Async) Source: https://github.com/istalabs/maviola/blob/main/maviola/examples/README.md Provides a basic asynchronous example of handling multiple devices per connection using the Maviola library. This requires the Maviola package and is run via cargo. ```shell cargo run --package maviola --example async_multiple_devices ``` -------------------------------- ### Maviola Network Node (Async) Source: https://github.com/istalabs/maviola/blob/main/maviola/examples/README.md Provides an asynchronous example of a network node with multiple connections using the Maviola library. This requires the Maviola package and is run via cargo. ```shell cargo run --package maviola --example async_network ``` -------------------------------- ### Maviola Unix Socket Ping Pong (Sync) Source: https://github.com/istalabs/maviola/blob/main/maviola/examples/README.md Demonstrates basic synchronous usage of the Maviola library over Unix domain sockets using a ping-pong example. This requires the Maviola package and is run via cargo. ```shell cargo run --package maviola --example sock_ping_pong ``` -------------------------------- ### Maviola TCP Ping Pong (Sync) Source: https://github.com/istalabs/maviola/blob/main/maviola/examples/README.md Demonstrates basic synchronous usage of the Maviola library over TCP using a ping-pong example. This requires the Maviola package and is run via cargo. ```shell cargo run --package maviola --example tcp_ping_pong ``` -------------------------------- ### Maviola UDP Ping Pong (Sync) Source: https://github.com/istalabs/maviola/blob/main/maviola/examples/README.md Demonstrates basic synchronous usage of the Maviola library over UDP using a ping-pong example. This requires the Maviola package and is run via cargo. ```shell cargo run --package maviola --example udp_ping_pong ``` -------------------------------- ### Install Maviola with Async Feature Source: https://github.com/istalabs/maviola/blob/main/README.md Installs the Maviola crate with the 'async' feature enabled using Cargo. ```shell cargo add maviola --features async ``` -------------------------------- ### Maviola Async TCP Ping Pong Source: https://github.com/istalabs/maviola/blob/main/maviola/examples/README.md Demonstrates basic asynchronous usage of the Maviola library over TCP using a ping-pong example. This requires the Maviola package and is run via cargo. ```shell cargo run --package maviola --example async_tcp_ping_pong ``` -------------------------------- ### Maviola File Read/Write (Sync) Source: https://github.com/istalabs/maviola/blob/main/maviola/examples/README.md Demonstrates basic synchronous usage of the Maviola library for reading and writing binary streams to a file. This requires the Maviola package and is run via cargo. ```shell cargo run --package maviola --example file_rw ``` -------------------------------- ### Maviola Async File Read/Write Source: https://github.com/istalabs/maviola/blob/main/maviola/examples/README.md Demonstrates basic asynchronous usage of the Maviola library for reading and writing binary streams to a file. This requires the Maviola package and is run via cargo. ```shell cargo run --package maviola --example async_file_rw ``` -------------------------------- ### Maviola Async Unix Socket Ping Pong Source: https://github.com/istalabs/maviola/blob/main/maviola/examples/README.md Demonstrates basic asynchronous usage of the Maviola library over Unix domain sockets using a ping-pong example. This requires the Maviola package and is run via cargo. ```shell cargo run --package maviola --example async_sock_ping_pong ``` -------------------------------- ### Maviola Synchronous Scrambler Source: https://github.com/istalabs/maviola/blob/main/maviola/examples/README.md Demonstrates a synchronous example of using custom message processors to scramble frame data with the Maviola library. For real-world use, proper encryption algorithms are recommended. This requires the Maviola package and is run via cargo. ```shell cargo run --package maviola --example scrambler ``` -------------------------------- ### Install Maviola with Sync Feature Source: https://github.com/istalabs/maviola/blob/main/README.md Installs the Maviola library with the synchronous API enabled using Cargo. This command adds the `maviola` crate to your project's dependencies and enables the `sync` feature. ```shell cargo add maviola --features sync ``` -------------------------------- ### Install Maviola with Async Feature Source: https://github.com/istalabs/maviola/blob/main/README.md Installs the Maviola library with the asynchronous API enabled using Cargo. This command adds the `maviola` crate to your project's dependencies and enables the `async` feature, which relies on Tokio. ```shell cargo add maviola --features async ``` -------------------------------- ### Rust Sync TCP Server Example Source: https://github.com/istalabs/maviola/blob/main/README.md Demonstrates creating a synchronous MAVLink TCP server using Maviola. It sets up a node with a specific MAVLink version and system/component IDs, defines a TCP server connection, and handles incoming MAVLink events like new peers, lost peers, and heartbeat messages. ```rust use maviola::prelude::*; use maviola::sync::prelude::*; pub fn main() -> Result<()> { // Create a synchronous MAVLink node // with MAVLink 2 protocol version let server = Node::sync::() .id(MavLinkId::new(17, 42)) // Set device system and component IDs .connection(TcpServer::new("127.0.0.1:5600")?) // Define connection settings .build()?; // Handle node events for event in server.events() { match event { // Handle a new peer Event::NewPeer(peer) => println!("new peer: {peer:?}"), // Handle a peer that becomes inactive Event::PeerLost(peer) => { println!("peer offline: {peer:?}"); // Exit when all peers are disconnected if !server.has_peers() { break; } } // Handle incoming MAVLink frame Event::Frame(frame, callback) => if server.validate_frame(&frame).is_ok() { // Handle heartbeat message if let Ok(Minimal::Heartbeat(msg)) = frame.decode::() { // Respond with the same heartbeat message to all clients, // except the one that sent this message callback.respond_others(&server.next_frame(&msg)?)?; } } Event::Invalid(frame, err, callback) => { /* Handle invalid frame */ } } } } ``` -------------------------------- ### Run All Maviola Benchmarks Source: https://github.com/istalabs/maviola/blob/main/benchmarks/README.md Executes all available benchmarks for the Maviola project. This command utilizes Cargo to run the specified package and binary with all features enabled. ```shell cargo run --package maviola_benchmarks --bin maviola_benchmarks --all-features ``` -------------------------------- ### Run Maviola Synchronous API Benchmarks Source: https://github.com/istalabs/maviola/blob/main/benchmarks/README.md Executes benchmarks specifically for the synchronous API of Maviola. This command uses Cargo to run the benchmark binary with the 'sync' feature enabled. ```shell cargo run --package maviola_benchmarks --bin maviola_benchmarks --features sync ``` -------------------------------- ### Run Maviola Asynchronous API Benchmarks Source: https://github.com/istalabs/maviola/blob/main/benchmarks/README.md Executes benchmarks for the asynchronous API of Maviola. This command uses Cargo to run the benchmark binary with the 'async' feature enabled. ```shell cargo run --package maviola_benchmarks --bin maviola_benchmarks --features async ``` -------------------------------- ### Run Maviola MPMC Channel Benchmarks Source: https://github.com/istalabs/maviola/blob/main/benchmarks/README.md Executes benchmarks for Maviola's custom Multiple Producers / Multiple Consumers (MPMC) channel. This command uses Cargo to run the benchmark binary with the 'mpmc' feature enabled. ```shell cargo run --package maviola_benchmarks --bin maviola_benchmarks --features mpmc ``` -------------------------------- ### Create Asynchronous MAVLink TCP Server in Rust Source: https://github.com/istalabs/maviola/blob/main/README.md Demonstrates how to create an asynchronous MAVLink TCP server using the Maviola library in Rust. It sets up a server with specific IDs, listens on a TCP port, and handles incoming MAVLink events such as new peers, lost peers, and valid/invalid frames, including responding to heartbeat messages. ```rust use maviola::prelude::*; use maviola::asnc::prelude::*; #[tokio::main] async fn main() -> Result<()> { // Create an asynchronous MAVLink node // with MAVLink 2 protocol version let server = Node::asnc::() .id(MavLinkId::new(17, 42)) // Set device system and component IDs .connection( TcpServer::new("127.0.0.1:5600")? // Define connection settings ) .build().await?; // Subscribe to a stream of node events let mut events = server.events().unwrap(); // Handle node events while let Some(event) = events.next().await { match event { // Handle a new peer Event::NewPeer(peer) => println!("new peer: {{:?}}", peer), // Handle a peer that becomes inactive Event::PeerLost(peer) => { println!("peer offline: {{:?}}", peer); // Exit when all peers are disconnected if !server.has_peers().await { break; } } // Handle incoming MAVLink frame Event::Frame(frame, callback) => if server.validate_frame(&frame).is_ok() { // Handle heartbeat message if let Ok(Minimal::Heartbeat(msg)) = frame.decode::() { // Respond with the same heartbeat message to all clients, // except the one that sent this message callback.respond_others(&server.next_frame(&msg)?)?; } } Event::Invalid(frame, err, callback) => { /* Handle invalid frame */ } } } Ok(()) } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.