2 #include <marnav/nmea/io.hpp>
8 MARNAV_NMEA_DEFINE_SENTENCE_PARSE_FUNC(vdr
)
10 constexpr const char * vdr::TAG
;
13 : sentence(ID
, TAG
, talker_id::integrated_instrumentation
)
17 vdr::vdr(talker talk
, fields::const_iterator first
, fields::const_iterator last
)
18 : sentence(ID
, TAG
, talk
)
20 if (std::distance(first
, last
) != 6)
21 throw std::invalid_argument
{"invalid number of fields in vdr"};
23 read(*(first
+ 0), degrees_true
);
24 read(*(first
+ 1), degrees_true_ref
);
25 read(*(first
+ 2), degrees_mag
);
26 read(*(first
+ 3), degrees_mag_ref
);
27 read(*(first
+ 4), speed
);
28 read(*(first
+ 5), speed_unit
);
31 void vdr::set_degrees_true(double t
) noexcept
34 degrees_true_ref
= reference::TRUE
;
37 void vdr::set_degrees_mag(double t
) noexcept
40 degrees_mag_ref
= reference::MAGNETIC
;
43 void vdr::set_speed(double t
) noexcept
46 speed_unit
= unit::velocity::knot
;
49 std::vector
<std::string
> vdr::get_data() const
51 return {to_string(degrees_true
), to_string(degrees_true_ref
), to_string(degrees_mag
),
52 to_string(degrees_mag_ref
), to_string(speed
), to_string(speed_unit
)};