Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add TTM sentence parse support #128

Merged
merged 8 commits into from
Aug 14, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ all-sentences = ["GNSS", "waypoint", "maritime", "water", "vendor-specific", "ot
GNSS = ["APA", "ALM", "GBS", "GGA", "GLL", "GNS", "GSA", "GST", "GSV", "RMC", "VTG"]

waypoint = ["AAM", "BOD", "BWC", "BWW", "WNC", "ZFO", "ZTG"]
maritime = ["waypoint", "water"]
maritime = ["waypoint", "water", "radar"]
radar = ["TTM"]
water = ["DBK", "MTW", "VHW"]
vendor-specific = ["RMZ"]
other = ["HDT", "MDA", "MWV", "TXT", "ZDA"]
Expand Down Expand Up @@ -152,6 +153,9 @@ RMC = []
# feature: vendor-specific
RMZ = []

# TTM - Tracked target message
TTM = []

# TXT - Text message
TXT = []

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ NMEA Standard Sentences
- MTW
- MWV
- RMC *
- TTM
- VHW
- VTG *
- WNC
Expand Down
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
//! - MTW
//! - MWV
//! - RMC *
//! - TTM
//! - VHW
//! - VTG *
//! - WNC
Expand Down
11 changes: 11 additions & 0 deletions src/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ pub enum ParseResult {
MTW(MtwData),
MWV(MwvData),
RMC(RmcData),
TTM(TtmData),
TXT(TxtData),
VHW(VhwData),
VTG(VtgData),
Expand Down Expand Up @@ -160,6 +161,7 @@ impl From<&ParseResult> for SentenceType {
ParseResult::MTW(_) => SentenceType::MTW,
ParseResult::MWV(_) => SentenceType::MWV,
ParseResult::RMC(_) => SentenceType::RMC,
ParseResult::TTM(_) => SentenceType::TTM,
ParseResult::TXT(_) => SentenceType::TXT,
ParseResult::VHW(_) => SentenceType::VHW,
ParseResult::VTG(_) => SentenceType::VTG,
Expand Down Expand Up @@ -383,6 +385,15 @@ pub fn parse_str(sentence_input: &str) -> Result<ParseResult, Error> {
}
}
}
SentenceType::TTM => {
cfg_if! {
if #[cfg(feature = "TTM")] {
parse_ttm(nmea_sentence).map(ParseResult::TTM)
} else {
return Err(Error::DisabledSentence);
}
}
}
SentenceType::TXT => {
cfg_if! {
if #[cfg(feature = "TXT")] {
Expand Down
1 change: 1 addition & 0 deletions src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,7 @@ impl<'a> Nmea {
| ParseResult::MWV(_)
| ParseResult::MDA(_)
| ParseResult::VHW(_)
| ParseResult::TTM(_)
| ParseResult::ZDA(_)
| ParseResult::ZFO(_)
| ParseResult::WNC(_)
Expand Down
5 changes: 5 additions & 0 deletions src/sentences/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ pub mod mtw;
pub mod mwv;
pub mod rmc;
pub mod rmz;
pub mod ttm;
pub mod txt;
pub mod utils;
pub mod vhw;
Expand Down Expand Up @@ -58,6 +59,10 @@ pub use {
mwv::{parse_mwv, MwvData},
rmc::{parse_rmc, RmcData},
rmz::{parse_pgrmz, PgrmzData},
ttm::{
parse_ttm, TtmAngle, TtmData, TtmDistanceUnit, TtmReference, TtmStatus,
TtmTypeOfAcquisition,
},
txt::{parse_txt, TxtData},
vhw::{parse_vhw, VhwData},
vtg::{parse_vtg, VtgData},
Expand Down
Loading
Loading