1 #ifndef __MARNAV__NMEA__VPW__HPP__
2 #define __MARNAV__NMEA__VPW__HPP__
4 #include <marnav/nmea/sentence.hpp>
5 #include <marnav/utils/optional.hpp>
11 MARNAV_NMEA_DECLARE_SENTENCE_PARSE_FUNC(vpw
)
13 /// @brief VPW - Speed - Measured Parallel to Wind
18 /// $--VPW,x.x,N,x.x,M*hh<CR><LF>
23 /// 1. Speed knots, "-" means downwind
24 /// 2. Speed knots unit
26 /// 3. Speed meters per second, "-" means downwind
27 /// 4. Speed meters per second unit
28 /// - M = Meters per second
30 class vpw
: public sentence
32 MARNAV_NMEA_SENTENCE_FRIENDS(vpw
)
35 constexpr static const sentence_id ID
= sentence_id::VPW
;
36 constexpr static const char * TAG
= "VPW";
39 vpw(const vpw
&) = default;
40 vpw
& operator=(const vpw
&) = default;
41 vpw(vpw
&&) = default;
42 vpw
& operator=(vpw
&&) = default;
45 vpw(talker talk
, fields::const_iterator first
, fields::const_iterator last
);
46 virtual std::vector
<std::string
> get_data() const override
;
49 utils::optional
<double> speed_knots
; // negative means downwind
50 utils::optional
<unit::velocity
> speed_knots_unit
;
51 utils::optional
<double> speed_meters_per_second
; // negative means downwind
52 utils::optional
<unit::velocity
> speed_meters_per_second_unit
;
55 decltype(speed_knots
) get_speed_knots() const { return speed_knots
; }
56 decltype(speed_knots_unit
) get_speed_knots_unit() const { return speed_knots_unit
; }
57 decltype(speed_meters_per_second
) get_speed_meters_per_second() const
59 return speed_meters_per_second
;
61 decltype(speed_meters_per_second_unit
) get_speed_meters_per_second_unit() const
63 return speed_meters_per_second_unit
;
66 void set_speed_knots(double t
) noexcept
;
67 void set_speed_mps(double t
) noexcept
;