Build: enhance docker use, reducing build options, cleanup
[marnav.git] / src / marnav / seatalk / message_53.hpp
blobf7e40b4ca7b9dcf65161c5d901d76ff0d97c6742
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>
7 namespace marnav
9 namespace seatalk
12 /// @brief Magnetic Course
13 ///
14 /// @code
15 /// 53 U0 VW
16 ///
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
22 /// @endcode
23 ///
24 /// The Magnetic Course may be offset by the Compass Variation (see datagram 99)
25 /// to get the Course Over Ground (COG).
26 ///
27 /// Corresponding NMEA sentences: RMC, VTG
28 ///
29 class message_53 : public message
31 public:
32 constexpr static const message_id ID = message_id::magnetic_course;
33 constexpr static size_t SIZE = 3;
35 message_53();
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);
43 private:
44 double cog_;
46 public:
47 /// Returns the COG in degrees.
48 double get_cog() const noexcept { return cog_; }
50 void set_cog(double t) noexcept;
55 #endif