NMEA: consistency of macro names, exported by headers, all start now with 'MARNAV_'.
[marnav.git] / src / marnav / nmea / dbt.hpp
blob728a20631044841b82fb735360742280be322eab
1 #ifndef __NMEA__DBT__HPP__
2 #define __NMEA__DBT__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(dbt)
13 /// @brief DBT - Depth Below Transducer
14 ///
15 /// @code
16 /// 1 2 3 4 5 6
17 /// | | | | | |
18 /// $--DBT,x.x,f,x.x,M,x.x,F*hh<CR><LF>
19 /// @endcode
20 ///
21 /// Field Number:
22 /// 1. Depth feet
23 /// 2. Depth feet unit
24 /// - f = feet
25 /// 3. Depth meters
26 /// 4. Depth meters unit
27 /// - M = meters
28 /// 5. Depth Fathoms
29 /// 6. Depth Fathoms unit
30 /// - F = Fathoms
31 ///
32 /// In real-world sensors, sometimes not all three conversions are reported.
33 /// So you night see something like <tt>$SDDBT,,f,22.5,M,,F*cs</tt>
34 ///
35 class dbt : public sentence
37 MARNAV_NMEA_SENTENCE_FRIENDS(dbt)
39 public:
40 constexpr static const sentence_id ID = sentence_id::DBT;
41 constexpr static const char * TAG = "DBT";
43 virtual ~dbt() {}
45 dbt();
46 dbt(const dbt &) = default;
47 dbt & operator=(const dbt &) = default;
49 protected:
50 dbt(const std::string & talker, fields::const_iterator first, fields::const_iterator last);
51 virtual std::vector<std::string> get_data() const override;
53 private:
54 utils::optional<double> depth_feet; // water depth in feet
55 utils::optional<unit::distance> depth_feet_unit; // f:feet
56 utils::optional<double> depth_meter; // water depth in meter
57 utils::optional<unit::distance> depth_meter_unit; // M:meter
58 utils::optional<double> depth_fathom; // water depth in fathom
59 utils::optional<unit::distance> depth_fathom_unit; // F:fathom
61 public:
62 MARNAV_NMEA_GETTER(depth_feet)
63 MARNAV_NMEA_GETTER(depth_feet_unit)
64 MARNAV_NMEA_GETTER(depth_meter)
65 MARNAV_NMEA_GETTER(depth_meter_unit)
66 MARNAV_NMEA_GETTER(depth_fathom)
67 MARNAV_NMEA_GETTER(depth_fathom_unit)
69 void set_depth_feet(double t) noexcept;
70 void set_depth_meter(double t) noexcept;
71 void set_depth_fathom(double t) noexcept;
76 #endif