2 #include <marnav/nmea/io.hpp>
8 MARNAV_NMEA_DEFINE_SENTENCE_PARSE_FUNC(vwr
)
10 constexpr const char * vwr::TAG
;
13 : sentence(ID
, TAG
, talker_id::integrated_instrumentation
)
17 vwr::vwr(talker talk
, fields::const_iterator first
, fields::const_iterator last
)
18 : sentence(ID
, TAG
, talk
)
20 if (std::distance(first
, last
) != 8)
21 throw std::invalid_argument
{"invalid number of fields in vwr"};
23 read(*(first
+ 0), angle
);
24 read(*(first
+ 1), angle_side
);
25 read(*(first
+ 2), speed_knots
);
26 read(*(first
+ 3), speed_knots_unit
);
27 read(*(first
+ 4), speed_mps
);
28 read(*(first
+ 5), speed_mps_unit
);
29 read(*(first
+ 6), speed_kmh
);
30 read(*(first
+ 7), speed_kmh_unit
);
33 void vwr::set_angle(double angle
, side s
) noexcept
39 void vwr::set_speed_knots(double t
) noexcept
42 speed_knots_unit
= unit::velocity::knot
;
45 void vwr::set_speed_mps(double t
) noexcept
48 speed_mps_unit
= unit::velocity::mps
;
51 void vwr::set_speed_kmh(double t
) noexcept
54 speed_kmh_unit
= unit::velocity::kmh
;
57 std::vector
<std::string
> vwr::get_data() const
59 return {to_string(angle
), to_string(angle_side
), to_string(speed_knots
),
60 to_string(speed_knots_unit
), to_string(speed_mps
), to_string(speed_mps_unit
),
61 to_string(speed_kmh
), to_string(speed_kmh_unit
)};