nmea-parser
所属分类:GPS编程
开发工具:Rust
文件大小:107KB
下载次数:0
上传日期:2023-01-17 05:54:51
上 传 者:
sh-1993
说明: AIS和GNSS消息的Rust NMEA 0183句子分析器。
(Rust NMEA 0183 sentence parser for AIS and GNSS messages.)
文件列表:
.editorconfig (417, 2023-01-17)
CHANGELOG.md (4658, 2023-01-17)
CONTRIBUTING.md (536, 2023-01-17)
Cargo.toml (725, 2023-01-17)
LICENSE (9874, 2023-01-17)
clippy.toml (33, 2023-01-17)
mid-to-iso3166.py (19782, 2023-01-17)
rustfmt.toml (64, 2023-01-17)
src (0, 2023-01-17)
src\ais (0, 2023-01-17)
src\ais\mod.rs (39599, 2023-01-17)
src\ais\vdm_t10.rs (2512, 2023-01-17)
src\ais\vdm_t11.rs (3600, 2023-01-17)
src\ais\vdm_t12.rs (4339, 2023-01-17)
src\ais\vdm_t13.rs (3665, 2023-01-17)
src\ais\vdm_t14.rs (4128, 2023-01-17)
src\ais\vdm_t15.rs (5405, 2023-01-17)
src\ais\vdm_t16.rs (4053, 2023-01-17)
src\ais\vdm_t17.rs (3892, 2023-01-17)
src\ais\vdm_t18.rs (4526, 2023-01-17)
src\ais\vdm_t19.rs (1066, 2023-01-17)
src\ais\vdm_t1t2t3.rs (9760, 2023-01-17)
src\ais\vdm_t20.rs (4580, 2023-01-17)
src\ais\vdm_t21.rs (14170, 2023-01-17)
src\ais\vdm_t22.rs (5753, 2023-01-17)
src\ais\vdm_t23.rs (9311, 2023-01-17)
src\ais\vdm_t24.rs (10962, 2023-01-17)
src\ais\vdm_t25.rs (5570, 2023-01-17)
src\ais\vdm_t26.rs (4935, 2023-01-17)
src\ais\vdm_t27.rs (4179, 2023-01-17)
src\ais\vdm_t4.rs (5138, 2023-01-17)
src\ais\vdm_t5.rs (8150, 2023-01-17)
src\ais\vdm_t6.rs (3657, 2023-01-17)
src\ais\vdm_t7.rs (737, 2023-01-17)
src\ais\vdm_t9.rs (6044, 2023-01-17)
src\error.rs (2008, 2023-01-17)
src\gnss (0, 2023-01-17)
... ...
# NMEA Parser for Rust
[![NMEA Parser on crates.io][cratesio-image]][cratesio]
[![NMEA Parser on docs.rs][docsrs-image]][docsrs]
[![GitHub last commit][ghcommit-image]][ghcommit]
[cratesio-image]: https://img.shields.io/crates/v/nmea-parser.svg
[cratesio]: https://crates.io/crates/nmea-parser
[docsrs-image]: https://docs.rs/nmea-parser/badge.svg
[docsrs]: https://docs.rs/nmea-parser
[ghcommit-image]: https://img.shields.io/github/last-commit/zaari/nmea-parser
[ghcommit]: https://github.com/zaari/nmea-parser/
This [Rust] crate aims to cover all [AIS] sentences and the most important [GNSS] sentences used
with [NMEA 0183] standard. It supports both AIS class A and class B.
## Usage
Include the following fragment in your `Cargo.toml` file:
```toml
[dependencies]
nmea-parser = "0.10.0"
```
The following example code fragment uses the crate to parse the given NMEA sentences and to print
some parsed fields. It relies on `unwrap()` function to simplify the example. In real-life
applications proper handling of `None` cases is needed.
```rust
use nmea_parser::*;
// Create parser and define sample sentences
let mut parser = NmeaParser::new();
let sentences = vec![
"!AIVDM,1,1,,A,H42O55i18tMET00000000000000,2*6D",
"!AIVDM,1,1,,A,H42O55lti4hhhilD3nink000?050,0*40",
"$GAGGA,123519,4807.038,N,01131.000,E,1,08,0.9,545.4,M,46.9,M,,*56",
];
// Parse the sentences and print some fields of the messages
for sentence in sentences {
match parser.parse_sentence(sentence)? {
ParsedMessage::VesselDynamicData(vdd) => {
println!("MMSI: {}", vdd.mmsi);
println!("Speed: {:.1} kts", vdd.sog_knots.unwrap());
println!("Heading: {}°", vdd.heading_true.unwrap());
println!("");
},
ParsedMessage::VesselStaticData(vsd) => {
println!("MMSI: {}", vsd.mmsi);
println!("Flag: {}", vsd.country().unwrap());
println!("Name: {}", vsd.name.unwrap());
println!("Type: {}", vsd.ship_type);
println!("");
},
ParsedMessage::Gga(gga) => {
println!("Source: {}", gga.source);
println!("Latitude: {:.3}°", gga.latitude.unwrap());
println!("Longitude: {:.3}°", gga.longitude.unwrap());
println!("");
},
ParsedMessage::Rmc(rmc) => {
println!("Source: {}", rmc.source);
println!("Speed: {:.1} kts", rmc.sog_knots.unwrap());
println!("Bearing: {}°", rmc.bearing.unwrap());
println!("Time: {}", rmc.timestamp.unwrap());
println!("");
},
_ => {
}
}
}
```
The example outputs the following lines:
```
MMSI: 271041815
Flag: TR
Name: PROGUY
Type: passenger
Source: Galileo
Latitude: 48.117°
Longitude: 11.517°
```
## Features
The following features are included in the published version of the crate. Details about version
history can be found from the [changelog].
|Feature |Description |
|-----------------|----------------------------------------------------------------|
|AIS sentences |VDM/VDO types 1-5, 9-27 |
|GNSS sentences |ALM, DBS, DPT, DTM, GGA, GLL, GNS, GSA, GSV, HDT, MTW, MWV, RMC, VTG, MSS, STN, VBW, VHW, ZDA |
|Satellite systems|GPS, GLONASS, Galileo, BeiDou, NavIC and QZSS |
## Roadmap
The following table outlines the high-level changes that are going to be included in the future
versions. Prioritization is based on estimated significance and implementation effort of each item.
Until version 1.0 refactoring and renaming of code elements is likely to happen.
|Version |Category |Content |
|--------|------------|----------------------------------------------------------|
|0.11 |AIS |VDM/VDO types 6-8 |
|1.0 |general |Stable API, optimizations, documentation enhancements, even more unit tests, examples|
|1.1 |GNSS |AAM, BOD, BWC, R00, RMB, ROT, RTE, WPL, ZTG, APB, GBS, RMA, GRS, GST, MSK, STN, VBW, XTE, XTR|
## Minimum Rust version
The crate's minimum supported Rust toolchain version is 1.56.
## License
This crate is licensed under [Apache 2.0 license] which also includes the liability and warranty
statements.
[changelog]: CHANGELOG.md
[Apache 2.0 license]: LICENSE
[Rust]: https://en.wikipedia.org/wiki/Rust_(programming_language)
[AIS]: https://en.wikipedia.org/wiki/Automatic_identification_system
[GNSS]: https://en.wikipedia.org/wiki/Satellite_navigation
[NMEA 0183]: https://en.wikipedia.org/wiki/NMEA_0183
近期下载者:
相关文件:
收藏者: