NMEA: detectio of the optional tag block in front of a sentence, ignoring it for...
[marnav.git] / src / marnav / nmea / dbk.hpp
blobff0669073bfd04489748166dff11f41a76b70cae
1 #ifndef __MARNAV__NMEA__DBK__HPP__
2 #define __MARNAV__NMEA__DBK__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(dbk)
13 /// @brief DBK - Depth Below Keel
14 ///
15 /// @note This sentence appears to be deprected, use @ref marnav::nmea::dpt "DPT" instead.
16 ///
17 /// @code
18 /// 1 2 3 4 5 6
19 /// | | | | | |
20 /// $--DBK,x.x,f,x.x,M,x.x,F*hh<CR><LF>
21 /// @endcode
22 ///
23 /// Field Number:
24 /// 1. Depth feet
25 /// 2. Depth feet unit
26 /// - f = feet
27 /// 3. Depth meters
28 /// 4. Depth meters unit
29 /// - M = meters
30 /// 5. Depth Fathoms
31 /// 6. Depth Fathoms
32 /// - F = Fathoms
33 ///
34 class dbk : public sentence
36 MARNAV_NMEA_SENTENCE_FRIENDS(dbk)
38 public:
39 constexpr static const sentence_id ID = sentence_id::DBK;
40 constexpr static const char * TAG = "DBK";
42 dbk();
43 dbk(const dbk &) = default;
44 dbk & operator=(const dbk &) = default;
45 dbk(dbk &&) = default;
46 dbk & operator=(dbk &&) = default;
48 protected:
49 dbk(talker talk, fields::const_iterator first, fields::const_iterator last);
50 virtual std::vector<std::string> get_data() const override;
52 private:
53 utils::optional<double> depth_feet;
54 utils::optional<unit::distance> depth_feet_unit;
55 utils::optional<double> depth_meter;
56 utils::optional<unit::distance> depth_meter_unit;
57 utils::optional<double> depth_fathom;
58 utils::optional<unit::distance> depth_fathom_unit;
60 public:
61 decltype(depth_feet) get_depth_feet() const { return depth_feet; }
62 decltype(depth_feet_unit) get_depth_feet_unit() const { return depth_feet_unit; }
63 decltype(depth_meter) get_depth_meter() const { return depth_meter; }
64 decltype(depth_meter_unit) get_depth_meter_unit() const { return depth_meter_unit; }
65 decltype(depth_fathom) get_depth_fathom() const { return depth_fathom; }
66 decltype(depth_fathom_unit) get_depth_fathom_unit() const { return depth_fathom_unit; }
68 void set_depth_feet(double t) noexcept;
69 void set_depth_meter(double t) noexcept;
70 void set_depth_fathom(double t) noexcept;
75 #endif