1 #ifndef __NMEA__WNC__HPP__
2 #define __NMEA__WNC__HPP__
4 #include <marnav/nmea/sentence.hpp>
5 #include <marnav/nmea/waypoint.hpp>
6 #include <marnav/utils/optional.hpp>
12 MARNAV_NMEA_DECLARE_SENTENCE_PARSE_FUNC(wnc
)
14 /// @brief WNC - Distance - Waypoint to Waypoint
19 /// $--WNC,x.x,N,x.x,K,c--c,c--c*hh<CR><LF>
23 /// 1. Distance nautical miles
24 /// 2. Distance nautical miles unit
25 /// - N = Nautical Miles
26 /// 3. Distance Kilometers
27 /// 4. Distance Kilometers unit
30 /// 6. FROM Waypoint ID
32 class wnc
: public sentence
34 MARNAV_NMEA_SENTENCE_FRIENDS(wnc
)
37 constexpr static const sentence_id ID
= sentence_id::WNC
;
38 constexpr static const char * TAG
= "WNC";
41 wnc(const wnc
&) = default;
42 wnc
& operator=(const wnc
&) = default;
43 wnc(wnc
&&) = default;
44 wnc
& operator=(wnc
&&) = default;
47 wnc(const std::string
& talker
, fields::const_iterator first
, fields::const_iterator last
);
48 virtual std::vector
<std::string
> get_data() const override
;
51 utils::optional
<double> distance_nm
;
52 utils::optional
<unit::distance
> distance_nm_unit
;
53 utils::optional
<double> distance_km
;
54 utils::optional
<unit::distance
> distance_km_unit
;
55 utils::optional
<waypoint
> waypoint_to
;
56 utils::optional
<waypoint
> waypoint_from
;
59 MARNAV_NMEA_GETTER(distance_nm
)
60 MARNAV_NMEA_GETTER(distance_nm_unit
)
61 MARNAV_NMEA_GETTER(distance_km
)
62 MARNAV_NMEA_GETTER(distance_km_unit
)
63 MARNAV_NMEA_GETTER(waypoint_to
)
64 MARNAV_NMEA_GETTER(waypoint_from
)
66 void set_distance_nm(double t
) noexcept
;
67 void set_distance_km(double t
) noexcept
;
68 void set_waypoint_to(const waypoint
& id
) { waypoint_to
= id
; }
69 void set_waypoint_from(const waypoint
& id
) { waypoint_from
= id
; }