1 #ifndef MARNAV__SEATALK__MESSAGE_53__HPP
2 #define MARNAV__SEATALK__MESSAGE_53__HPP
4 #include <marnav/seatalk/message.hpp>
5 #include <marnav/geo/angle.hpp>
12 /// @brief Magnetic Course
17 /// Magnetic Course in degrees:
18 /// The two lower bits of U * 90 +
19 /// the six lower bits of VW * 2 +
20 /// the two higher bits of U / 2 =
21 /// (U & 0x3) * 90 + (VW & 0x3F) * 2 + (U & 0xC) / 8
24 /// The Magnetic Course may be offset by the Compass Variation (see datagram 99)
25 /// to get the Course Over Ground (COG).
27 /// Corresponding NMEA sentences: RMC, VTG
29 class message_53
: public message
32 constexpr static const message_id ID
= message_id::magnetic_course
;
33 constexpr static size_t SIZE
= 3;
36 message_53(const message_53
&) = default;
37 message_53
& operator=(const message_53
&) = default;
39 virtual raw
get_data() const override
;
41 static std::unique_ptr
<message
> parse(const raw
& data
);
47 /// Returns the COG in degrees.
48 double get_cog() const noexcept
{ return cog_
; }
50 void set_cog(double t
) noexcept
;