NMEA: explicit specification of copy/move construction and assignment.
[marnav.git] / src / marnav / nmea / ttm.hpp
blob9481b2f7e7594c1cd664fc52bb94c3e00e2a466a
1 #ifndef __NMEA__TTM__HPP__
2 #define __NMEA__TTM__HPP__
4 #include <marnav/nmea/sentence.hpp>
5 #include <marnav/utils/optional.hpp>
7 namespace marnav
9 namespace nmea
11 MARNAV_NMEA_DECLARE_SENTENCE_PARSE_FUNC(ttm)
13 /// @brief TTM - Tracked Target Message
14 ///
15 /// @code
16 /// 11 13
17 /// 1 2 3 4 5 6 7 8 9 10| 12| 14
18 /// | | | | | | | | | | | | | |
19 /// $--TTM,xx,x.x,x.x,a,x.x,x.x,a,x.x,x.x,a,c--c,a,a*hh<CR><LF>
20 /// @endcode
21 ///
22 /// Field Number:
23 /// 1. Target Number (00-99)
24 /// 2. Target Distance
25 /// 3. Bearing from own ship
26 /// 4. Bearing reference
27 /// - T = True
28 /// - R = Relative
29 /// 5. Target Speed
30 /// 6. Target Course
31 /// 7. Target Course reference
32 /// - T = True
33 /// - R = Relative
34 /// 8. Distance of closest-point-of-approach
35 /// 9. Time until closest-point-of-approach "-" means increasing
36 /// 10. ?
37 /// 11. Target name
38 /// 12. Target Status
39 /// 13. Reference Target
40 ///
41 /// @note Field 14 and 15 are not supported right now due to lack of
42 /// documentation. The sentence just ignores them. The other fields
43 /// are being processed.
44 ///
45 class ttm : public sentence
47 MARNAV_NMEA_SENTENCE_FRIENDS(ttm)
49 public:
50 constexpr static const sentence_id ID = sentence_id::TTM;
51 constexpr static const char * TAG = "TTM";
53 ttm();
54 ttm(const ttm &) = default;
55 ttm & operator=(const ttm &) = default;
56 ttm(ttm &&) = default;
57 ttm & operator=(ttm &&) = default;
59 protected:
60 ttm(const std::string & talker, fields::const_iterator first, fields::const_iterator last);
61 virtual std::vector<std::string> get_data() const override;
63 private:
64 utils::optional<uint32_t> target_number;
65 utils::optional<double> target_distance;
66 utils::optional<double> bearing_from_ownship;
67 utils::optional<reference> bearing_from_ownship_ref;
68 utils::optional<double> target_speed;
69 utils::optional<double> target_course;
70 utils::optional<reference> target_course_ref;
71 utils::optional<double> distance_cpa; ///< Distance to closest point of approach
72 utils::optional<double> tcpa;
73 utils::optional<char> unknown;
74 utils::optional<std::string> target_name;
75 utils::optional<char> target_status;
76 utils::optional<char> reference_target;
78 public:
79 MARNAV_NMEA_GETTER(target_number)
80 MARNAV_NMEA_GETTER(target_distance)
81 MARNAV_NMEA_GETTER(bearing_from_ownship)
82 MARNAV_NMEA_GETTER(bearing_from_ownship_ref)
83 MARNAV_NMEA_GETTER(target_speed)
84 MARNAV_NMEA_GETTER(target_course)
85 MARNAV_NMEA_GETTER(target_course_ref)
86 MARNAV_NMEA_GETTER(distance_cpa)
87 MARNAV_NMEA_GETTER(tcpa)
88 MARNAV_NMEA_GETTER(unknown)
89 MARNAV_NMEA_GETTER(target_name)
90 MARNAV_NMEA_GETTER(target_status)
91 MARNAV_NMEA_GETTER(reference_target)
93 void set_target_number(uint32_t t) noexcept { target_number = t; }
94 void set_target_distance(double t) noexcept { target_distance = t; }
95 void set_bearing_from_ownship(double t, reference r) noexcept
97 bearing_from_ownship = t;
98 bearing_from_ownship_ref = r;
100 void set_target_speed(double t) noexcept { target_speed = t; }
101 void set_target_course(double t, reference r) noexcept
103 target_course = t;
104 target_course_ref = r;
106 void set_distance_cpa(double t) noexcept { distance_cpa = t; }
107 void set_tcpa(double t) noexcept { tcpa = t; }
108 void set_unknown(char t) noexcept { unknown = t; }
109 void set_target_name(const std::string & t) { target_name = t; }
110 void set_target_status(char t) noexcept { target_status = t; }
111 void set_reference_target(char t) noexcept { reference_target = t; }
116 #endif