NMEA: detectio of the optional tag block in front of a sentence, ignoring it for...
[marnav.git] / src / marnav / nmea / tds.hpp
blob41020bf52d28337156c28df83262629cd3cf6ee8
1 #ifndef __MARNAV__NMEA__TDS__HPP__
2 #define __MARNAV__NMEA__TDS__HPP__
4 #include <marnav/nmea/sentence.hpp>
5 #include <marnav/utils/optional.hpp>
7 namespace marnav
9 namespace nmea
11 MARNAV_NMEA_DECLARE_SENTENCE_PARSE_FUNC(tds)
13 /// @brief TDS - Trawl Door Spread Distance
14 ///
15 /// @code
16 /// 1 2
17 /// | |
18 /// $--TDS,x.x,M*hh<CR><LF>
19 /// @endcode
20 ///
21 /// Field Number
22 /// 1. Distance between trawl doors in meters (0..300)
23 /// 2. Units
24 /// - M = Meters
25 ///
26 class tds : public sentence
28 MARNAV_NMEA_SENTENCE_FRIENDS(tds)
30 public:
31 constexpr static const sentence_id ID = sentence_id::TDS;
32 constexpr static const char * TAG = "TDS";
34 tds();
35 tds(const tds &) = default;
36 tds & operator=(const tds &) = default;
37 tds(tds &&) = default;
38 tds & operator=(tds &&) = default;
40 protected:
41 tds(talker talk, fields::const_iterator first, fields::const_iterator last);
42 virtual std::vector<std::string> get_data() const override;
44 private:
45 double distance = 0.0;
46 nmea::unit::distance distance_unit = nmea::unit::distance::meter;
48 public:
49 decltype(distance) get_distance() const { return distance; }
50 decltype(distance_unit) get_distance_unit() const { return distance_unit; }
52 void set_distance(double t) noexcept
54 distance = t;
55 distance_unit = nmea::unit::distance::meter;
61 #endif