AIS: smaller public interface for AIS messages regarding encoding.
[marnav.git] / src / marnav / nmea / dpt.hpp
blobc1192d81d1ab0031adf70ec3051183ce7a269ea3
1 #ifndef __NMEA__DPT__HPP__
2 #define __NMEA__DPT__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(dpt)
13 /// @brief DPT - Depth of Water
14 ///
15 /// Water depth relative to the transducer and offset of the measuring transducer.
16 ///
17 /// @code
18 /// 1 2 3
19 /// | | |
20 /// $--DPT,x.x,x.x,x.x*hh<CR><LF>
21 /// @endcode
22 ///
23 /// Field Number:
24 /// 1. Depth meters
25 /// 2. Offset from transducer
26 /// - positive value means distance from tansducer to water line
27 /// - negative value means distance from transducer to keel
28 /// 3. Max depth in meters, might be empty. This field exists allegedly since NMEA 3.0
29 ///
30 class dpt : public sentence
32 MARNAV_NMEA_SENTENCE_FRIENDS(dpt)
34 public:
35 constexpr static const sentence_id ID = sentence_id::DPT;
36 constexpr static const char * TAG = "DPT";
38 virtual ~dpt() {}
40 dpt();
41 dpt(const std::string & talker);
42 dpt(const dpt &) = default;
43 dpt & operator=(const dpt &) = default;
45 protected:
46 dpt(const std::string & talker, fields::const_iterator first, fields::const_iterator last);
47 virtual std::vector<std::string> get_data() const override;
49 private:
50 double depth_meter = 0.0;
51 double transducer_offset = 0.0;
52 utils::optional<double> max_depth;
54 public:
55 NMEA_GETTER(depth_meter)
56 NMEA_GETTER(transducer_offset)
57 NMEA_GETTER(max_depth)
59 void set_depth_meter(double t) noexcept { depth_meter = t; }
60 void set_transducer_offset(double t) noexcept { transducer_offset = t; }
61 void set_max_depth(double t) noexcept { max_depth = t; }
66 #endif