NMEA: detectio of the optional tag block in front of a sentence, ignoring it for...
[marnav.git] / src / marnav / nmea / wcv.hpp
blobb8ce6b2461e1d340aa9f240bed8e5cee95b2d980
1 #ifndef __MARNAV__NMEA__WCV__HPP__
2 #define __MARNAV__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 wcv();
37 wcv(const wcv &) = default;
38 wcv & operator=(const wcv &) = default;
39 wcv(wcv &&) = default;
40 wcv & operator=(wcv &&) = default;
42 protected:
43 wcv(talker talk, 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 decltype(speed) get_speed() const { return speed; }
53 decltype(speed_unit) get_speed_unit() const { return speed_unit; }
54 decltype(waypoint_id) get_waypoint_id() const { return waypoint_id; }
56 void set_speed(double t) noexcept;
57 void set_waypoint(const waypoint & id) { waypoint_id = id; }
62 #endif