1 #ifndef __SEATALK__MESSAGE_26__HPP__
2 #define __SEATALK__MESSAGE_26__HPP__
4 #include <marnav/seatalk/message.hpp>
11 /// @brief Speed through water
14 /// 26 04 XX XX YY YY DE
16 /// XXXX/100 Knots, sensor 1, current speed, valid if D & 4 == 4
17 /// YYYY/100 Knots, average speed (trip/time) if D & 8 == 0
18 /// or data from sensor 2 if D & 8 == 8
19 /// E & 1 == 1: Average speed calulation stopped
20 /// E & 2 == 2: Display value in MPH
23 /// Corresponding NMEA sentence: VHW
25 class message_26
: public message
28 constexpr static const message_id ID
= message_id::speed_through_water_2
;
29 constexpr static size_t SIZE
= 7;
32 message_26(const message_26
&) = default;
33 message_26
& operator=(const message_26
&) = default;
35 virtual raw
get_data() const override
;
37 static std::unique_ptr
<message
> parse(const raw
& data
);
45 bool is_display_in_mph() const noexcept
{ return (status
& 0x02) != 0; }
46 bool avg_speed_calc_stopped() const noexcept
{ return (status
& 0x01) != 0; }
47 bool is_sensor1_valid() const noexcept
{ return (status
& 0x40) != 0; }
48 bool is_avg_valid() const noexcept
{ return (status
& 0x80) == 0; }
49 bool is_sensor2_valid() const noexcept
{ return (status
& 0x80) != 0; }
51 double get_speed1() const noexcept
;
52 double get_speed2() const noexcept
;
54 void set_display_in_mph(bool t
) noexcept
;
55 void set_avg_speed_calc_stopped(bool t
) noexcept
;
56 void set_sensor1_valid(bool t
) noexcept
;
57 void set_avg_valid() noexcept
{ status
&= ~0x80; }
58 void set_sensor2_valid() noexcept
{ status
|= 0x80; }
60 void set_speed1(double t
) noexcept
;
61 void set_speed2(double t
) noexcept
;