NMEA: detectio of the optional tag block in front of a sentence, ignoring it for...
[marnav.git] / src / marnav / nmea / zfo.hpp
blobac19c36f20a3695f14d7e0ece4e46e9a99112879
1 #ifndef __MARNAV__NMEA__ZFO__HPP__
2 #define __MARNAV__NMEA__ZFO__HPP__
4 #include <marnav/nmea/sentence.hpp>
5 #include <marnav/nmea/time.hpp>
6 #include <marnav/nmea/waypoint.hpp>
7 #include <marnav/utils/optional.hpp>
9 namespace marnav
11 namespace nmea
13 MARNAV_NMEA_DECLARE_SENTENCE_PARSE_FUNC(zfo)
15 /// @brief ZFO - UTC & Time from origin Waypoint
16 ///
17 /// @code
18 /// 1 2 3
19 /// | | |
20 /// $--ZFO,hhmmss.ss,hhmmss.ss,c--c*hh<CR><LF>
21 /// @endcode
22 ///
23 /// Field Number:
24 /// 1. Universal Time Coordinated (UTC)
25 /// 2. Elapsed Time
26 /// 3. Origin Waypoint ID
27 ///
28 class zfo : public sentence
30 MARNAV_NMEA_SENTENCE_FRIENDS(zfo)
32 public:
33 constexpr static const sentence_id ID = sentence_id::ZFO;
34 constexpr static const char * TAG = "ZFO";
36 zfo();
37 zfo(const zfo &) = default;
38 zfo & operator=(const zfo &) = default;
39 zfo(zfo &&) = default;
40 zfo & operator=(zfo &&) = default;
42 protected:
43 zfo(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<nmea::time> time_utc;
48 utils::optional<nmea::duration> time_elapsed;
49 utils::optional<waypoint> waypoint_id;
51 public:
52 decltype(time_utc) get_time_utc() const { return time_utc; }
53 decltype(time_elapsed) get_time_elapsed() const { return time_elapsed; }
54 decltype(waypoint_id) get_waypoint_id() const { return waypoint_id; }
56 void set_time_utc(const nmea::time & t) noexcept { time_utc = t; }
57 void set_time_elapsed(const nmea::duration & t) noexcept { time_elapsed = t; }
58 void set_waypoint_id(const waypoint & id) { waypoint_id = id; }
63 #endif