Compare commits

..

1 Commits

Author SHA1 Message Date
Thomas Klaehn
299ac0f1cf Version bump
Signed-off-by: Thomas Klaehn <thomas.klaehn@perinet.io>
2025-01-15 10:17:33 +01:00
3 changed files with 10 additions and 22 deletions

2
Cargo.lock generated
View File

@@ -102,7 +102,7 @@ checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c"
[[package]]
name = "gps_parser"
version = "0.3.1"
version = "0.2.0"
dependencies = [
"chrono",
"nmea-parser",

View File

@@ -1,6 +1,6 @@
[package]
name = "gps_parser"
version = "0.3.1"
version = "0.2.0"
edition = "2021"
[dependencies]

View File

@@ -6,10 +6,10 @@ use nmea_parser::*;
#[derive(Debug)]
pub struct ParseResult {
pub lat: f64,
pub lon: f64,
pub timestamp: DateTime<Utc>,
pub speed: f64,
lat: f64,
lon: f64,
timestamp: DateTime<Utc>,
speed: f64
}
pub struct GpsParser {
@@ -50,25 +50,13 @@ impl GpsParser {
match parser.parse_sentence(&line)? {
ParsedMessage::Gga(gga) => {
parsed_gga = true;
res.lat = match gga.latitude {
Some(value) => value,
_none => 0.0,
};
res.lon = match gga.longitude {
Some(value) => value,
_none => 0.0,
};
res.timestamp = match gga.timestamp {
Some(value) => value,
_none => Utc::now(),
};
res.lat = gga.latitude.unwrap();
res.lon = gga.longitude.unwrap();
res.timestamp = gga.timestamp.unwrap();
},
ParsedMessage::Vtg(vtg) => {
parsed_vtg = true;
res.speed = match vtg.sog_kph {
Some(value) => value,
_none => 0.0,
};
res.speed = vtg.sog_kph.unwrap();
},
_ => {
}