Build: enhance docker use, reducing build options, cleanup
[marnav.git] / src / marnav / nmea / dbt.hpp
blobddb6e0c16b5a6e019eceeabb8b218b47e6e6bf5e
1 #ifndef MARNAV__NMEA__DBT__HPP
2 #define MARNAV__NMEA__DBT__HPP
4 #include <marnav/nmea/sentence.hpp>
5 #include <marnav/utils/optional.hpp>
7 namespace marnav
9 namespace nmea
11 /// @brief DBT - Depth Below Transducer
12 ///
13 /// @code
14 /// 1 2 3 4 5 6
15 /// | | | | | |
16 /// $--DBT,x.x,f,x.x,M,x.x,F*hh<CR><LF>
17 /// @endcode
18 ///
19 /// Field Number:
20 /// 1. Depth feet
21 /// 2. Depth feet unit
22 /// - f = feet
23 /// 3. Depth meters
24 /// 4. Depth meters unit
25 /// - M = meters
26 /// 5. Depth Fathoms
27 /// 6. Depth Fathoms unit
28 /// - F = Fathoms
29 ///
30 /// In real-world sensors, sometimes not all three conversions are reported.
31 /// So you night see something like <tt>$SDDBT,,f,22.5,M,,F*cs</tt>
32 ///
33 class dbt : public sentence
35 friend class detail::factory;
37 public:
38 constexpr static sentence_id ID = sentence_id::DBT;
39 constexpr static const char * TAG = "DBT";
41 dbt();
42 dbt(const dbt &) = default;
43 dbt & operator=(const dbt &) = default;
44 dbt(dbt &&) = default;
45 dbt & operator=(dbt &&) = default;
47 protected:
48 dbt(talker talk, fields::const_iterator first, fields::const_iterator last);
49 virtual void append_data_to(std::string &) const override;
51 private:
52 utils::optional<double> depth_feet_; // water depth in feet
53 utils::optional<unit::distance> depth_feet_unit_; // f:feet
54 utils::optional<double> depth_meter_; // water depth in meter
55 utils::optional<unit::distance> depth_meter_unit_; // M:meter
56 utils::optional<double> depth_fathom_; // water depth in fathom
57 utils::optional<unit::distance> depth_fathom_unit_; // F:fathom
59 public:
60 decltype(depth_feet_) get_depth_feet() const { return depth_feet_; }
61 decltype(depth_feet_unit_) get_depth_feet_unit() const { return depth_feet_unit_; }
62 decltype(depth_meter_) get_depth_meter() const { return depth_meter_; }
63 decltype(depth_meter_unit_) get_depth_meter_unit() const { return depth_meter_unit_; }
64 decltype(depth_fathom_) get_depth_fathom() const { return depth_fathom_; }
65 decltype(depth_fathom_unit_) get_depth_fathom_unit() const { return depth_fathom_unit_; }
67 void set_depth_feet(double t) noexcept;
68 void set_depth_meter(double t) noexcept;
69 void set_depth_fathom(double t) noexcept;
74 #endif