NMEA: detectio of the optional tag block in front of a sentence, ignoring it for...
[marnav.git] / src / marnav / nmea / rma.hpp
blobf913ec4e9660eac3d2829d1432092d3834cee5a8
1 #ifndef __MARNAV__NMEA__RMA__HPP__
2 #define __MARNAV__NMEA__RMA__HPP__
4 #include <marnav/nmea/sentence.hpp>
5 #include <marnav/nmea/angle.hpp>
6 #include <marnav/utils/optional.hpp>
8 namespace marnav
10 namespace nmea
12 MARNAV_NMEA_DECLARE_SENTENCE_PARSE_FUNC(rma)
14 /// @brief RMA - Recommended Minimum Navigation Information
15 ///
16 /// @code
17 /// 1 2 3 4 5 6 7 8 9 10 11
18 /// | | | | | | | | | | |
19 /// $--RMA,A,llll.ll,a,yyyyy.yy,a,x.x,x.x,x.x,x.x,x.x,a*hh<CR><LF>
20 /// @endcode
21 ///
22 /// Field Number:
23 /// 1. Blink Warning
24 /// 2. Latitude
25 /// 3. Latitude hemisphere
26 /// - N = North
27 /// - S = South
28 /// 4. Longitude
29 /// 5. Longitude hemisphere
30 /// - E = East
31 /// - W = West
32 /// 6. Time Difference A, uS
33 /// 7. Time Difference B, uS
34 /// 8. Speed Over Ground, Knots
35 /// 9. Track Made Good, degrees true
36 /// 10. Magnetic Variation, degrees
37 /// 11. Magnetic Variation, degrees, direction
38 /// - E = East
39 /// - W = West
40 ///
41 class rma : public sentence
43 MARNAV_NMEA_SENTENCE_FRIENDS(rma)
45 public:
46 constexpr static const sentence_id ID = sentence_id::RMA;
47 constexpr static const char * TAG = "RMA";
49 rma();
50 rma(const rma &) = default;
51 rma & operator=(const rma &) = default;
52 rma(rma &&) = default;
53 rma & operator=(rma &&) = default;
55 protected:
56 rma(talker talk, fields::const_iterator first, fields::const_iterator last);
57 virtual std::vector<std::string> get_data() const override;
59 private:
60 utils::optional<char> blink_warning;
61 utils::optional<geo::latitude> lat;
62 utils::optional<direction> lat_hem; // latitude dir, N:north, S:south
63 utils::optional<geo::longitude> lon;
64 utils::optional<direction> lon_hem; // longitude dir, E:east, W:west
65 utils::optional<double> time_diff_a; // time difference A in microseconds
66 utils::optional<double> time_diff_b; // time difference B in microseconds
67 utils::optional<double> sog; // speed over ground in knots
68 utils::optional<double> track; // track made good, degrees
69 utils::optional<double> magnetic_var; // magnetic variation in degrees
70 utils::optional<direction>
71 magnetic_var_hem; // magnetic variation hemisphere, E:east, W:west
73 public:
74 decltype(blink_warning) get_blink_warning() const { return blink_warning; }
75 decltype(time_diff_a) get_time_diff_a() const { return time_diff_a; }
76 decltype(time_diff_b) get_time_diff_b() const { return time_diff_b; }
77 decltype(sog) get_sog() const { return sog; }
78 decltype(track) get_track() const { return track; }
79 decltype(magnetic_var) get_magnetic_var() const { return magnetic_var; }
80 decltype(magnetic_var_hem) get_magnetic_var_hem() const { return magnetic_var_hem; }
82 utils::optional<geo::longitude> get_longitude() const;
83 utils::optional<geo::latitude> get_latitude() const;
85 void set_blink_warning(char t) noexcept { blink_warning = t; }
86 void set_lat(const geo::latitude & t);
87 void set_lon(const geo::longitude & t);
88 void set_time_diff_a(double t) noexcept { time_diff_a = t; }
89 void set_time_diff_b(double t) noexcept { time_diff_b = t; }
90 void set_sog(double t) noexcept { sog = t; }
91 void set_track(double t) noexcept { track = t; }
92 void set_magnetic_var(double t, direction h);
97 #endif