AIS: smaller public interface for AIS messages regarding encoding.
[marnav.git] / src / marnav / nmea / vdr.hpp
blobb5ba3b8a8825aec9e8ce15d2a628d25c8837c496
1 #ifndef __NMEA__VDR__HPP__
2 #define __NMEA__VDR__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(vdr)
13 /// @brief VDR - Set and Drift
14 ///
15 /// @code
16 /// 1 2 3 4 5 6
17 /// | | | | | |
18 /// $--VDR,x.x,T,x.x,M,x.x,N*hh<CR><LF>
19 /// @endcode
20 ///
21 /// Field Number:
22 /// 1. Degress True
23 /// 2. Degress True reference
24 /// - T = True
25 /// 3. Degrees Magnetic
26 /// 4. Degrees Magnetic reference
27 /// - M = Magnetic
28 /// 5. Speed of current
29 /// 6. Speed of current unit
30 /// - N = Knots
31 ///
32 class vdr : public sentence
34 MARNAV_NMEA_SENTENCE_FRIENDS(vdr)
36 public:
37 constexpr static const sentence_id ID = sentence_id::VDR;
38 constexpr static const char * TAG = "VDR";
40 virtual ~vdr() {}
42 vdr();
43 vdr(const vdr &) = default;
44 vdr & operator=(const vdr &) = default;
46 protected:
47 vdr(const std::string & talker, fields::const_iterator first, fields::const_iterator last);
48 virtual std::vector<std::string> get_data() const override;
50 private:
51 utils::optional<double> degrees_true;
52 utils::optional<reference> degrees_true_ref; // T:true
53 utils::optional<double> degrees_mag;
54 utils::optional<reference> degrees_mag_ref; // M:magnetic
55 utils::optional<double> speed;
56 utils::optional<unit::velocity> speed_unit; // N:knots
58 public:
59 NMEA_GETTER(degrees_true)
60 NMEA_GETTER(degrees_true_ref)
61 NMEA_GETTER(degrees_mag)
62 NMEA_GETTER(degrees_mag_ref)
63 NMEA_GETTER(speed)
64 NMEA_GETTER(speed_unit)
66 void set_degrees_true(double t) noexcept;
67 void set_degrees_mag(double t) noexcept;
68 void set_speed(double t) noexcept;
73 #endif