1 #ifndef __NMEA__TTM__HPP__
2 #define __NMEA__TTM__HPP__
4 #include <marnav/nmea/sentence.hpp>
5 #include <marnav/utils/optional.hpp>
11 MARNAV_NMEA_DECLARE_SENTENCE_PARSE_FUNC(ttm
)
13 /// @brief TTM - Tracked Target Message
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>
23 /// 1. Target Number (00-99)
24 /// 2. Target Distance
25 /// 3. Bearing from own ship
26 /// 4. Bearing reference
31 /// 7. Target Course reference
34 /// 8. Distance of closest-point-of-approach
35 /// 9. Time until closest-point-of-approach "-" means increasing
39 /// 13. Reference Target
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.
45 class ttm
: public sentence
47 MARNAV_NMEA_SENTENCE_FRIENDS(ttm
)
50 constexpr static const sentence_id ID
= sentence_id::TTM
;
51 constexpr static const char * TAG
= "TTM";
54 ttm(const ttm
&) = default;
55 ttm
& operator=(const ttm
&) = default;
56 ttm(ttm
&&) = default;
57 ttm
& operator=(ttm
&&) = default;
60 ttm(const std::string
& talker
, fields::const_iterator first
, fields::const_iterator last
);
61 virtual std::vector
<std::string
> get_data() const override
;
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
;
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
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
; }