1 #ifndef __NMEA__MWV__HPP__
2 #define __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";
46 mwv(const mwv
&) = default;
47 mwv
& operator=(const mwv
&) = default;
50 mwv(const std::string
& talker
, 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
62 NMEA_GETTER(angle_ref
)
64 NMEA_GETTER(speed_unit
)
65 NMEA_GETTER(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
; }