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";
43 hdg(const hdg
&) = default;
44 hdg(hdg
&&) = default;
45 hdg
& operator=(const hdg
&) = default;
46 hdg
& operator=(hdg
&&) = default;
49 hdg(const std::string
& talker
, fields::const_iterator first
, fields::const_iterator last
);
50 virtual std::vector
<std::string
> get_data() const override
;
53 utils::optional
<double> heading
; // magnetic sensor heading in deg
54 utils::optional
<double> magn_dev
; // magnetic deviation in deg
55 utils::optional
<direction
> magn_dev_hem
; // E:east, W:west
56 utils::optional
<double> magn_var
; // magnetic variation in deg
57 utils::optional
<direction
> magn_var_hem
; // E:east, W:west
62 NMEA_GETTER(magn_dev_hem
)
64 NMEA_GETTER(magn_var_hem
)
66 void set_heading(double t
) noexcept
{ heading
= t
; }
67 void set_magn_dev(double deg
, direction hem
);
68 void set_magn_var(double deg
, direction hem
);