NMEA: detectio of the optional tag block in front of a sentence, ignoring it for...
[marnav.git] / src / marnav / nmea / zdl.hpp
blob625e968fc0ddfc47775dcff4fa26b3cf3a724b14
1 #ifndef __MARNAV__NMEA__ZDL__HPP__
2 #define __MARNAV__NMEA__ZDL__HPP__
4 #include <marnav/nmea/sentence.hpp>
5 #include <marnav/nmea/time.hpp>
6 #include <marnav/utils/optional.hpp>
8 namespace marnav
10 namespace nmea
12 MARNAV_NMEA_DECLARE_SENTENCE_PARSE_FUNC(zdl)
14 /// @brief ZDL - Time and Distance to Variable Point
15 ///
16 /// @code
17 /// 1 2 3
18 /// | | |
19 /// $--ZDL,hhmmss.ss,x.x,a*hh<CR><LF>
20 /// @endcode
21 ///
22 /// Field Number:
23 /// 1. Time to Point, hh=00..99
24 /// 2. Distance to Point, nautical miles
25 /// 3. Type of Point, see below
26 ///
27 /// Type of Point:
28 /// - C = Collision
29 /// - T = Turning Point
30 /// - R = Reference (general)
31 /// - W = Wheelover
32 ///
33 class zdl : public sentence
35 MARNAV_NMEA_SENTENCE_FRIENDS(zdl)
37 public:
38 constexpr static const sentence_id ID = sentence_id::ZDL;
39 constexpr static const char * TAG = "ZDL";
41 zdl();
42 zdl(const zdl &) = default;
43 zdl & operator=(const zdl &) = default;
44 zdl(zdl &&) = default;
45 zdl & operator=(zdl &&) = default;
47 protected:
48 zdl(talker talk, fields::const_iterator first, fields::const_iterator last);
49 virtual std::vector<std::string> get_data() const override;
51 private:
52 duration time_to_point;
53 double distance = 0.0;
54 type_of_point type_point = type_of_point::reference;
56 public:
57 decltype(time_to_point) get_time_to_point() const { return time_to_point; }
58 decltype(distance) get_distance() const { return distance; }
59 decltype(type_point) get_type_point() const { return type_point; }
61 void set_time_to_point(const duration & t) noexcept { time_to_point = t; }
62 void set_distance(double t) noexcept { distance = t; }
63 void set_type_point(type_of_point t) noexcept { type_point = t; }
68 #endif