mavspec 0.1.0-alpha1

MAVSpec is a library for parsing MAVLink protocol XML definitions
Documentation

MAVSpec

MAVSpec is a library to parse MAVLink protocol XML definitions.

WARNING!!!

This project is intended to be used with other Mavka tools. For now its API is still 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::new(vec![
    "./message_definitions/standard".to_string(),
    "./message_definitions/extra".to_string(),
  ])
  .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.
  • Add examples to docs.
  • Add more utility functions for fields management.

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.