1 #ifndef __MARNAV__NMEA__TTM__HPP__
2 #define __MARNAV__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(talker talk
, 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 decltype(target_number
) get_target_number() const { return target_number
; }
80 decltype(target_distance
) get_target_distance() const { return target_distance
; }
81 decltype(bearing_from_ownship
) get_bearing_from_ownship() const
83 return bearing_from_ownship
;
85 decltype(bearing_from_ownship_ref
) get_bearing_from_ownship_ref() const
87 return bearing_from_ownship_ref
;
89 decltype(target_speed
) get_target_speed() const { return target_speed
; }
90 decltype(target_course
) get_target_course() const { return target_course
; }
91 decltype(target_course_ref
) get_target_course_ref() const { return target_course_ref
; }
92 decltype(distance_cpa
) get_distance_cpa() const { return distance_cpa
; }
93 decltype(tcpa
) get_tcpa() const { return tcpa
; }
94 decltype(unknown
) get_unknown() const { return unknown
; }
95 decltype(target_name
) get_target_name() const { return target_name
; }
96 decltype(target_status
) get_target_status() const { return target_status
; }
97 decltype(reference_target
) get_reference_target() const { return reference_target
; }
99 void set_target_number(uint32_t t
) noexcept
{ target_number
= t
; }
100 void set_target_distance(double t
) noexcept
{ target_distance
= t
; }
101 void set_bearing_from_ownship(double t
, reference r
) noexcept
103 bearing_from_ownship
= t
;
104 bearing_from_ownship_ref
= r
;
106 void set_target_speed(double t
) noexcept
{ target_speed
= t
; }
107 void set_target_course(double t
, reference r
) noexcept
110 target_course_ref
= r
;
112 void set_distance_cpa(double t
) noexcept
{ distance_cpa
= t
; }
113 void set_tcpa(double t
) noexcept
{ tcpa
= t
; }
114 void set_unknown(char t
) noexcept
{ unknown
= t
; }
115 void set_target_name(const std::string
& t
) { target_name
= t
; }
116 void set_target_status(char t
) noexcept
{ target_status
= t
; }
117 void set_reference_target(char t
) noexcept
{ reference_target
= t
; }