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 /// @brief VPW - Speed - Measured Parallel to Wind
16 /// $--VPW,x.x,N,x.x,M*hh<CR><LF>
21 /// 1. Speed knots, "-" means downwind
22 /// 2. Speed knots unit
24 /// 3. Speed meters per second, "-" means downwind
25 /// 4. Speed meters per second unit
26 /// - M = Meters per second
28 class vpw
: public sentence
30 friend class detail::factory
;
33 constexpr static sentence_id ID
= sentence_id::VPW
;
34 constexpr static const char * TAG
= "VPW";
37 vpw(const vpw
&) = default;
38 vpw
& operator=(const vpw
&) = default;
39 vpw(vpw
&&) = default;
40 vpw
& operator=(vpw
&&) = default;
43 vpw(talker talk
, fields::const_iterator first
, fields::const_iterator last
);
44 virtual void append_data_to(std::string
&) const override
;
47 utils::optional
<double> speed_knots_
; // negative means downwind
48 utils::optional
<unit::velocity
> speed_knots_unit_
;
49 utils::optional
<double> speed_meters_per_second_
; // negative means downwind
50 utils::optional
<unit::velocity
> speed_meters_per_second_unit_
;
53 decltype(speed_knots_
) get_speed_knots() const { return speed_knots_
; }
54 decltype(speed_knots_unit_
) get_speed_knots_unit() const { return speed_knots_unit_
; }
55 decltype(speed_meters_per_second_
) get_speed_meters_per_second() const
57 return speed_meters_per_second_
;
59 decltype(speed_meters_per_second_unit_
) get_speed_meters_per_second_unit() const
61 return speed_meters_per_second_unit_
;
64 void set_speed_knots(double t
) noexcept
;
65 void set_speed_mps(double t
) noexcept
;