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
;
31 message_26(const message_26
&) = default;
32 message_26
& operator=(const message_26
&) = default;
34 virtual raw
get_data() const override
;
36 static std::unique_ptr
<message
> parse(const raw
& data
);
44 bool is_display_in_mph() const noexcept
{ return (status
& 0x02) != 0; }
45 bool avg_speed_calc_stopped() const noexcept
{ return (status
& 0x01) != 0; }
46 bool is_sensor1_valid() const noexcept
{ return (status
& 0x40) != 0; }
47 bool is_avg_valid() const noexcept
{ return (status
& 0x80) == 0; }
48 bool is_sensor2_valid() const noexcept
{ return (status
& 0x80) != 0; }
50 double get_speed1() const noexcept
;
51 double get_speed2() const noexcept
;
53 void set_display_in_mph(bool t
) noexcept
;
54 void set_avg_speed_calc_stopped(bool t
) noexcept
;
55 void set_sensor1_valid(bool t
) noexcept
;
56 void set_avg_valid() noexcept
{ status
&= ~0x80; }
57 void set_sensor2_valid() noexcept
{ status
|= 0x80; }
59 void set_speed1(double t
) noexcept
;
60 void set_speed2(double t
) noexcept
;