NMEA: changed interface of sentences containing position information.
[marnav.git] / src / marnav / nmea / tll.hpp
blob205060c1d694b80d42ddf9d87c699ee83bc1dcec
1 #ifndef __NMEA__TLL__HPP__
2 #define __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 virtual ~tll() {}
54 tll();
55 tll(const tll &) = default;
56 tll & operator=(const tll &) = default;
58 protected:
59 tll(const std::string & talker, fields::const_iterator first, fields::const_iterator last);
60 virtual std::vector<std::string> get_data() const override;
62 private:
63 uint32_t target_number = 0;
64 geo::latitude lat;
65 direction lat_hem = direction::north;
66 geo::longitude lon;
67 direction lon_hem = direction::east;
68 waypoint target_name;
69 nmea::time time_utc;
70 char target_status = 'T'; // @todo use an enumeration
71 utils::optional<char> reference_target;
73 public:
74 NMEA_GETTER(target_number)
75 NMEA_GETTER(target_name)
76 NMEA_GETTER(time_utc)
77 NMEA_GETTER(target_status)
78 NMEA_GETTER(reference_target)
80 geo::longitude get_longitude() const;
81 geo::latitude get_latitude() const;
83 void set_target_number(uint32_t t) noexcept { target_number = t; }
84 void set_lat(const geo::latitude & t);
85 void set_lon(const geo::longitude & t);
86 void set_target_name(const waypoint & t) { target_name = t; }
87 void set_time_utc(const nmea::time & t) noexcept { time_utc = t; }
88 void set_target_status(char t) noexcept { target_status = t; }
89 void set_reference_target(char t) noexcept { reference_target = t; }
94 #endif