NMEA: detectio of the optional tag block in front of a sentence, ignoring it for...
[marnav.git] / src / marnav / nmea / mtw.hpp
blobe8595d426d6fc6d70689f246ea964245c77d2906
1 #ifndef __MARNAV__NMEA__MTW__HPP__
2 #define __MARNAV__NMEA__MTW__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(mtw)
13 /// @brief MTW - Mean Temperature of Water
14 ///
15 /// @code
16 /// 1 2
17 /// | |
18 /// $--MTW,x.x,C*hh<CR><LF>
19 /// @endcode
20 ///
21 /// Field Number:
22 /// 1. Degrees
23 /// 2. Unit of Measurement
24 /// - C = Celcius
25 ///
26 class mtw : public sentence
28 MARNAV_NMEA_SENTENCE_FRIENDS(mtw)
30 public:
31 constexpr static const sentence_id ID = sentence_id::MTW;
32 constexpr static const char * TAG = "MTW";
34 mtw();
35 mtw(const mtw &) = default;
36 mtw & operator=(const mtw &) = default;
37 mtw(mtw &&) = default;
38 mtw & operator=(mtw &&) = default;
40 protected:
41 mtw(talker talk, fields::const_iterator first, fields::const_iterator last);
42 virtual std::vector<std::string> get_data() const override;
44 private:
45 utils::optional<double> temperature; // water temperature
46 utils::optional<unit::temperature> temperature_unit; // unit degrees, C:celcius
48 public:
49 decltype(temperature) get_temperature() const { return temperature; }
50 decltype(temperature_unit) get_temperature_unit() const { return temperature_unit; }
52 void set_temperature(double t) noexcept;
57 #endif