1 #ifndef __NMEA__OSD__HPP__
2 #define __NMEA__OSD__HPP__
4 #include <marnav/nmea/sentence.hpp>
5 #include <marnav/utils/optional.hpp>
11 MARNAV_NMEA_DECLARE_SENTENCE_PARSE_FUNC(osd
)
13 /// @brief OSD - Own Ship Data
18 /// $--OSD,x.x,A,x.x,a,x.x,a,x.x,x.x,a*hh<CR><LF>
22 /// 1. Heading, degrees true
26 /// 3. Vessel Course, degrees True
27 /// 4. Course Reference
31 /// 7. Vessel Set, degrees True
32 /// 8. Vessel drift (speed)
35 class osd
: public sentence
37 MARNAV_NMEA_SENTENCE_FRIENDS(osd
)
40 constexpr static const sentence_id ID
= sentence_id::OSD
;
41 constexpr static const char * TAG
= "OSD";
46 osd(const osd
&) = default;
47 osd
& operator=(const osd
&) = default;
50 osd(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> heading
; // degrees true
55 utils::optional
<status
> data_valid
;
56 utils::optional
<double> course
; // degrees true
57 utils::optional
<reference
> course_ref
;
58 utils::optional
<double> speed
;
59 utils::optional
<unit::velocity
> speed_unit
;
60 utils::optional
<double> vessel_set
; // degrees true
61 utils::optional
<double> vessel_drift
; // (speed)
62 utils::optional
<unit::velocity
> vessel_drift_unit
;
66 NMEA_GETTER(data_valid
)
68 NMEA_GETTER(course_ref
)
70 NMEA_GETTER(speed_unit
)
71 NMEA_GETTER(vessel_set
)
72 NMEA_GETTER(vessel_drift
)
73 NMEA_GETTER(vessel_drift_unit
)
75 void set_heading(double t
) noexcept
{ heading
= t
; }
76 void set_data_valid(status t
) noexcept
{ data_valid
= t
; }
77 void set_course(double t
) noexcept
;
78 void set_speed(double t
, unit::velocity u
) noexcept
;
79 void set_vessel_set(double t
) noexcept
{ vessel_set
= t
; }
80 void set_drift(double t
, unit::velocity u
) noexcept
;