2 #include <marnav/nmea/io.hpp>
8 MARNAV_NMEA_DEFINE_SENTENCE_PARSE_FUNC(osd
)
10 constexpr const char * osd::TAG
;
13 : sentence(ID
, TAG
, talker_id::integrated_instrumentation
)
17 osd::osd(talker talk
, fields::const_iterator first
, fields::const_iterator last
)
18 : sentence(ID
, TAG
, talk
)
20 if (std::distance(first
, last
) != 9)
21 throw std::invalid_argument
{"invalid number of fields in osd"};
23 read(*(first
+ 0), heading
);
24 read(*(first
+ 1), data_valid
);
25 read(*(first
+ 2), course
);
26 read(*(first
+ 3), course_ref
);
27 read(*(first
+ 4), speed
);
28 read(*(first
+ 5), speed_unit
);
29 read(*(first
+ 6), vessel_set
);
30 read(*(first
+ 7), vessel_drift
);
31 read(*(first
+ 8), vessel_drift_unit
);
34 void osd::set_course(double t
) noexcept
37 course_ref
= reference::TRUE
;
40 void osd::set_speed(double t
, unit::velocity u
) noexcept
46 void osd::set_drift(double t
, unit::velocity u
) noexcept
49 vessel_drift_unit
= u
;
52 std::vector
<std::string
> osd::get_data() const
54 return {to_string(heading
), to_string(data_valid
), to_string(course
), to_string(course_ref
),
55 to_string(speed
), to_string(speed_unit
), to_string(vessel_set
), to_string(vessel_drift
),
56 to_string(vessel_drift_unit
)};