NMEA: Qt example extended.
[marnav.git] / src / marnav / nmea / rmc.hpp
blobd8d24e379db445af02a7d5cbf12d26e02c6edc12
1 #ifndef __NMEA__RMC__HPP__
2 #define __NMEA__RMC__HPP__
4 #include <marnav/nmea/sentence.hpp>
5 #include <marnav/nmea/date.hpp>
6 #include <marnav/nmea/time.hpp>
7 #include <marnav/nmea/angle.hpp>
8 #include <marnav/utils/optional.hpp>
10 namespace marnav
12 namespace nmea
14 MARNAV_NMEA_DECLARE_SENTENCE_PARSE_FUNC(rmc)
16 /// @brief RMC - Recommended Minimum Navigation Information
17 ///
18 /// @code
19 /// 12
20 /// 1 2 3 4 5 6 7 8 9 10 11|
21 /// | | | | | | | | | | | |
22 /// $--RMC,hhmmss.ss,A,llll.ll,a,yyyyy.yy,a,x.x,x.x,xxxx,x.x,a,m,*hh<CR><LF>
23 /// @endcode
24 ///
25 /// Field Number:
26 /// 1. UTC Time
27 /// 2. Status, V=Navigation receiver warning A=Valid
28 /// 3. Latitude
29 /// 4. Latitude hemisphere
30 /// - N = North
31 /// - S = South
32 /// 5. Longitude
33 /// 6. Longitude hemisphere
34 /// - E = East
35 /// - W = West
36 /// 7. Speed over ground, knots
37 /// 8. Track made good, degrees true
38 /// 9. Date, ddmmyy
39 /// 10. Magnetic Variation, degrees
40 /// 11. Magnetic Variation, degrees, direction
41 /// - E = East
42 /// - W = West
43 /// 12. FAA mode indicator (NMEA 2.3 and later)
44 ///
45 /// A status of V means the GPS has a valid fix that is below an internal quality
46 /// threshold, e.g. because the dilution of precision is too high or an elevation
47 /// mask test failed.
48 ///
49 class rmc : public sentence
51 MARNAV_NMEA_SENTENCE_FRIENDS(rmc)
53 public:
54 constexpr static const sentence_id ID = sentence_id::RMC;
55 constexpr static const char * TAG = "RMC";
57 virtual ~rmc() {}
59 rmc();
60 rmc(const rmc &) = default;
61 rmc & operator=(const rmc &) = default;
63 protected:
64 rmc(const std::string & talker, fields::const_iterator first, fields::const_iterator last);
65 virtual std::vector<std::string> get_data() const override;
67 private:
68 utils::optional<nmea::time> time_utc;
69 utils::optional<char> status;
70 utils::optional<geo::latitude> lat;
71 utils::optional<direction> lat_hem;
72 utils::optional<geo::longitude> lon;
73 utils::optional<direction> lon_hem;
74 utils::optional<double> sog;
75 utils::optional<double> heading;
76 utils::optional<nmea::date> date;
77 utils::optional<double> mag;
78 utils::optional<direction> mag_hem;
79 utils::optional<positioning_system_mode_indicator> mode_indicator;
81 public:
82 NMEA_GETTER(time_utc)
83 NMEA_GETTER(status)
84 NMEA_GETTER(sog)
85 NMEA_GETTER(heading)
86 NMEA_GETTER(date)
87 NMEA_GETTER(mag)
88 NMEA_GETTER(mag_hem)
89 NMEA_GETTER(mode_indicator)
91 utils::optional<geo::longitude> get_longitude() const;
92 utils::optional<geo::latitude> get_latitude() const;
94 void set_time_utc(const time & t) noexcept { time_utc = t; }
95 void set_status(char t) noexcept { status = t; }
96 void set_lat(const geo::latitude & t);
97 void set_lon(const geo::longitude & t);
98 void set_sog(double t) noexcept { sog = t; }
99 void set_heading(double t) noexcept { heading = t; }
100 void set_date(const nmea::date & t) noexcept { date = t; }
101 void set_mag(double t, direction h);
102 void set_mode_indicator(positioning_system_mode_indicator t) noexcept
104 mode_indicator = t;
110 #endif