NMEA: Qt example extended.
[marnav.git] / src / marnav / nmea / dbk.hpp
blob1c47aa93666b4a1267faab2215c6ee1851367ae3
1 #ifndef __NMEA__DBK__HPP__
2 #define __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 virtual ~dbk() {}
44 dbk();
45 dbk(const dbk &) = default;
46 dbk & operator=(const dbk &) = default;
48 protected:
49 dbk(const std::string & talker, 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 NMEA_GETTER(depth_feet)
62 NMEA_GETTER(depth_feet_unit)
63 NMEA_GETTER(depth_meter)
64 NMEA_GETTER(depth_meter_unit)
65 NMEA_GETTER(depth_fathom)
66 NMEA_GETTER(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