SeaTalk: message 54 added.
[marnav.git] / src / marnav / seatalk / message_24.hpp
blob3754f014b777a05ac984883fceaa44e87fe4304f
1 #ifndef __SEATALK__MESSAGE_24__HPP__
2 #define __SEATALK__MESSAGE_24__HPP__
4 #include <marnav/seatalk/message.hpp>
6 namespace marnav
8 namespace seatalk
11 /// @brief Display units for Mileage and Speed
12 ///
13 /// @code
14 /// 24 02 00 00 XX
15 ///
16 /// XX:
17 /// 0x00 : nautical miles (1852m), knots (nautical miles per hour)
18 /// 0x06 : statute miles (1609.3m), statute miles per hour
19 /// 0x86 : kilometers (1000m), kilometers per hour
20 /// @endcode
21 ///
22 class message_24 : public message
24 public:
25 constexpr static const message_id ID = message_id::display_units_mileage_speed;
27 enum unit_type : uint8_t {
28 nautical_miles = 0x00,
29 knots = 0x00,
30 statute_miles = 0x06,
31 statute_miles_per_hour = 0x06,
32 kilometers = 0x86,
33 kilometers_per_hour = 0x86,
36 message_24();
37 message_24(const message_24 &) = default;
38 message_24 & operator=(const message_24 &) = default;
40 virtual raw get_data() const override;
42 static std::unique_ptr<message> parse(const raw & data);
44 private:
45 unit_type unit;
47 public:
48 unit_type get_unit() const noexcept { return unit; }
50 void set_unit(unit_type t) noexcept { unit = t; }
55 #endif