Build: add GCC-13, Clang-14, Clang-15, Clang-16, Clang-17
[marnav.git] / include / marnav / nmea / vpw.hpp
blob0d494269da3b117be14a760be098cf534635b6ee
1 #ifndef MARNAV_NMEA_VPW_HPP
2 #define MARNAV_NMEA_VPW_HPP
4 #include <marnav/nmea/sentence.hpp>
5 #include <marnav/units/units.hpp>
6 #include <optional>
8 namespace marnav::nmea
10 /// @brief VPW - Speed - Measured Parallel to Wind
11 ///
12 /// @code
13 /// 1 2 3 4
14 /// | | | |
15 /// $--VPW,x.x,N,x.x,M*hh<CR><LF>
16 /// @endcode
17 ///
18 /// Field Number:
19 ///
20 /// 1. Speed knots, "-" means downwind
21 /// 2. Speed knots unit
22 /// - N = Knots
23 /// 3. Speed meters per second, "-" means downwind
24 /// 4. Speed meters per second unit
25 /// - M = Meters per second
26 ///
27 class vpw : public sentence
29 friend class detail::factory;
31 public:
32 constexpr static sentence_id ID = sentence_id::VPW;
33 constexpr static const char * TAG = "VPW";
35 vpw();
36 vpw(const vpw &) = default;
37 vpw & operator=(const vpw &) = default;
38 vpw(vpw &&) = default;
39 vpw & operator=(vpw &&) = default;
41 protected:
42 vpw(talker talk, fields::const_iterator first, fields::const_iterator last);
43 void append_data_to(std::string &, const version &) const override;
45 private:
46 std::optional<units::knots> speed_knots_; // negative means downwind
47 std::optional<units::meters_per_second> speed_mps_; // negative means downwind
49 public:
50 std::optional<units::knots> get_speed_knots() const;
51 std::optional<units::meters_per_second> get_speed_meters_per_second() const;
53 void set_speed_knots(units::velocity t) noexcept;
54 void set_speed_mps(units::velocity t) noexcept;
58 #endif