diff options
| author | Thomas Schmucker <ts@its1.de> | 2026-08-14 14:32:26 +0200 |
|---|---|---|
| committer | Thomas Schmucker <ts@its1.de> | 2026-08-14 14:32:26 +0200 |
| commit | 1f59156f25a8e23cd2d9bfec7d7ec121539e95d5 (patch) | |
| tree | 062ea27f6ec0ed7707abf4c080b37274dd3c54e5 /src/main.cpp | |
| parent | 4f78ef5b3ab7d4ff864b7ad6d31e0184d1aa0872 (diff) | |
| download | use-minmea-1f59156f25a8e23cd2d9bfec7d7ec121539e95d5.tar.gz use-minmea-1f59156f25a8e23cd2d9bfec7d7ec121539e95d5.tar.bz2 use-minmea-1f59156f25a8e23cd2d9bfec7d7ec121539e95d5.zip | |
Diffstat (limited to 'src/main.cpp')
| -rw-r--r-- | src/main.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/main.cpp b/src/main.cpp index ed98cb4..7297703 100644 --- a/src/main.cpp +++ b/src/main.cpp | |||
| @@ -39,7 +39,7 @@ read_line(asio::serial_port& com) | |||
| 39 | } | 39 | } |
| 40 | 40 | ||
| 41 | string | 41 | string |
| 42 | get_gps_datetime(const minmea_time& time, const minmea_date& date) | 42 | get_gps_datetime(const minmea_date& date, const minmea_time& time) |
| 43 | { | 43 | { |
| 44 | tm tm_utc{}; | 44 | tm tm_utc{}; |
| 45 | ::minmea_getdatetime(&tm_utc, &date, &time); | 45 | ::minmea_getdatetime(&tm_utc, &date, &time); |
| @@ -80,13 +80,16 @@ main() | |||
| 80 | continue; | 80 | continue; |
| 81 | } | 81 | } |
| 82 | 82 | ||
| 83 | auto timestamp = get_gps_datetime(frame.time, frame.date); | 83 | const auto latitude = ::minmea_tocoord(&frame.latitude); |
| 84 | const auto longitude = ::minmea_tocoord(&frame.longitude); | ||
| 85 | const auto speed = ::minmea_tofloat(&frame.speed) * KNOTS_TO_KMH; | ||
| 86 | const auto timestamp = get_gps_datetime(frame.date, frame.time); | ||
| 84 | 87 | ||
| 85 | cout << format("{}: $RMC floating point degree coordinates and speed: ({},{}) {} km/h\n", | 88 | cout << format("{}: $RMC floating point degree coordinates and speed: ({},{}) {} km/h\n", |
| 86 | timestamp, | 89 | timestamp, |
| 87 | ::minmea_tocoord(&frame.latitude), | 90 | latitude, |
| 88 | ::minmea_tocoord(&frame.longitude), | 91 | longitude, |
| 89 | ::minmea_tofloat(&frame.speed) * KNOTS_TO_KMH); | 92 | speed); |
| 90 | } | 93 | } |
| 91 | } | 94 | } |
| 92 | catch ( exception& e ) { | 95 | catch ( exception& e ) { |
