1 #ifndef __NMEA__BOD__HPP__
2 #define __NMEA__BOD__HPP__
4 #include <marnav/nmea/sentence.hpp>
5 #include <marnav/nmea/waypoint.hpp>
6 #include <marnav/utils/optional.hpp>
12 MARNAV_NMEA_DECLARE_SENTENCE_PARSE_FUNC(bod
)
14 /// @brief BOD - Bearing - Waypoint to Waypoint
19 /// $--BOD,x.x,T,x.x,M,c--c,c--c*hh<CR><LF>
23 /// 1. Bearing Degrees True
24 /// 2. Bearing Degrees True reference
26 /// 3. Bearing Degrees Magnetic
27 /// 4. Bearing Degrees Magnetic reference
30 /// 6. FROM Waypoint ID
32 /// Example: <tt>$GPBOD,099.3,T,105.6,M,POINTB,*01</tt>
34 class bod
: public sentence
36 MARNAV_NMEA_SENTENCE_FRIENDS(bod
)
39 constexpr static const sentence_id ID
= sentence_id::BOD
;
40 constexpr static const char * TAG
= "BOD";
43 bod(const bod
&) = default;
44 bod
& operator=(const bod
&) = default;
45 bod(bod
&&) = default;
46 bod
& operator=(bod
&&) = default;
49 bod(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> bearing_true
;
54 utils::optional
<reference
> type_true
; // T:true
55 utils::optional
<double> bearing_magn
;
56 utils::optional
<reference
> type_magn
; // M:magnetic
57 utils::optional
<waypoint
> waypoint_to
; // TO waypoint ID
58 utils::optional
<waypoint
> waypoint_from
; // FROM waypoint ID
61 decltype(bearing_true
) get_bearing_true() const { return bearing_true
; }
62 decltype(type_true
) get_type_true() const { return type_true
; }
63 decltype(bearing_magn
) get_bearing_magn() const { return bearing_magn
; }
64 decltype(type_magn
) get_type_magn() const { return type_magn
; }
65 decltype(waypoint_to
) get_waypoint_to() const { return waypoint_to
; }
66 decltype(waypoint_from
) get_waypoint_from() const { return waypoint_from
; }
68 void set_bearing_true(double t
) noexcept
;
69 void set_bearing_magn(double t
) noexcept
;
70 void set_waypoint_to(const waypoint
& id
) { waypoint_to
= id
; }
71 void set_waypoint_from(const waypoint
& id
) { waypoint_from
= id
; }