SeaTalk: message 54 added.
[marnav.git] / src / marnav / seatalk / message_05.hpp
blobb5f3ecddf7f3ded2463dc849d4517f563bc256ae
1 #ifndef __SEATALK__MESSAGE_05__HPP__
2 #define __SEATALK__MESSAGE_05__HPP__
4 #include <marnav/seatalk/message.hpp>
6 namespace marnav
8 namespace seatalk
11 /// @brief Engine RPM and PITCH
12 ///
13 /// @code
14 /// 05 03 0X YY ZZ PP
15 ///
16 /// Engine RPM and PITCH:
17 /// X = 0: RPM & PITCH
18 /// X = 1: RPM & PITCH starboard
19 /// X = 2: PRM & PITCH port
20 /// YY*256+ZZ = RPM Value (signed value, example: YYZZ=0x0110=272 RPM, YYZZ=0xfef0= -272 RPM)
21 /// PP = % Pitch (signed value -128%...+127%, example 0x03=3%, 0xFD= -3%)
22 /// @endcode
23 ///
24 class message_05 : public message
26 public:
27 constexpr static const message_id ID = message_id::engine_rpm_and_pitch;
29 enum class side_id { undefined, starboard, port };
31 message_05();
32 message_05(const message_05 &) = default;
33 message_05 & operator=(const message_05 &) = default;
35 virtual raw get_data() const override;
37 static std::unique_ptr<message> parse(const raw & data);
39 private:
40 side_id side;
41 int32_t rpm;
42 int8_t percent_pitch;
44 public:
45 side_id get_side() const noexcept { return side; }
46 int16_t get_rpm() const noexcept { return rpm; }
47 int8_t get_percent_pitch() const noexcept { return percent_pitch; }
49 void set_side(side_id t) noexcept { side = t; }
50 void set_rpm(int16_t t) noexcept { rpm = t; }
51 void set_percent_pitch(int8_t t) noexcept { percent_pitch = t; }
56 #endif