Dev: minor cleanup of include blockers, they are now consistent.
[marnav.git] / src / marnav / nmea / vbw.hpp
blobe1d01a466d23a0d120105578f02b0684b12229d5
1 #ifndef __MARNAV__NMEA__VBW__HPP__
2 #define __MARNAV__NMEA__VBW__HPP__
4 #include <marnav/nmea/sentence.hpp>
5 #include <marnav/utils/optional.hpp>
7 namespace marnav
9 namespace nmea
11 MARNAV_NMEA_DECLARE_SENTENCE_PARSE_FUNC(vbw)
13 /// @brief VBW - Dual Ground/Water Speed
14 ///
15 /// @code
16 /// 1 2 3 4 5 6
17 /// | | | | | |
18 /// $--VBW,x.x,x.x,A,x.x,x.x,A*hh<CR><LF>
19 /// @endcode
20 ///
21 /// Field Number:
22 /// 1. Longitudinal water speed, "-" means astern
23 /// 2. Transverse water speed, "-" means port
24 /// 3. Status, A = Data Valid
25 /// - A = Data Valid
26 /// - V = Invalid
27 /// 4. Longitudinal ground speed, "-" means astern
28 /// 5. Transverse ground speed, "-" means port
29 /// 6. Status
30 /// - A = Data Valid
31 /// - V = Invalid
32 ///
33 class vbw : public sentence
35 MARNAV_NMEA_SENTENCE_FRIENDS(vbw)
37 public:
38 constexpr static const sentence_id ID = sentence_id::VBW;
39 constexpr static const char * TAG = "VBW";
41 vbw();
42 vbw(const vbw &) = default;
43 vbw & operator=(const vbw &) = default;
44 vbw(vbw &&) = default;
45 vbw & operator=(vbw &&) = default;
47 protected:
48 vbw(const std::string & talker, fields::const_iterator first, fields::const_iterator last);
49 virtual std::vector<std::string> get_data() const override;
51 private:
52 utils::optional<double> water_speed_longitudinal;
53 utils::optional<double> water_speed_transveral;
54 utils::optional<status> water_speed_status;
55 utils::optional<double> ground_speed_longitudinal;
56 utils::optional<double> ground_speed_transveral;
57 utils::optional<status> ground_speed_status;
59 public:
60 decltype(water_speed_longitudinal) get_water_speed_longitudinal() const
62 return water_speed_longitudinal;
64 decltype(water_speed_transveral) get_water_speed_transveral() const
66 return water_speed_transveral;
68 decltype(water_speed_status) get_water_speed_status() const { return water_speed_status; }
69 decltype(ground_speed_longitudinal) get_ground_speed_longitudinal() const
71 return ground_speed_longitudinal;
73 decltype(ground_speed_transveral) get_ground_speed_transveral() const
75 return ground_speed_transveral;
77 decltype(ground_speed_status) get_ground_speed_status() const
79 return ground_speed_status;
82 void set_water_speed(double l, double t, status s) noexcept;
83 void set_ground_speed(double l, double t, status s) noexcept;
88 #endif