NMEA: renaming enumeration 'positioning_system_mode_indicator' to 'mode_indicator'.
[marnav.git] / src / marnav / nmea / gll.hpp
blobf6e93a9668e708312cbb26dce3e18e7a5dfb5671
1 #ifndef __NMEA__GLL__HPP__
2 #define __NMEA__GLL__HPP__
4 #include <marnav/nmea/sentence.hpp>
5 #include <marnav/nmea/angle.hpp>
6 #include <marnav/nmea/time.hpp>
7 #include <marnav/utils/optional.hpp>
9 namespace marnav
11 namespace nmea
13 MARNAV_NMEA_DECLARE_SENTENCE_PARSE_FUNC(gll)
15 /// @brief GLL - Geographic Position - Latitude/Longitude
16 ///
17 /// @code
18 /// 1 2 3 4 5 6 7
19 /// | | | | | | |
20 /// $--GLL,llll.ll,a,yyyyy.yy,a,hhmmss.ss,a,m*hh<CR><LF>
21 /// @endcode
22 ///
23 /// Field Number:
24 /// 1. Latitude
25 /// 2. Latitude hemipsphere
26 /// - N = North
27 /// - S = South
28 /// 3. Longitude
29 /// 4. Longitude hemisphere
30 /// - E = East
31 /// - W = West
32 /// 5. Time (UTC) of position
33 /// 6. Status
34 /// - A = Data Valid
35 /// - V = Data Invalid
36 /// 7. Mode indicator (only in newer versions)
37 /// - V = Invalid
38 /// - A = Autonomous
39 /// - D = Differential
40 ///
41 class gll : public sentence
43 MARNAV_NMEA_SENTENCE_FRIENDS(gll)
45 public:
46 constexpr static const sentence_id ID = sentence_id::GLL;
47 constexpr static const char * TAG = "GLL";
49 virtual ~gll() {}
51 gll();
52 gll(const gll &) = default;
53 gll & operator=(const gll &) = default;
55 protected:
56 gll(const std::string & talker, fields::const_iterator first, fields::const_iterator last);
57 virtual std::vector<std::string> get_data() const override;
59 private:
60 utils::optional<geo::latitude> lat;
61 utils::optional<direction> lat_hem;
62 utils::optional<geo::longitude> lon;
63 utils::optional<direction> lon_hem;
64 utils::optional<nmea::time> time_utc;
65 utils::optional<status> data_valid;
66 utils::optional<mode_indicator> mode_ind;
68 public:
69 NMEA_GETTER(time_utc)
70 NMEA_GETTER(data_valid)
71 NMEA_GETTER(mode_ind)
73 utils::optional<geo::longitude> get_longitude() const;
74 utils::optional<geo::latitude> get_latitude() const;
76 void set_lat(const geo::latitude & t);
77 void set_lon(const geo::longitude & t);
78 void set_time_utc(const nmea::time & t) noexcept { time_utc = t; }
79 void set_data_valid(status t) noexcept { data_valid = t; }
80 void set_mode_indicator(mode_indicator t) noexcept { mode_ind = t; }
85 #endif