NMEA: detectio of the optional tag block in front of a sentence, ignoring it for...
[marnav.git] / src / marnav / nmea / tll.hpp
blobae522aaa1818cd332f681106833eba041c48f883
1 #ifndef __MARNAV__NMEA__TLL__HPP__
2 #define __MARNAV__NMEA__TLL__HPP__
4 #include <marnav/nmea/sentence.hpp>
5 #include <marnav/nmea/time.hpp>
6 #include <marnav/nmea/waypoint.hpp>
7 #include <marnav/geo/angle.hpp>
8 #include <marnav/utils/optional.hpp>
10 namespace marnav
12 namespace nmea
14 MARNAV_NMEA_DECLARE_SENTENCE_PARSE_FUNC(tll)
16 /// @brief TLL - Target latitude and longitude
17 ///
18 /// @code
19 /// 1 2 3 4 5 6 7 8 9
20 /// | | | | | | | | |
21 /// $--TLL,xx,llll.lll,a,yyyyy.yyy,a,c--c,hhmmss.ss,a,a*hh<CR><LF>
22 /// @endcode
23 ///
24 /// Field Number:
25 /// 1. Target number 00 - 99
26 /// 2. Latitude
27 /// 3. Latitude hemisphere
28 /// - N = North
29 /// - S = South
30 /// 4. Longitude
31 /// 5. Longitude hemisphere
32 /// - E = East
33 /// - W = West
34 /// 6. Target name
35 /// 7. UTC of data
36 /// 8. Target status
37 /// - L = lost,tracked target has beenlost
38 /// - Q = query,target in the process of acquisition
39 /// - T = tracking
40 /// 9. Reference target
41 /// - R
42 /// - null/empty
43 ///
44 class tll : public sentence
46 MARNAV_NMEA_SENTENCE_FRIENDS(tll)
48 public:
49 constexpr static const sentence_id ID = sentence_id::TLL;
50 constexpr static const char * TAG = "TLL";
52 tll();
53 tll(const tll &) = default;
54 tll & operator=(const tll &) = default;
55 tll(tll &&) = default;
56 tll & operator=(tll &&) = default;
58 protected:
59 tll(talker talk, fields::const_iterator first, fields::const_iterator last);
60 virtual std::vector<std::string> get_data() const override;
62 private:
63 uint32_t number = 0;
64 geo::latitude lat;
65 direction lat_hem = direction::north;
66 geo::longitude lon;
67 direction lon_hem = direction::east;
68 waypoint name;
69 nmea::time time_utc;
70 target_status status = target_status::tracking;
71 utils::optional<char> reference_target;
73 public:
74 decltype(number) get_number() const { return number; }
75 decltype(name) get_name() const { return name; }
76 decltype(time_utc) get_time_utc() const { return time_utc; }
77 decltype(status) get_status() const { return status; }
78 decltype(reference_target) get_reference_target() const { return reference_target; }
80 geo::longitude get_longitude() const;
81 geo::latitude get_latitude() const;
83 void set_number(uint32_t t) noexcept { number = t; }
84 void set_lat(const geo::latitude & t);
85 void set_lon(const geo::longitude & t);
86 void set_name(const waypoint & t) { name = t; }
87 void set_time_utc(const nmea::time & t) noexcept { time_utc = t; }
88 void set_status(target_status t) noexcept { status = t; }
89 void set_reference_target(char t) noexcept { reference_target = t; }
94 #endif