1 #include <marnav/nmea/vwr.hpp>
2 #include <marnav/nmea/io.hpp>
8 constexpr sentence_id
vwr::ID
;
9 constexpr const char * vwr::TAG
;
12 : sentence(ID
, TAG
, talker_id::integrated_instrumentation
)
16 vwr::vwr(talker talk
, fields::const_iterator first
, fields::const_iterator last
)
17 : sentence(ID
, TAG
, talk
)
19 if (std::distance(first
, last
) != 8)
20 throw std::invalid_argument
{"invalid number of fields in vwr"};
22 read(*(first
+ 0), angle_
);
23 read(*(first
+ 1), angle_side_
);
24 read(*(first
+ 2), speed_knots_
);
25 read(*(first
+ 3), speed_knots_unit_
);
26 read(*(first
+ 4), speed_mps_
);
27 read(*(first
+ 5), speed_mps_unit_
);
28 read(*(first
+ 6), speed_kmh_
);
29 read(*(first
+ 7), speed_kmh_unit_
);
32 void vwr::set_angle(double angle
, side s
) noexcept
38 void vwr::set_speed_knots(double t
) noexcept
41 speed_knots_unit_
= unit::velocity::knot
;
44 void vwr::set_speed_mps(double t
) noexcept
47 speed_mps_unit_
= unit::velocity::mps
;
50 void vwr::set_speed_kmh(double t
) noexcept
53 speed_kmh_unit_
= unit::velocity::kmh
;
56 void vwr::append_data_to(std::string
& s
) const
58 append(s
, to_string(angle_
));
59 append(s
, to_string(angle_side_
));
60 append(s
, to_string(speed_knots_
));
61 append(s
, to_string(speed_knots_unit_
));
62 append(s
, to_string(speed_mps_
));
63 append(s
, to_string(speed_mps_unit_
));
64 append(s
, to_string(speed_kmh_
));
65 append(s
, to_string(speed_kmh_unit_
));