NMEA: consistency of macro names, exported by headers, all start now with 'MARNAV_'.
[marnav.git] / src / marnav / nmea / wcv.hpp
blobbfe16ede7114c926725376fa22cfa1c67a7a6c26
1 #ifndef __NMEA__WCV__HPP__
2 #define __NMEA__WCV__HPP__
4 #include <marnav/nmea/sentence.hpp>
5 #include <marnav/nmea/waypoint.hpp>
6 #include <marnav/utils/optional.hpp>
8 namespace marnav
10 namespace nmea
12 MARNAV_NMEA_DECLARE_SENTENCE_PARSE_FUNC(wcv)
14 /// @brief WCV - Waypoint Closure Velocity
15 ///
16 /// @code
17 /// 1 2 3
18 /// | | |
19 /// $--WCV,x.x,N,c--c*hh<CR><LF>
20 /// @endcode
21 ///
22 /// Field Number:
23 /// 1. Velocity
24 /// 2. Velocity unit
25 /// - N = knots
26 /// 3. Waypoint ID
27 ///
28 class wcv : public sentence
30 MARNAV_NMEA_SENTENCE_FRIENDS(wcv)
32 public:
33 constexpr static const sentence_id ID = sentence_id::WCV;
34 constexpr static const char * TAG = "WCV";
36 virtual ~wcv() {}
38 wcv();
39 wcv(const wcv &) = default;
40 wcv & operator=(const wcv &) = default;
42 protected:
43 wcv(const std::string & talker, fields::const_iterator first, fields::const_iterator last);
44 virtual std::vector<std::string> get_data() const override;
46 private:
47 utils::optional<double> speed;
48 utils::optional<unit::velocity> speed_unit;
49 utils::optional<waypoint> waypoint_id;
51 public:
52 MARNAV_NMEA_GETTER(speed)
53 MARNAV_NMEA_GETTER(speed_unit)
54 MARNAV_NMEA_GETTER(waypoint_id)
56 void set_speed(double t) noexcept;
57 void set_waypoint(const waypoint & id) { waypoint_id = id; }
62 #endif