1 #ifndef __NMEA__HDG__HPP__
2 #define __NMEA__HDG__HPP__
4 #include <marnav/nmea/sentence.hpp>
5 #include <marnav/utils/optional.hpp>
11 MARNAV_NMEA_DECLARE_SENTENCE_PARSE_FUNC(hdg
)
13 /// @brief HDG - Heading - Deviation & Variation
18 /// $--HDG,x.x,x.x,a,x.x,a*hh<CR><LF>
22 /// 1. Magnetic Sensor heading in degrees
23 /// 2. Magnetic Deviation degrees
24 /// 3. Magnetic Deviation direction
27 /// 4. Magnetic Variation degrees
28 /// 5. Magnetic Variation direction
32 class hdg
: public sentence
34 MARNAV_NMEA_SENTENCE_FRIENDS(hdg
)
37 constexpr static const sentence_id ID
= sentence_id::HDG
;
38 constexpr static const char * TAG
= "HDG";
41 hdg(const hdg
&) = default;
42 hdg
& operator=(const hdg
&) = default;
43 hdg(hdg
&&) = default;
44 hdg
& operator=(hdg
&&) = default;
47 hdg(const std::string
& talker
, fields::const_iterator first
, fields::const_iterator last
);
48 virtual std::vector
<std::string
> get_data() const override
;
51 utils::optional
<double> heading
; // magnetic sensor heading in deg
52 utils::optional
<double> magn_dev
; // magnetic deviation in deg
53 utils::optional
<direction
> magn_dev_hem
; // E:east, W:west
54 utils::optional
<double> magn_var
; // magnetic variation in deg
55 utils::optional
<direction
> magn_var_hem
; // E:east, W:west
58 MARNAV_NMEA_GETTER(heading
)
59 MARNAV_NMEA_GETTER(magn_dev
)
60 MARNAV_NMEA_GETTER(magn_dev_hem
)
61 MARNAV_NMEA_GETTER(magn_var
)
62 MARNAV_NMEA_GETTER(magn_var_hem
)
64 void set_heading(double t
) noexcept
{ heading
= t
; }
65 void set_magn_dev(double deg
, direction hem
);
66 void set_magn_var(double deg
, direction hem
);