mavspec 0.1.0-alpha3

Library for parsing MAVLink XML definitions
Documentation

MAVSpec

Rust library for parsing MAVLink XML definitions.

WARNING!!!

This project is intended to be used with other Mavka tools. For now its API is still relatively unstable. Once the library will be successfully consumed by these projects, API will be stabilised.

Documentation can be found here.

Usage

Parse standard and custom XML definitions from ./message_definitions:

use std::env;

use mavspec::parser::XMLInspector;

fn main() {
    // Instantiate inspector and load list of XML definitions
    let inspector = XMLInspector::builder()
        .set_sources(vec![
            "./message_definitions/standard".to_string(),
            "./message_definitions/extra".to_string(),
        ])
        .build()
        .unwrap();
    
    // Parse all XML definitions
    let protocol = inspector.parse().unwrap();
    
    // Get `crazyflight` custom dialect
    let crazyflight = protocol.dialects().get("crazyflight").unwrap();
    
    // Get `DUMMYFLIGHT_OUTCRY` message
    let outcry_message = crazyflight.messages().get(&54000u32).unwrap();
    assert_eq!(outcry_message.name(), "CRAZYFLIGHT_OUTCRY");
    println!("\n`CRAZYFLIGHT_OUTCRY` message: {:#?}", outcry_message);
}

See examples for advanced usage.

Examples

  • parser — parse XML definitions.
    cargo run --example parser --features=serde
    

Roadmap

Basics (required before publishing non-alpha version)

  • Add standalone examples.
  • Accept multiple folders with XML definitions.
  • Implement CRC calculation.
  • Add more utility functions for fields management.
  • Add more examples to docs.

Advanced (considered for the next milestone)

License

Here we simply comply with the suggested dual licensing according to Rust API Guidelines (C-PERMISSIVE).

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.