Fixposition SDK 0.0.0-heads/main-0-g5e3c297
Collection of c++ libraries and apps for use with Fixposition products on Linux
Loading...
Searching...
No Matches
nmea.hpp
Go to the documentation of this file.
1/**
2 * \verbatim
3 * ___ ___
4 * \ \ / /
5 * \ \/ / Copyright (c) Fixposition AG (www.fixposition.com) and contributors
6 * / /\ \ License: see the LICENSE file
7 * /__/ \__\
8 *
9 * Based on work by flipflip (https://github.com/phkehl)
10 * The information on message structures, IDs, descriptions etc. in this file are from publicly available data, such as:
11 * - NMEA 0183 (https://www.nmea.org/)
12 * - https://en.wikipedia.org/wiki/NMEA_0183
13 * - u-blox ZED-F9P Interface Description (HPG 1.50) (https://www.u-blox.com/en/docs/UBXDOC-963802114-12815),
14 * copyright (c) 2024 u-blox AG
15 * \endverbatim
16 *
17 * @file
18 * @brief Fixposition SDK: Parser NMEA routines and types
19 */
20// clang-format off
21/**
22 * @page FPSDK_COMMON_PARSER_NMEA Parser NMEA routines and types
23 *
24 * **API**: fpsdk_common/parser/nmea.hpp and fpsdk::common::parser::nmea
25 *
26 * @fp_msgspec_begin{NMEA-Protocol}
27 *
28 * The NMEA framing and behaviour is defined by the NMEA 0183 standard (v4.11 and erratas).
29 *
30 * In NMEA speak messages are called *Sentences*. Frames (messages) are in this form:
31 *
32 * <code><b style="color: red;">$</b><b style="color: green;">Talker</b><b style="color: blue;">Formatter</b>,<em>field<sub>1</sub></em>,<em>field<sub>2</sub></em>,…,<em>field<sub>N</sub></em><b style="color: red;">\*CC</b><b style="color: red;">\\r\\n</b></code>
33 *
34 * Where:
35 *
36 * - The NMEA style framing:
37 * - <code><b style="color: red;">\$</b></code>
38 * -- Start character ("$", ASCII 36)
39 * - <code><b style="color: red;">\*CC</b></code>
40 * -- Checksum: "\*" (ASCII 42) and two digit XOR value of all payload
41 * characters in captial hexadecimal notation, for example:
42 * "FPX" = <code>'F' ^ 'P' ^ 'X' = 70 ^ 80 ^ 88 = 78 = 0x4e</code> = checksum <code>4E</code>
43 * - <code><b style="color: red;">\\r\\n</b></code>
44 * -- Sentence termination characters (CR + LF, ASCII 13 + 10)
45 * - A <code><b style="color: green;">Talker</b></code> ID -- Two capital characters:
46 * - `GP` -- Talker ID for GPS, also legacy resp. "compatibility"
47 * - `GL` -- Talker ID for GLONASS
48 * - `GA` -- Talker ID for Galileo
49 * - `GB` -- Talker ID for BeiDou
50 * - `GQ` -- Talker ID for QZSS
51 * - `GI` -- Talker ID for NavIC (IRNSS)
52 * - `GN` -- Talker ID for any combination of GNSS
53 * - A <code><b style="color: blue;">Formatter</b></code> ID -- Three capital characters, for example:
54 * - `RMC` for the message containing recommended minimum specific GNSS data
55 * - See the NMEA 0183 standard document for an extensive list
56 * - Data fields (payload)
57 * - <code><em>field<sub>1</sub></em>,<em>field<sub>2</sub></em>,…,<em>field<sub>N</sub></em></code>
58 * -- The structure of the message data is defined by the <code><b style="color: blue;">Formatter</b></code>.
59 * Each field can contain all printable 7-bit ASCII characters (ASCII 32–126), excluding the
60 * reserved characters `!` (ASCII 33), `$` (ASCII 36), `*` (ASCII 42), `,` (ASCII 44),
61 * `\` (ASCII 92), `~` (ASCII 126).
62 * - Field separators
63 * - All fields (identifier, message type, message version, data fields) are separated by a `,` (comma, ASCII 44)
64 * - Null fields
65 * - Data fields can be _null_, meaning their value is absent to indicate that no data is
66 * available. The data for null fields is the empty string. For example:
67 * - Definition: <code>…,<em>field<sub>i</sub></em>,<em>field<sub>i+1</sub></em>,<em>field<sub>i+2</sub></em>,…</code>
68 * - Values: <code><em>field<sub>i</sub></em></code> = 123, <code><em>field<sub>i+1</sub></em></code> = _null_,
69 * <code><em>field<sub>i+2</sub></em></code> = 456
70 * - Payload string: <code>…,123,,456,…</code>
71 * - Data field types:
72 * - See the NMEA 0183 standard document for specifications
73 *
74 * @fp_msgspec_end
75 *
76 */
77// clang-format on
78#ifndef __FPSDK_COMMON_PARSER_NMEA_HPP__
79#define __FPSDK_COMMON_PARSER_NMEA_HPP__
80
81/* LIBC/STL */
82#include <array>
83#include <cstdint>
84#include <memory>
85#include <string>
86#include <vector>
87
88/* EXTERNAL */
89
90/* PACKAGE */
91
92namespace fpsdk {
93namespace common {
94namespace parser {
95/**
96 * @brief Parser NMEA routines and types
97 */
98namespace nmea {
99/* ****************************************************************************************************************** */
100
101static constexpr uint8_t NMEA_PREAMBLE = '$'; //!< NMEA framing preamble
102static constexpr std::size_t NMEA_FRAME_SIZE = 6; //!< NMEA frame size ("$*cc\r\n")
103
104//! NMEA message meta data
106{
107 char talker_[3] = { 0 }; //!< Talker ID (for example, "GP", "GN" or "P"), nul-terminated string
108 char formatter_[20] = { 0 }; //!< Formatter (for example, "GGA", "RMC", or "UBX"), nul-terminated string
109 int payload_ix0_ = 0; //!< Index (offset) for start of payload, 0 if no payload available
110 int payload_ix1_ = 0; //!< Index (offset) for end of payload, 0 if no payload available
111};
112
113/**
114 * @brief Get NMEA message meta data
115 *
116 * @param[out] meta The meta data
117 * @param[in] msg Pointer to the NMEA message
118 * @param[in] msg_size Size of the NMEA message (>= 11)
119 *
120 * @note No check on the data provided is done. The caller must ensure that the data is a correct NMEA message.
121 *
122 * @returns true if the meta data was successfully extracted, false otherwise
123 */
124bool NmeaGetMessageMeta(NmeaMessageMeta& meta, const uint8_t* msg, const std::size_t msg_size);
125
126/**
127 * @brief Get NMEA message name
128 *
129 * Generates a name (string) in the form "NMEA-TALKER-FORMATTER" (for example, "NMEA-GP-GGA"). Some proprietary messages
130 * are recognised, for example, "NMEA-PUBX-POSITION".
131 *
132 * @param[out] name String to write the name to
133 * @param[in] size Size of \c name (incl. nul termination)
134 * @param[in] msg Pointer to the NMEA message
135 * @param[in] msg_size Size of the \c msg
136 *
137 * @note No check on the data provided is done. The caller must ensure that the data is a valid NMEA message.
138 *
139 * @returns true if message name was generated, false if \c name buffer was too small
140 */
141bool NmeaGetMessageName(char* name, const std::size_t size, const uint8_t* msg, const std::size_t msg_size);
142
143/**
144 * @brief Get NMEA message info
145 *
146 * This stringifies the content of some NMEA messages, for debugging.
147 *
148 * @param[out] info String to write the info to
149 * @param[in] size Size of \c name (incl. nul termination)
150 * @param[in] msg Pointer to the NMEA message
151 * @param[in] msg_size Size of the \c msg
152 *
153 * @note No check on the data provided is done. The caller must ensure that the data is a valid NMEA message.
154 *
155 * @returns true if message info was generated (even if info is empty), false if \c name buffer was too small
156 */
157bool NmeaGetMessageInfo(char* info, const std::size_t size, const uint8_t* msg, const std::size_t msg_size);
158
159/**
160 * @brief Make a NMEA message
161 *
162 * @param[out] msg The message frame
163 * @param[in] payload The message payload, including the talker ID and formatter
164 * (up to MAX_NMEA_SIZE - NMEA_FRAME_SIZE bytes, can be empty)
165 *
166 * @note Illegal (< 0x20 or > 0x7e) or reserved/special ('$', '\', '!', '~', '^' and '*') characters are replaced
167 * by a '_'.
168 *
169 * @returns true if the message was successfully constructed (\c msg now contains the message),
170 * false if failed contructing the message (payload too large)
171 */
172bool NmeaMakeMessage(std::vector<uint8_t>& msg, const std::string& payload);
173
174/**
175 * @brief Make a NMEA message
176 *
177 * @param[out] msg The message frame
178 * @param[in] payload The message payload, including the talker ID and formatter
179 * (up to MAX_NMEA_SIZE - NMEA_FRAME_SIZE bytes, can be empty)
180 *
181 * @note Illegal (< 0x20 or > 0x7e) or reserved/special ('$', '\', '!', '~', '^' and '*') characters are replaced
182 * by a '_'.
183 *
184 * @returns true if the message was successfully constructed (\c msg now contains the message),
185 * false if failed contructing the message (payload too large)
186 */
187bool NmeaMakeMessage(std::string& msg, const std::string& payload);
188
189/**
190 * @brief NMEA coordinates (integer degrees, float minutes and a sign for N/S resp. E/W)
191 */
193{
194 /**
195 * @brief Constructor
196 *
197 * @param[in] degs Decimal degrees
198 * @param[in] digits Number of digits (0-12), param clamped to range
199 */
200 NmeaCoordinates(const double degs, const int digits = 5);
201
202 int deg_; //!< Integer degrees value, >= 0
203 double min_; //!< Fractional minutes value, >= 0.0
204 bool sign_; //!< false for negative (S or W), true for positive (N or E)
205};
206
207// ---------------------------------------------------------------------------------------------------------------------
208
209/**
210 * @brief NMEA talker IDs
211 */
212enum class NmeaTalkerId : int
213{ // clang-format off
214 UNSPECIFIED = '!', //!< Unspecified
215 PROPRIETARY = 'x', //!< Proprietary
216 GPS_SBAS = 'P', //!< GPS and/or SBAS
217 GLO = 'L', //!< GLONASS
218 GAL = 'A', //!< GALILEO
219 BDS = 'B', //!< BeiDou
220 NAVIC = 'I', //!< NavIC
221 QZSS = 'Q', //!< QZSS
222 GNSS = 'N', //!< GNSS (multi-constellation)
223}; // clang-format on
224
225/**
226 * @brief Stringify NMEA talker ID
227 *
228 * @param[in] talker The NMEA talker ID
229 *
230 * @returns the stringification of the NMEA talker ID
231 */
232const char* NmeaTalkerIdStr(const NmeaTalkerId talker);
233
234/**
235 * @brief NMEA formatter
236 */
238{
239 UNSPECIFIED, //!< Unspecified
240 GGA, //!< Formatter GGA (NmeaGgaPayload)
241 GLL, //!< Formatter GLL (NmeaGllPayload)
242 RMC, //!< Formatter RMC (NmeaRmcPayload)
243 VTG, //!< Formatter VTG (NmeaVtgPayload)
244 GST, //!< Formatter GST (NmeaGstPayload)
245 HDT, //!< Formatter HDT (NmeaHdtPayload)
246 ZDA, //!< Formatter ZDA (NmeaZdaPayload)
247 GSA, //!< Formatter GSA (NmeaGsaPayload)
248 GSV, //!< Formatter GSV (NmeaGsvPayload)
249};
250
251/**
252 * @brief Stringify NMEA formatter
253 *
254 * @param[in] formatter The NMEA formatter
255 *
256 * @returns the stringification of the NMEA formatter
257 */
258const char* NmeaFormatterStr(const NmeaFormatter formatter);
259
260/**
261 * @brief NMEA-Gx-GGA quality indicator
262 */
263enum class NmeaQualityGga : int
264{ // clang-format off
265 UNSPECIFIED = '!', //!< Unspecified
266 NOFIX = '0', //!< No fix
267 SPP = '1', //!< Autonomous GNSS fix
268 DGNSS = '2', //!< Differential GPS fix (e.g. with SBAS)
269 PPS = '3', //!< PPS mode
270 RTK_FIXED = '4', //!< RTK fixed
271 RTK_FLOAT = '5', //!< RTK float
272 ESTIMATED = '6', //!< Estimated (dead reckoning only)
273 MANUAL = '7', //!< Manual input mode
274 SIM = '8', //!< Simulator
275}; // clang-format on
276
277/**
278 * @brief Stringify NMEA-Gx-GGA quality indicator
279 *
280 * @param[in] qual The NMEA-Gx-GGA quality indicator
281 *
282 * @returns the stringification of the NMEA-Gx-GGA quality indicator
283 */
284const char* NmeaQualityGgaStr(const NmeaQualityGga qual);
285
286/**
287 * @brief NMEA-Gx-GLL and NMEA-Gx-RMC status
288 *
289 * @note Do not use <, >, >=, <= operators on this!
290 */
291enum class NmeaStatusGllRmc : int
292{ // clang-format off
293 UNSPECIFIED = '!', //!< Unspecified
294 INVALID = 'V', //!< Data invalid
295 VALID = 'A', //!< Data valid
296 // DIFFERENTIAL = 'D', // @todo another possible value?
297}; // clang-format on
298
299/**
300 * @brief Stringify NMEA-Gx-GLL and NMEA-Gx-RMC status
301 *
302 * @param[in] status The NMEA-Gx-GLL and NMEA-Gx-RMC status
303 *
304 * @returns the stringification of the NMEA-Gx-GLL and NMEA-Gx-RMC status
305 */
306const char* NmeaStatusGllRmcStr(const NmeaStatusGllRmc status);
307
308/**
309 * @brief NMEA-Gx-GLL and NMEA-Gx-VTG pos mode
310 *
311 * @note Do not use <, >, >=, <= operators on this!
312 */
313enum class NmeaModeGllVtg : int
314{ // clang-format off
315 UNSPECIFIED = '!', //!< Unspecified
316 INVALID = 'N', //!< Invalid (no fix)
317 AUTONOMOUS = 'A', //!< Autonomous mode (SPP)
318 DGNSS = 'D', //!< Differential GNSS fix
319 ESTIMATED = 'E', //!< Estimated (dead reckoning only)
320 MANUAL = 'M', //!< Manual input mode
321 SIM = 'S', //!< Simulator mode
322}; // clang-format on
323
324/**
325 * @brief Stringify NMEA-Gx-GLL and NMEA-Gx-VTG pos mode
326 *
327 * @param[in] mode The NMEA-Gx-GLL and NMEA-Gx-VTG pos mode
328 *
329 * @returns the stringification of the NMEA-Gx-GLL and NMEA-Gx-VTG pos mode
330 */
331const char* NmeaModeGllVtgStr(const NmeaModeGllVtg mode);
332
333/**
334 * @brief NMEA-Gx-RMC and NMEA-Gx-GNS pos mode
335 *
336 * @note Do not use <, >, >=, <= operators on this!
337 */
338enum class NmeaModeRmcGns : int
339{ // clang-format off
340 UNSPECIFIED = '!', //!< Unspecified
341 INVALID = 'N', //!< Invalid (no fix)
342 AUTONOMOUS = 'A', //!< Autonomous mode (SPP)
343 DGNSS = 'D', //!< Differential GNSS fix
344 ESTIMATED = 'E', //!< Estimated (dead reckoning only)
345 RTK_FIXED = 'R', //!< RTK fixed
346 RTK_FLOAT = 'F', //!< RTK float
347 PRECISE = 'P', //!< Precise
348 MANUAL = 'M', //!< Manual input mode
349 SIM = 'S', //!< Simulator mode
350}; // clang-format on
351
352/**
353 * @brief Stringify NMEA-Gx-RMC and NMEA-Gx-GNS pos mode
354 *
355 * @param[in] mode The NMEA-Gx-RMC and NMEA-Gx-GNS pos mode
356 *
357 * @returns the stringification of the NMEA-Gx-RMC and NMEA-Gx-GNS pos mode
358 */
359const char* NmeaModeRmcGnsStr(const NmeaModeRmcGns mode);
360
361/**
362 * @brief NMEA-Gx-RMC navigational status
363 *
364 * @note Do not use <, >, >=, <= operators on this!
365 */
366enum class NmeaNavStatusRmc : int
367{ // clang-format off
368 UNSPECIFIED = '!', //!< Unspecified
369 SAFE = 'S', //!< Safe
370 CAUTION = 'C', //!< Caution
371 UNSAFE = 'U', //!< Unsafe
372 NA = 'V', //!< Equipment does not provide navigational status
373}; // clang-format on
374
375/**
376 * @brief Stringify NMEA-Gx-RMC navigational status
377 *
378 * @param[in] navstatus The NMEA-Gx-RMC navigational status
379 *
380 * @returns the stringification of the NMEA-Gx-RMC navigational status
381 */
382const char* NmeaNavStatusRmcStr(const NmeaNavStatusRmc navstatus);
383
384/**
385 * @brief NMEA-Gx-GNS operation mode
386 *
387 * @note Do not use <, >, >=, <= operators on this!
388 */
389enum class NmeaOpModeGsa : int
390{ // clang-format off
391 UNSPECIFIED = '!', //!< Unspecified
392 MANUAL = 'M', //!< Manual
393 AUTO = 'A', //!< Automatic
394}; // clang-format on
395
396/**
397 * @brief Stringify NMEA-Gx-GNS operation mode
398 *
399 * @param[in] opmode The NMEA-Gx-GNS operation mode
400 *
401 * @returns the stringification of the NMEA-Gx-GNS operation mode
402 */
403const char* NmeaOpModeGsaStr(const NmeaOpModeGsa opmode);
404
405/**
406 * @brief NMEA-Gx-GNS nav mode
407 */
408enum class NmeaNavModeGsa : int
409{ // clang-format off
410 UNSPECIFIED = '!', //!< Unspecified
411 NOFIX = '1', //!< No fix
412 FIX2D = '2', //!< 2D fix
413 FIX3D = '3', //!< 3D fix
414}; // clang-format on
415
416/**
417 * @brief Stringify NMEA-Gx-GNS nav mode
418 *
419 * @param[in] navmode The NMEA-Gx-GNS nav mode
420 *
421 * @returns the stringification of the NMEA-Gx-GNS nav mode
422 */
423const char* NmeaNavModeGsaStr(const NmeaNavModeGsa navmode);
424
425/**
426 * @brief NMEA system IDs
427 *
428 * @note Do not use <, >, >=, <= operators on this!
429 */
430enum class NmeaSystemId : int
431{ // clang-format off
432 UNSPECIFIED = '!', //!< Unspecified
433 GPS_SBAS = '1', //!< GPS and/or SBAS
434 GLO = '2', //!< GLONASS
435 GAL = '3', //!< Galileo
436 BDS = '4', //!< BeiDou
437 QZSS = '5', //!< QZSS
438 NAVIC = '6', //!< NavIC
439}; // clang-format on
440
441/**
442 * @brief Stringify NMEA system ID
443 *
444 * @param[in] system The NMEA system ID
445 *
446 * @returns the stringification of the NMEA system ID
447 */
448const char* NmeaSystemIdStr(const NmeaSystemId system);
449
450/**
451 * @brief NMEA signal IDs
452 *
453 * @note Do not use <, >, >=, <= operators on this!
454 */
455enum class NmeaSignalId : int
456{ // clang-format off
457 UNSPECIFIED = 0x000 + '!', //!< Unspecified
458 NONE = 0x000 + '0', //!< None
459 // GPS (SBAS)
460 GPS_L1CA = 0x100 + '1', //!< GPS L1 C/A or SBAS L1 C/A
461 GPS_L2CL = 0x100 + '6', //!< GPS L2 CL
462 GPS_L2CM = 0x100 + '5', //!< GPS L2 CM
463 GPS_L5I = 0x100 + '7', //!< GPS L5 I
464 GPS_L5Q = 0x100 + '8', //!< GPS L5 Q
465 // GAL
466 GAL_E1 = 0x300 + '7', //!< Galileo E1
467 GAL_E5A = 0x300 + '1', //!< Galileo E5 A
468 GAL_E5B = 0x300 + '2', //!< Galileo E5 B
469 GAL_E6BC = 0x300 + '3', //!< Galileo E6 B/C
470 GAL_E6A = 0x300 + '4', //!< Galileo E6 A
471 // BDS
472 BDS_B1ID = 0x400 + '1', //!< BeiDou B1I D
473 BDS_B2ID = 0x400 + 'B', //!< BeiDou B2I D
474 BDS_B1C = 0x400 + '3', //!< BeiDou B1 C
475 BDS_B2A = 0x400 + '5', //!< BeiDou B2 a
476 BDS_B2B = 0x400 + '6', //!< BeiDou B2 b
477 // QZSS
478 QZSS_L1CA = 0x500 + '1', //!< QZSS L1 C/A
479 QZSS_L1S = 0x500 + '4', //!< QZSS L1S
480 QZSS_L2CM = 0x500 + '5', //!< QZSS L2 CM
481 QZSS_L2CL = 0x500 + '6', //!< QZSS L2 CL
482 QZSS_L5I = 0x500 + '7', //!< QZSS L5 I
483 QZSS_L5Q = 0x500 + '8', //!< QZSS L5 Q
484 // GLO
485 GLO_L1OF = 0x200 + '1', //!< GLONASS L1 OF
486 GLO_L2OF = 0x200 + '3', //!< GLONASS L2 OF
487 // NAVIC
488 NAVIC_L5A = 0x600 + '5', //!< NavIC L5 A
489}; // clang-format on
490
491/**
492 * @brief Stringify NMEA signal IDs
493 *
494 * @param[in] signal The NMEA signal IDs
495 *
496 * @returns the stringification of the NMEA signal IDs
497 */
498const char* NmeaSignalIdStr(const NmeaSignalId signal);
499
500/**
501 * @brief NMEA time (hour, minutes, seconds)
502 */
504{
505 bool valid = false; //!< Data is valid
506 int hours = 0; //!< Hours
507 int mins = 0; //!< Minutes
508 double secs = 0.0; //!< Seconds
509
510 bool operator==(const NmeaTime& rhs) const; //!< Equal
511 bool operator!=(const NmeaTime& rhs) const; //!< Not equal
512};
513
514/**
515 * @brief NMEA date (year, month, day)
516 */
518{
519 bool valid = false; //!< Data is valid
520 int years = 0; //!< Year
521 int months = 0; //!< Month
522 int days = 0.0; //!< Day
523
524 bool operator==(const NmeaDate& rhs) const; //!< Equal
525 bool operator!=(const NmeaDate& rhs) const; //!< Not equal
526};
527
528/**
529 * @brief NMEA geodetic position
530 */
532{
533 bool latlon_valid = false; //!< Latitude/longitude is valid
534 double lat = 0.0; //!< Latitude [deg], >= 0.0 East, < 0.0 West
535 double lon = 0.0; //!< Longitude [deg], >= 0.0 North, < 0.0 South
536 bool height_valid = false; //!< Height is valid
537 double height = 0.0; //!< Ellipsoidal (!) height [m]
538};
539
540/**
541 * @brief NMEA satellite (used, e.g. in GSA)
542 */
544{
545 bool valid = false; //!< Data is valid
547 int svid = 0; //!< Satellite ID (numbering cf. NMEA 0183)
548};
549
550/**
551 * @brief Constants for different versions of NMEA
552 */
554{
555 const int svid_min_gps = -1; //!< Min GPS satellite ID
556 const int svid_max_gps = -1; //!< Max GPS satellite ID
557 const int svid_min_sbas = -1; //!< Min SBAS satellite ID
558 const int svid_max_sbas = -1; //!< Max SBAS satellite ID
559 const int svid_min_gal = -1; //!< Min Galileo satellite ID
560 const int svid_max_gal = -1; //!< Max Galileo satellite ID
561 const int svid_min_bds = -1; //!< Min BeiDou satellite ID
562 const int svid_max_bds = -1; //!< Max BeiDou satellite ID
563 const int svid_min_glo = -1; //!< Min GLONASS satellite ID
564 const int svid_max_glo = -1; //!< Max GLONASS satellite ID
565 const int svid_min_qzss = -1; //!< Min QZSS satellite ID, -1 if not available
566 const int svid_max_qzss = -1; //!< Max QZSS satellite ID, -1 if not available
567 const int svid_min_navic = -1; //!< Min NavIC satellite ID, -1 if not available
568 const int svid_max_navic = -1; //!< Max NavIC satellite ID, -1 if not available
569 static const NmeaVersion V410; //!< Value for NMEA v4.10
570 static const NmeaVersion V410_UBX_EXT; //!< Value for NMEA v4.10 extended (u-blox flavour)
571 static const NmeaVersion V411; //!< Value for NMEA v4.11
572};
573
574/**
575 * NMEA satellite position (GSA)
576 */
578{
579 bool valid = false; //!< Data is valid
581 int svid = 0; //!< Satellite ID (numbering cf. NMEA 0183)
582 int el = 0; //!< Elevation [deg] (-90..90)
583 int az = 0; //!< Azimuth [deg] (0..360)
584};
585
586/**
587 * NMEA signal levels (GSA)
588 */
590{
591 bool valid = false; //!< Data valid
593 int svid = 0; //!< Satellite ID (numbering cf. NMEA 0183)
595 int cno = 0; //!< Signal level [dBHz]
596};
597
598/**
599 * @brief NMEA integer value
600 */
602{
603 bool valid = false; //!< Data is valid
604 int value = 0; //!< Value
605};
606
607/**
608 * @brief NMEA float value
609 */
611{
612 bool valid = false; //!< Data is valid
613 double value = 0; //!< Value
614};
615
616/**
617 * @brief NMEA payload base class
618 */
620{
623 bool valid_ = false; //!< Payload successfully decoded (true), or not (yet) decoded (false)
624 virtual ~NmeaPayload() = default; //!< Virtual dtor for polymorphism
625
626 /**
627 * @brief Set data from message
628 *
629 * @param[in] msg Pointer to the NMEA message
630 * @param[in] msg_size Size of the NMEA message (>= 11)
631 *
632 * @returns true if sentence payload was correct and all data could be extracted (fields are now valid), or false
633 * otherwise (fields are now invalid)
634 */
635 virtual bool SetFromMsg(const uint8_t* msg, const std::size_t msg_size) = 0;
636
637 /**
638 * @brief Set data from message
639 *
640 * @param[in] buf The NMEA message data
641 *
642 * @returns true if message payload was correct and all data could be extracted (fields are now valid), or false
643 * otherwise (fields are now invalid)
644 */
645 inline bool SetFromBuf(const std::vector<uint8_t>& buf)
646 {
647 return SetFromMsg(buf.data(), buf.size());
648 }
649};
650
651/**
652 * @brief NMEA-Gx-GGA message payload
653 */
655{
656 NmeaTime time; //!< Time
657 NmeaLlh llh; //!< Position (with ellipsoidal height)
658 NmeaFloat height_msl; //!< Orthomeric height [m]
660 NmeaInt num_sv; //!< Number of satellites used (may be limited to 12)
661 NmeaFloat hdop; //!< Horizontal dilution of precision (only with valid fix)
662 NmeaFloat diff_age; //!< Differential data age (optional, NMEA 4.11 only)
663 NmeaInt diff_sta; //!< Differential station ID (optional, NMEA 4.11 only)
664
665 bool SetFromMsg(const uint8_t* msg, const std::size_t msg_size) final;
666
667 static constexpr const char* FORMATTER = "GGA"; //!< Formatter
668};
669
670/**
671 * @brief NMEA-Gx-GLL message payload
672 */
674{
675 NmeaLlh ll; //!< Position (no height)
676 NmeaTime time; //!< Time
677 NmeaStatusGllRmc status = NmeaStatusGllRmc::UNSPECIFIED; //!< Positioning system status
678 NmeaModeGllVtg mode = NmeaModeGllVtg::UNSPECIFIED; //!< Positioning system mode
679
680 bool SetFromMsg(const uint8_t* msg, const std::size_t msg_size) final;
681
682 static constexpr const char* FORMATTER = "GLL"; //!< Formatter
683};
684
685/**
686 * @brief NMEA-Gx-RMC message payload
687 */
689{
690 NmeaTime time; //!< Time
691 NmeaStatusGllRmc status = NmeaStatusGllRmc::UNSPECIFIED; //!< Positioning system status
692 NmeaLlh ll; //!< Position (no height)
693 NmeaFloat speed; //!< Speed over ground [knots]
694 NmeaFloat course; //!< Course over ground w.r.t. True North [deg]
695 NmeaDate date; //!< Date
696 NmeaModeRmcGns mode = NmeaModeRmcGns::UNSPECIFIED; //!< Positioning system mode indicator
697 NmeaNavStatusRmc navstatus = NmeaNavStatusRmc::UNSPECIFIED; //!< Navigational status (optional)
698
699 bool SetFromMsg(const uint8_t* msg, const std::size_t msg_size) final;
700
701 static constexpr const char* FORMATTER = "RMC"; //!< Formatter
702};
703
704/**
705 * @brief NMEA-Gx-VTG message payload
706 */
708{
709 NmeaFloat cogt; //!< Course over ground (true) [deg]
710 NmeaFloat cogm; //!< Course over ground (magnetic) [deg], not typically available
711 NmeaFloat sogn; //!< Speed over ground [knots]
712 NmeaFloat sogk; //!< Speed over ground [km/h]
713 NmeaModeGllVtg mode = NmeaModeGllVtg::UNSPECIFIED; //!< Positioning system mode
714
715 bool SetFromMsg(const uint8_t* msg, const std::size_t msg_size) final;
716
717 static constexpr const char* FORMATTER = "VTG"; //!< Talker
718};
719
720/**
721 * @brief NMEA-Gx-GST message payload
722 */
724{
725 NmeaTime time; //!< Time
726 NmeaFloat rms_range; //!< RMS value of the standard deviation of the range inputs to the navigation process
727 NmeaFloat std_major; //!< Standard deviation of semi-major axis of error ellipse
728 NmeaFloat std_minor; //!< Standard deviation of semi-minor axis of error ellipse
729 NmeaFloat angle_major; //!< Angle of semi-major axis of error ellipse from true North
730 NmeaFloat std_lat; //!< Standard deviation of latitude error
731 NmeaFloat std_lon; //!< Standard deviation of longitude error
732 NmeaFloat std_alt; //!< Standard deviation of altitude error
733
734 bool SetFromMsg(const uint8_t* msg, const std::size_t msg_size) final;
735
736 static constexpr const char* FORMATTER = "GST"; //!< Formatter
737};
738
739/**
740 * @brief NMEA-Gx-HDT message payload
741 */
743{
744 NmeaFloat heading; //!< True heading
745
746 bool SetFromMsg(const uint8_t* msg, const std::size_t msg_size) final;
747
748 static constexpr const char* FORMATTER = "HDT"; //!< Formatter
749};
750
751/**
752 * @brief NMEA-Gx-ZDA message payload
753 */
755{
756 NmeaTime time; //!< Time
757 NmeaDate date; //!< Date
758 NmeaInt local_hr; //!< Local zone hours, always 00 (= UTC)
759 NmeaInt local_min; //!< Local zone minutes, always 00 (= UTC)
760
761 bool SetFromMsg(const uint8_t* msg, const std::size_t msg_size) final;
762
763 static constexpr const char* FORMATTER = "ZDA"; //!< Formatter
764};
765
766/**
767 * @brief NMEA-Gx-GSA message payload (NMEA 4.11 only!)
768 */
770{
773 std::array<NmeaSat, 12> sats; //!< Satellites, valid ones are 0..(num_sats-1)
774 int num_sats = 0; //!< Number of valid sats (the first n of sats[])
775 NmeaFloat pdop; //!< PDOP
776 NmeaFloat hdop; //!< HDOP
777 NmeaFloat vdop; //!< VDOP
779
780 bool SetFromMsg(const uint8_t* msg, const std::size_t msg_size) final;
781
782 static constexpr const char* FORMATTER = "GSA"; //!< Formatter
783};
784
785/**
786 * @brief NMEA-Gx-GSV message payload (NMEA 4.11 only!)
787 */
789{
790 NmeaInt num_msgs; //!< Number of messages in this GSV sequence (for this signal ID)
791 NmeaInt msg_num; //!< Message number in sequence (1...num_msgs)
792 NmeaInt tot_num_sat; //!< Number of sat/sig info in the whole sequence of GSV messages
793 std::array<NmeaAzEl, 4> azels; //!< Satellite positions, valid ones are 0..(num_sats-1)
794 int num_azels = 0; //!< Number of valid satellite positions (the first n of azels[])
795 std::array<NmeaCno, 4> cnos; //!< Signal levels, valid ones are 0..(num_sats-1)
796 int num_cnos = 0; //!< Number of valid signal levels (the first n of azels[])
797 NmeaSystemId system; //!< System ID
798 NmeaSignalId signal; //!< Signal ID
799
800 bool SetFromMsg(const uint8_t* msg, const std::size_t msg_size) final;
801
802 static constexpr const char* FORMATTER = "GSV"; //!< Formatter
803};
804
805// ---------------------------------------------------------------------------------------------------------------------
806
807//! Pointer to NMEA payload
808using NmeaPayloadPtr = std::unique_ptr<NmeaPayload>;
809
810/**
811 * @brief Decode NMEA message
812 *
813 * @param[in] msg Pointer to the NMEA message
814 * @param[in] msg_size Size of the NMEA message (>= 11)
815 *
816 * @returns an instance of the decoded payload on success, nullptr otherwise (bad or unknown message)
817 */
818NmeaPayloadPtr NmeaDecodeMessage(const uint8_t* msg, const std::size_t msg_size);
819
820/**
821 * @brief Decode NMEA message
822 *
823 * @param[in] msg The NMEA message data
824 *
825 * @returns an instance of the decoded payload on success, nullptr otherwise (bad or unknown message)
826 */
827inline NmeaPayloadPtr NmeaDecodeMessage(const std::vector<uint8_t>& msg)
828{
829 return NmeaDecodeMessage(msg.data(), msg.size());
830}
831
832// ---------------------------------------------------------------------------------------------------------------------
833
834/**
835 * @brief Collector for NMEA-Gx-GSA and NMEA-Gx-GPA
836 */
838{
839 /**
840 * @brief Satellite info
841 */
842 struct Sat
843 {
845 int svid_ = 0; //!< Satellite ID (numbering cf. NMEA 0183)
846 int az_ = 0; //!< Azimuth [deg] (0..360)
847 int el_ = 0; //!< Elevation [deg] (-90..90)
848 };
849
850 /**
851 * Signal info
852 */
853 struct Sig
854 {
856 int svid_ = 0; //!< Satellite ID (numbering cf. NMEA 0183)
858 double cno_ = 0.0; //!< Signal level [dBHz]
859 bool used_ = false; //!< Signal is used in navigation
860 };
861
862 std::vector<Sat> sats_; //!< Collected satellite info
863 std::vector<Sig> sigs_; //!< Collected signal info
864
865 /**
866 * @brief Add NMEA-GN-GSA message to collection
867 *
868 * These must be provided in order and completely, and before the GSV messages.
869 *
870 * @param[in] gsa Decoded message payload
871 *
872 * @returns true if the message was accepted, false otherwise
873 */
874 bool AddGsa(const NmeaGsaPayload& gsa);
875
876 /**
877 * @brief Add NMEA-Gx-GSV message to collection
878 *
879 * These must be provided in order and completely, and after the GSA messages.
880 *
881 * @param[in] gsv Decoded message payload
882 *
883 * @returns true if the message was accepted, false otherwise
884 */
885 bool AddGsv(const NmeaGsvPayload& gsv);
886
887 /**
888 * @brief Complete collection after feeding all GSA and GSV messages
889 */
890 void Complete();
891
892 /**
893 * @brief Add NMEA-GN-GSA and NMEA-Gx-GSV messages to collection
894 *
895 * Does all of AddGsa(), AddGsv() and Complete() in one call.
896 *
897 * @param[in] gsas All decoded message payloads, complete and in order
898 * @param[in] gsvs All decoded message payloads, complete and in order
899 *
900 * @returns true if all messages were collected successfully
901 */
902 bool AddGsaAndGsv(const std::vector<NmeaGsaPayload>& gsas, const std::vector<NmeaGsvPayload>& gsvs);
903
904 private:
905 std::vector<NmeaSat> gsa_sats_; //!< Satellites used
906};
907
908/* ****************************************************************************************************************** */
909} // namespace nmea
910} // namespace parser
911} // namespace common
912} // namespace fpsdk
913#endif // __FPSDK_COMMON_PARSER_NMEA_HPP__
Parser NMEA routines and types.
Definition nmea.hpp:98
NmeaSystemId
NMEA system IDs.
Definition nmea.hpp:431
NmeaModeRmcGns
NMEA-Gx-RMC and NMEA-Gx-GNS pos mode.
Definition nmea.hpp:339
const char * NmeaNavStatusRmcStr(const NmeaNavStatusRmc navstatus)
Stringify NMEA-Gx-RMC navigational status.
const char * NmeaNavModeGsaStr(const NmeaNavModeGsa navmode)
Stringify NMEA-Gx-GNS nav mode.
static constexpr std::size_t NMEA_FRAME_SIZE
NMEA frame size ("$*cc\r\n")
Definition nmea.hpp:102
bool NmeaMakeMessage(std::vector< uint8_t > &msg, const std::string &payload)
Make a NMEA message.
NmeaOpModeGsa
NMEA-Gx-GNS operation mode.
Definition nmea.hpp:390
NmeaNavStatusRmc
NMEA-Gx-RMC navigational status.
Definition nmea.hpp:367
@ NA
Equipment does not provide navigational status.
Definition nmea.hpp:372
const char * NmeaSystemIdStr(const NmeaSystemId system)
Stringify NMEA system ID.
const char * NmeaTalkerIdStr(const NmeaTalkerId talker)
Stringify NMEA talker ID.
NmeaPayloadPtr NmeaDecodeMessage(const uint8_t *msg, const std::size_t msg_size)
Decode NMEA message.
const char * NmeaModeRmcGnsStr(const NmeaModeRmcGns mode)
Stringify NMEA-Gx-RMC and NMEA-Gx-GNS pos mode.
static constexpr uint8_t NMEA_PREAMBLE
NMEA framing preamble.
Definition nmea.hpp:101
const char * NmeaStatusGllRmcStr(const NmeaStatusGllRmc status)
Stringify NMEA-Gx-GLL and NMEA-Gx-RMC status.
NmeaModeGllVtg
NMEA-Gx-GLL and NMEA-Gx-VTG pos mode.
Definition nmea.hpp:314
NmeaFormatter
NMEA formatter.
Definition nmea.hpp:238
@ ZDA
Formatter ZDA (NmeaZdaPayload)
Definition nmea.hpp:246
@ HDT
Formatter HDT (NmeaHdtPayload)
Definition nmea.hpp:245
@ RMC
Formatter RMC (NmeaRmcPayload)
Definition nmea.hpp:242
@ GGA
Formatter GGA (NmeaGgaPayload)
Definition nmea.hpp:240
@ GST
Formatter GST (NmeaGstPayload)
Definition nmea.hpp:244
@ GSV
Formatter GSV (NmeaGsvPayload)
Definition nmea.hpp:248
@ GSA
Formatter GSA (NmeaGsaPayload)
Definition nmea.hpp:247
@ GLL
Formatter GLL (NmeaGllPayload)
Definition nmea.hpp:241
@ VTG
Formatter VTG (NmeaVtgPayload)
Definition nmea.hpp:243
NmeaNavModeGsa
NMEA-Gx-GNS nav mode.
Definition nmea.hpp:409
const char * NmeaModeGllVtgStr(const NmeaModeGllVtg mode)
Stringify NMEA-Gx-GLL and NMEA-Gx-VTG pos mode.
NmeaTalkerId
NMEA talker IDs.
Definition nmea.hpp:213
@ GNSS
GNSS (multi-constellation)
Definition nmea.hpp:222
const char * NmeaQualityGgaStr(const NmeaQualityGga qual)
Stringify NMEA-Gx-GGA quality indicator.
const char * NmeaOpModeGsaStr(const NmeaOpModeGsa opmode)
Stringify NMEA-Gx-GNS operation mode.
const char * NmeaSignalIdStr(const NmeaSignalId signal)
Stringify NMEA signal IDs.
std::unique_ptr< NmeaPayload > NmeaPayloadPtr
Pointer to NMEA payload.
Definition nmea.hpp:808
NmeaStatusGllRmc
NMEA-Gx-GLL and NMEA-Gx-RMC status.
Definition nmea.hpp:292
bool NmeaGetMessageInfo(char *info, const std::size_t size, const uint8_t *msg, const std::size_t msg_size)
Get NMEA message info.
bool NmeaGetMessageMeta(NmeaMessageMeta &meta, const uint8_t *msg, const std::size_t msg_size)
Get NMEA message meta data.
NmeaSignalId
NMEA signal IDs.
Definition nmea.hpp:456
@ GPS_L1CA
GPS L1 C/A or SBAS L1 C/A.
Definition nmea.hpp:460
bool NmeaGetMessageName(char *name, const std::size_t size, const uint8_t *msg, const std::size_t msg_size)
Get NMEA message name.
const char * NmeaFormatterStr(const NmeaFormatter formatter)
Stringify NMEA formatter.
NmeaQualityGga
NMEA-Gx-GGA quality indicator.
Definition nmea.hpp:264
@ DGNSS
Differential GPS fix (e.g. with SBAS)
Definition nmea.hpp:268
@ ESTIMATED
Estimated (dead reckoning only)
Definition nmea.hpp:272
Fixposition SDK: Common library.
Definition doc.hpp:21
Fixposition SDK.
NmeaSystemId system
System ID.
Definition nmea.hpp:580
int az
Azimuth [deg] (0..360)
Definition nmea.hpp:583
int el
Elevation [deg] (-90..90)
Definition nmea.hpp:582
int svid
Satellite ID (numbering cf. NMEA 0183)
Definition nmea.hpp:581
int cno
Signal level [dBHz].
Definition nmea.hpp:595
NmeaSignalId signal
Signal ID.
Definition nmea.hpp:594
int svid
Satellite ID (numbering cf. NMEA 0183)
Definition nmea.hpp:593
NmeaSystemId system
System ID.
Definition nmea.hpp:592
int svid_
Satellite ID (numbering cf. NMEA 0183)
Definition nmea.hpp:845
int svid_
Satellite ID (numbering cf. NMEA 0183)
Definition nmea.hpp:856
bool used_
Signal is used in navigation.
Definition nmea.hpp:859
Collector for NMEA-Gx-GSA and NMEA-Gx-GPA.
Definition nmea.hpp:838
bool AddGsa(const NmeaGsaPayload &gsa)
Add NMEA-GN-GSA message to collection.
std::vector< Sat > sats_
Collected satellite info.
Definition nmea.hpp:862
bool AddGsv(const NmeaGsvPayload &gsv)
Add NMEA-Gx-GSV message to collection.
std::vector< Sig > sigs_
Collected signal info.
Definition nmea.hpp:863
bool AddGsaAndGsv(const std::vector< NmeaGsaPayload > &gsas, const std::vector< NmeaGsvPayload > &gsvs)
Add NMEA-GN-GSA and NMEA-Gx-GSV messages to collection.
void Complete()
Complete collection after feeding all GSA and GSV messages.
double min_
Fractional minutes value, >= 0.0.
Definition nmea.hpp:203
NmeaCoordinates(const double degs, const int digits=5)
Constructor.
bool sign_
false for negative (S or W), true for positive (N or E)
Definition nmea.hpp:204
int deg_
Integer degrees value, >= 0.
Definition nmea.hpp:202
NMEA date (year, month, day)
Definition nmea.hpp:518
bool operator==(const NmeaDate &rhs) const
Equal.
bool operator!=(const NmeaDate &rhs) const
Not equal.
NMEA-Gx-GGA message payload.
Definition nmea.hpp:655
static constexpr const char * FORMATTER
Formatter.
Definition nmea.hpp:667
NmeaFloat diff_age
Differential data age (optional, NMEA 4.11 only)
Definition nmea.hpp:662
NmeaLlh llh
Position (with ellipsoidal height)
Definition nmea.hpp:657
bool SetFromMsg(const uint8_t *msg, const std::size_t msg_size) final
Set data from message.
NmeaFloat height_msl
Orthomeric height [m].
Definition nmea.hpp:658
NmeaFloat hdop
Horizontal dilution of precision (only with valid fix)
Definition nmea.hpp:661
NmeaQualityGga quality
Fix quality.
Definition nmea.hpp:659
NmeaInt diff_sta
Differential station ID (optional, NMEA 4.11 only)
Definition nmea.hpp:663
NmeaInt num_sv
Number of satellites used (may be limited to 12)
Definition nmea.hpp:660
NMEA-Gx-GLL message payload.
Definition nmea.hpp:674
bool SetFromMsg(const uint8_t *msg, const std::size_t msg_size) final
Set data from message.
NmeaLlh ll
Position (no height)
Definition nmea.hpp:675
static constexpr const char * FORMATTER
Formatter.
Definition nmea.hpp:682
NmeaStatusGllRmc status
Positioning system status.
Definition nmea.hpp:677
NmeaModeGllVtg mode
Positioning system mode.
Definition nmea.hpp:678
NMEA-Gx-GSA message payload (NMEA 4.11 only!)
Definition nmea.hpp:770
static constexpr const char * FORMATTER
Formatter.
Definition nmea.hpp:782
NmeaOpModeGsa opmode
Operation mode.
Definition nmea.hpp:771
int num_sats
Number of valid sats (the first n of sats[])
Definition nmea.hpp:774
bool SetFromMsg(const uint8_t *msg, const std::size_t msg_size) final
Set data from message.
std::array< NmeaSat, 12 > sats
Satellites, valid ones are 0..(num_sats-1)
Definition nmea.hpp:773
NMEA-Gx-GST message payload.
Definition nmea.hpp:724
NmeaFloat angle_major
Angle of semi-major axis of error ellipse from true North.
Definition nmea.hpp:729
NmeaFloat std_lat
Standard deviation of latitude error.
Definition nmea.hpp:730
NmeaFloat std_alt
Standard deviation of altitude error.
Definition nmea.hpp:732
static constexpr const char * FORMATTER
Formatter.
Definition nmea.hpp:736
NmeaFloat std_lon
Standard deviation of longitude error.
Definition nmea.hpp:731
NmeaFloat std_major
Standard deviation of semi-major axis of error ellipse.
Definition nmea.hpp:727
NmeaFloat rms_range
RMS value of the standard deviation of the range inputs to the navigation process.
Definition nmea.hpp:726
NmeaFloat std_minor
Standard deviation of semi-minor axis of error ellipse.
Definition nmea.hpp:728
bool SetFromMsg(const uint8_t *msg, const std::size_t msg_size) final
Set data from message.
NMEA-Gx-GSV message payload (NMEA 4.11 only!)
Definition nmea.hpp:789
int num_azels
Number of valid satellite positions (the first n of azels[])
Definition nmea.hpp:794
NmeaInt tot_num_sat
Number of sat/sig info in the whole sequence of GSV messages.
Definition nmea.hpp:792
NmeaInt num_msgs
Number of messages in this GSV sequence (for this signal ID)
Definition nmea.hpp:790
NmeaInt msg_num
Message number in sequence (1...num_msgs)
Definition nmea.hpp:791
std::array< NmeaAzEl, 4 > azels
Satellite positions, valid ones are 0..(num_sats-1)
Definition nmea.hpp:793
bool SetFromMsg(const uint8_t *msg, const std::size_t msg_size) final
Set data from message.
std::array< NmeaCno, 4 > cnos
Signal levels, valid ones are 0..(num_sats-1)
Definition nmea.hpp:795
int num_cnos
Number of valid signal levels (the first n of azels[])
Definition nmea.hpp:796
static constexpr const char * FORMATTER
Formatter.
Definition nmea.hpp:802
NMEA-Gx-HDT message payload.
Definition nmea.hpp:743
static constexpr const char * FORMATTER
Formatter.
Definition nmea.hpp:748
bool SetFromMsg(const uint8_t *msg, const std::size_t msg_size) final
Set data from message.
NMEA geodetic position.
Definition nmea.hpp:532
double height
Ellipsoidal (!) height [m].
Definition nmea.hpp:537
bool latlon_valid
Latitude/longitude is valid.
Definition nmea.hpp:533
double lon
Longitude [deg], >= 0.0 North, < 0.0 South.
Definition nmea.hpp:535
double lat
Latitude [deg], >= 0.0 East, < 0.0 West.
Definition nmea.hpp:534
bool height_valid
Height is valid.
Definition nmea.hpp:536
char talker_[3]
Talker ID (for example, "GP", "GN" or "P"), nul-terminated string.
Definition nmea.hpp:107
char formatter_[20]
Formatter (for example, "GGA", "RMC", or "UBX"), nul-terminated string.
Definition nmea.hpp:108
int payload_ix1_
Index (offset) for end of payload, 0 if no payload available.
Definition nmea.hpp:110
int payload_ix0_
Index (offset) for start of payload, 0 if no payload available.
Definition nmea.hpp:109
NMEA payload base class.
Definition nmea.hpp:620
virtual bool SetFromMsg(const uint8_t *msg, const std::size_t msg_size)=0
Set data from message.
bool valid_
Payload successfully decoded (true), or not (yet) decoded (false)
Definition nmea.hpp:623
bool SetFromBuf(const std::vector< uint8_t > &buf)
Set data from message.
Definition nmea.hpp:645
virtual ~NmeaPayload()=default
Virtual dtor for polymorphism.
NmeaFormatter formatter_
Formatter.
Definition nmea.hpp:622
NMEA-Gx-RMC message payload.
Definition nmea.hpp:689
NmeaStatusGllRmc status
Positioning system status.
Definition nmea.hpp:691
NmeaLlh ll
Position (no height)
Definition nmea.hpp:692
NmeaNavStatusRmc navstatus
Navigational status (optional)
Definition nmea.hpp:697
static constexpr const char * FORMATTER
Formatter.
Definition nmea.hpp:701
NmeaModeRmcGns mode
Positioning system mode indicator.
Definition nmea.hpp:696
NmeaFloat speed
Speed over ground [knots].
Definition nmea.hpp:693
bool SetFromMsg(const uint8_t *msg, const std::size_t msg_size) final
Set data from message.
NmeaFloat course
Course over ground w.r.t. True North [deg].
Definition nmea.hpp:694
NMEA satellite (used, e.g. in GSA)
Definition nmea.hpp:544
int svid
Satellite ID (numbering cf. NMEA 0183)
Definition nmea.hpp:547
NmeaSystemId system
System ID.
Definition nmea.hpp:546
NMEA time (hour, minutes, seconds)
Definition nmea.hpp:504
bool operator==(const NmeaTime &rhs) const
Equal.
bool operator!=(const NmeaTime &rhs) const
Not equal.
Constants for different versions of NMEA.
Definition nmea.hpp:554
const int svid_max_glo
Max GLONASS satellite ID.
Definition nmea.hpp:564
const int svid_max_gps
Max GPS satellite ID.
Definition nmea.hpp:556
const int svid_min_sbas
Min SBAS satellite ID.
Definition nmea.hpp:557
const int svid_min_bds
Min BeiDou satellite ID.
Definition nmea.hpp:561
const int svid_min_navic
Min NavIC satellite ID, -1 if not available.
Definition nmea.hpp:567
static const NmeaVersion V410
Value for NMEA v4.10.
Definition nmea.hpp:569
const int svid_max_qzss
Max QZSS satellite ID, -1 if not available.
Definition nmea.hpp:566
const int svid_min_qzss
Min QZSS satellite ID, -1 if not available.
Definition nmea.hpp:565
const int svid_min_gps
Min GPS satellite ID.
Definition nmea.hpp:555
const int svid_min_gal
Min Galileo satellite ID.
Definition nmea.hpp:559
const int svid_max_gal
Max Galileo satellite ID.
Definition nmea.hpp:560
const int svid_max_sbas
Max SBAS satellite ID.
Definition nmea.hpp:558
static const NmeaVersion V410_UBX_EXT
Value for NMEA v4.10 extended (u-blox flavour)
Definition nmea.hpp:570
const int svid_max_navic
Max NavIC satellite ID, -1 if not available.
Definition nmea.hpp:568
const int svid_min_glo
Min GLONASS satellite ID.
Definition nmea.hpp:563
static const NmeaVersion V411
Value for NMEA v4.11.
Definition nmea.hpp:571
const int svid_max_bds
Max BeiDou satellite ID.
Definition nmea.hpp:562
NMEA-Gx-VTG message payload.
Definition nmea.hpp:708
NmeaFloat cogt
Course over ground (true) [deg].
Definition nmea.hpp:709
bool SetFromMsg(const uint8_t *msg, const std::size_t msg_size) final
Set data from message.
NmeaModeGllVtg mode
Positioning system mode.
Definition nmea.hpp:713
NmeaFloat sogk
Speed over ground [km/h].
Definition nmea.hpp:712
static constexpr const char * FORMATTER
Talker.
Definition nmea.hpp:717
NmeaFloat sogn
Speed over ground [knots].
Definition nmea.hpp:711
NmeaFloat cogm
Course over ground (magnetic) [deg], not typically available.
Definition nmea.hpp:710
NMEA-Gx-ZDA message payload.
Definition nmea.hpp:755
NmeaInt local_hr
Local zone hours, always 00 (= UTC)
Definition nmea.hpp:758
static constexpr const char * FORMATTER
Formatter.
Definition nmea.hpp:763
bool SetFromMsg(const uint8_t *msg, const std::size_t msg_size) final
Set data from message.
NmeaInt local_min
Local zone minutes, always 00 (= UTC)
Definition nmea.hpp:759