NMEA: detectio of the optional tag block in front of a sentence, ignoring it for...
[marnav.git] / src / marnav / nmea / pgrme.hpp
blobaa3a84e84cf7fac65128b72b89f3f3bba267b63b
1 #ifndef __MARNAV__NMEA__PGRME__HPP__
2 #define __MARNAV__NMEA__PGRME__HPP__
4 #include <marnav/nmea/sentence.hpp>
5 #include <marnav/utils/optional.hpp>
7 namespace marnav
9 namespace nmea
11 MARNAV_NMEA_DECLARE_SENTENCE_PARSE_FUNC(pgrme)
13 /// @brief PGRME - Garmin Estimated Error
14 ///
15 /// @code
16 /// 1 2 3 4 5 6 7
17 /// | | | | | | |
18 /// $PGRME,hhh,M,vvv,M,ttt,M*hh<CR><LF>
19 /// @endcode
20 ///
21 /// Field Number:
22 ///
23 /// 1. Estimated horizontal position error (HPE)
24 /// 2. M=meters
25 /// 3. Estimated vertical position error (VPE)
26 /// 4. M=meters
27 /// 5. Overall spherical equivalent position error
28 /// 6. M=meters
29 /// 7. Checksum
30 ///
31 /// Example: <tt>$PGRME,15.0,M,45.0,M,25.0,M*22</tt>
32 ///
33 class pgrme : public sentence
35 MARNAV_NMEA_SENTENCE_FRIENDS(pgrme)
37 public:
38 constexpr static const sentence_id ID = sentence_id::PGRME;
39 constexpr static const char * TAG = "PGRME";
41 pgrme();
42 pgrme(const pgrme &) = default;
43 pgrme & operator=(const pgrme &) = default;
44 pgrme(pgrme &&) = default;
45 pgrme & operator=(pgrme &&) = default;
47 protected:
48 pgrme(talker talk, fields::const_iterator first, fields::const_iterator last);
49 virtual std::vector<std::string> get_data() const override;
51 private:
52 utils::optional<double> horizontal_position_error;
53 unit::distance horizontal_position_error_unit = unit::distance::meter;
54 utils::optional<double> vertical_position_error;
55 unit::distance vertical_position_error_unit = unit::distance::meter;
56 utils::optional<double> overall_spherical_equiv_position_error;
57 unit::distance overall_spherical_equiv_position_error_unit = unit::distance::meter;
59 public:
60 decltype(horizontal_position_error) get_horizontal_position_error() const
62 return horizontal_position_error;
64 decltype(horizontal_position_error_unit) get_horizontal_position_error_unit() const
66 return horizontal_position_error_unit;
68 decltype(vertical_position_error) get_vertical_position_error() const
70 return vertical_position_error;
72 decltype(vertical_position_error_unit) get_vertical_position_error_unit() const
74 return vertical_position_error_unit;
76 decltype(overall_spherical_equiv_position_error)
77 get_overall_spherical_equiv_position_error() const
79 return overall_spherical_equiv_position_error;
81 decltype(overall_spherical_equiv_position_error_unit)
82 get_overall_spherical_equiv_position_error_unit() const
84 return overall_spherical_equiv_position_error_unit;
87 void set_horizontal_position_error(double t) noexcept { horizontal_position_error = t; }
88 void set_vertical_position_error(double t) noexcept { vertical_position_error = t; }
89 void set_overall_spherical_equiv_position_error(double t) noexcept
91 overall_spherical_equiv_position_error = t;
97 #endif