AIS: smaller public interface for AIS messages regarding encoding.
[marnav.git] / src / marnav / nmea / hdm.hpp
blob1a054437b7cf429f1798e46cc4499676c356a6f7
1 #ifndef __NMEA__HDM__HPP__
2 #define __NMEA__HDM__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(hdm)
13 /// @brief HDM - Heading - Magnetic
14 ///
15 /// Vessel heading in degrees with respect to magnetic north produced by any device
16 /// or system producing magnetic heading.
17 ///
18 /// @note As of 2009, this sentence is designaged 'obsolete'. Older devices may
19 /// support them, therefore it makes sense to implement it.
20 ///
21 /// @code
22 /// 1 2
23 /// | |
24 /// $--HDM,x.x,M*hh<CR><LF>
25 /// @endcode
26 ///
27 /// Field Number:
28 /// 1. Heading Degrees magnetic
29 /// 2. Heading Degrees magnetic reference
30 /// - M = magnetic
31 ///
32 class hdm : public sentence
34 MARNAV_NMEA_SENTENCE_FRIENDS(hdm)
36 public:
37 constexpr static const sentence_id ID = sentence_id::HDM;
38 constexpr static const char * TAG = "HDM";
40 virtual ~hdm() {}
42 hdm();
43 hdm(const hdm &) = default;
44 hdm & operator=(const hdm &) = default;
46 protected:
47 hdm(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> heading; // magnetic sensor heading in deg
52 utils::optional<reference> heading_mag;
54 public:
55 NMEA_GETTER(heading)
56 NMEA_GETTER(heading_mag)
58 void set_heading(double t) noexcept;
63 #endif