Skip to content

Latest commit

 

History

History
63 lines (49 loc) · 2.81 KB

README.md

File metadata and controls

63 lines (49 loc) · 2.81 KB

Rust RTCM Parser

This project is a Rust library for parsing RTCM (Radio Technical Commission for Maritime Services) messages. RTCM messages are used in the field of satellite navigation, particularly for differential GNSS (Global Navigation Satellite System) applications.

The library provides a set of utilities to parse RTCM messages and extract relevant information from them. It utilizes the deku library for decoding byte slices into the RTCM struct. The parsed data can then be used for further processing or analysis.

Installation

To use this library in your Rust project, add the following line to your Cargo.toml file:

[dependencies]
rtcm_parser = "0.1.0"

Usage

Here is a basic example of using the RTCM parser:

use rtcm_parser::Rtcm;

fn main() {
    let rtcm_data = vec![
        0xD3, 0x00, 0xC4, 0x3E, 0xC0, 0x00, 0x38, 0x49, 0x7C, 0x22, 0xC0, 0x69, 0x66, 0xE9, 0x70,
        0x02, 0x95, 0xDC, 0x54, 0x67, 0x00, 0x3B, 0x81, 0x30, 0x9B, 0x84, 0xC1, 0x27, 0x6D, 0xDD,
        0x81, 0x35, 0x4C, 0xFE, 0x8F, 0x80, 0x00, 0x5A, 0x41, 0xEB, 0xFF, 0xEF, 0x03, 0x16, 0xD3,
        0x58, 0x07, 0xBE, 0xA7, 0xF4, 0x5C, 0x40, 0x03, 0x01, 0x8C, 0x3A, 0xFF, 0x80, 0x32, 0xCF,
        0x64, 0xE4, 0x0C, 0x22, 0x3F, 0xA4, 0x5A, 0x00, 0x31, 0x84, 0x01, 0x67, 0xFB, 0x41, 0xC4,
        0x56, 0xCC, 0x7F, 0xFD, 0xEC, 0xB9, 0x52, 0x40, 0x05, 0x5F, 0x30, 0xC2, 0xC1, 0x3E, 0x22,
        0x2E, 0xBF, 0x0B, 0xFF, 0xB2, 0x0F, 0xEA, 0x15, 0x80, 0x0A, 0xE0, 0x04, 0x75, 0xFE, 0x50,
        0x22, 0x99, 0xC6, 0x67, 0xFF, 0xE4, 0xFF, 0x53, 0x9C, 0x20, 0x00, 0x80, 0x00, 0x0F, 0xE0,
        0x0F, 0xA1, 0x41, 0xFD, 0x42, 0x9E, 0x07, 0xFA, 0x55, 0x60, 0x01, 0x48, 0x6A, 0x71, 0x7F,
        0xA8, 0x04, 0xE3, 0x23, 0x2E, 0x09, 0xAC, 0xBF, 0xD3, 0xEC, 0x00, 0x28, 0x82, 0x45, 0x07,
        0xFD, 0x60, 0x85, 0xD5, 0x20, 0x41, 0x3F, 0xE0, 0xFE, 0x87, 0x88, 0x7F, 0x7C, 0x45, 0x06,
        0xFF, 0xF3, 0x1C, 0x4B, 0xE6, 0x62, 0x02, 0x88, 0x17, 0xF5, 0x28, 0x80, 0x04, 0xE0, 0x9E,
        0xB3, 0x21, 0x08, 0x99, 0x9B, 0x81, 0x50, 0x0A, 0x10, 0x3F, 0xA6, 0xD8, 0x10, 0x00, 0x40,
        0x00, 0x07, 0xF0, 0x00, 0x87, 0xBB, 0x66,
    ];

    // Parse the message
    let rtcm = Rtcm::parse(&rtcm_data[3..&rtcm_data.len() - 3]);

    match rtcm {
        Ok(Rtcm::Rtcm1004(message)) => {
            println!("{message:?}");
        }
        Ok(_) => {
            // do something
        }
        Err(error) => {
            // Handle parsing errors
            eprintln!("Error: {}", error);
        }
    }
}

The parsed messages will be returned as a Rtcm enum variant, and you can handle different message types according to your requirements.

Contributing

Contributions to this project are welcome. If you find any bugs, have feature requests, or want to contribute improvements or new features, please create an issue or submit a pull request.