1 #ifndef __MARNAV__NMEA__MWV__HPP__
2 #define __MARNAV__NMEA__MWV__HPP__
4 #include <marnav/nmea/sentence.hpp>
5 #include <marnav/utils/optional.hpp>
11 MARNAV_NMEA_DECLARE_SENTENCE_PARSE_FUNC(mwv
)
13 /// @brief MWV - Wind Speed and Angle
18 /// $--MWV,x.x,a,x.x,a,a*hh<CR><LF>
22 /// 1. Wind Angle, 0 to 360 degrees
23 /// 2. Wind Angle Reference
27 /// 4. Wind Speed Unit
35 class mwv
: public sentence
37 MARNAV_NMEA_SENTENCE_FRIENDS(mwv
)
40 constexpr static const sentence_id ID
= sentence_id::MWV
;
41 constexpr static const char * TAG
= "MWV";
44 mwv(const mwv
&) = default;
45 mwv
& operator=(const mwv
&) = default;
46 mwv(mwv
&&) = default;
47 mwv
& operator=(mwv
&&) = default;
50 mwv(talker talk
, fields::const_iterator first
, fields::const_iterator last
);
51 virtual std::vector
<std::string
> get_data() const override
;
54 utils::optional
<double> angle
; // wind angle, 0..359 right of bow
55 utils::optional
<reference
> angle_ref
; // R:relative, T:true
56 utils::optional
<double> speed
; // wind speed
57 utils::optional
<unit::velocity
> speed_unit
; // wind speed unit, K:knots, M:mph
58 utils::optional
<status
> data_valid
; // status, A:valid
61 decltype(angle
) get_angle() const { return angle
; }
62 decltype(angle_ref
) get_angle_ref() const { return angle_ref
; }
63 decltype(speed
) get_speed() const { return speed
; }
64 decltype(speed_unit
) get_speed_unit() const { return speed_unit
; }
65 decltype(data_valid
) get_data_valid() const { return data_valid
; }
67 void set_angle(double deg
, reference ref
);
68 void set_speed(double speed
, unit::velocity u
) noexcept
;
69 void set_data_valid(status t
) noexcept
{ data_valid
= t
; }