AIS: smaller public interface for AIS messages regarding encoding.
[marnav.git] / src / marnav / nmea / gll.hpp
blobb686f6ec012bf72f0555c48231228a87008317b1
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<positioning_system_mode_indicator> mode_indicator;
68 public:
69 NMEA_GETTER(lat)
70 NMEA_GETTER(lat_hem)
71 NMEA_GETTER(lon)
72 NMEA_GETTER(lon_hem)
73 NMEA_GETTER(time_utc)
74 NMEA_GETTER(data_valid)
75 NMEA_GETTER(mode_indicator)
77 void set_lat(const geo::latitude & t);
78 void set_lon(const geo::longitude & t);
79 void set_time_utc(const nmea::time & t) noexcept { time_utc = t; }
80 void set_data_valid(status t) noexcept { data_valid = t; }
81 void set_mode_indicator(positioning_system_mode_indicator t) noexcept
83 mode_indicator = t;
89 #endif