1 #ifndef __NMEA__APB__HPP__
2 #define __NMEA__APB__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(apb
)
14 /// @brief APB - Autopilot Sentence "B"
16 /// This is a fixed form of the APA sentence with some ambiguities removed.
20 /// 1 2 3 4 5 6 7 8 9 10 11 12| 14|
21 /// | | | | | | | | | | | | | | |
22 /// $--APB,A,A,x.x,a,N,A,A,x.x,a,c--c,x.x,a,x.x,a,a*hh<CR><LF>
28 /// - V = LORAN-C Blink or SNR warning
29 /// - V = general warning flag or other navigation systems when a reliable fix is not
32 /// - A = Data valid or not used
33 /// - V = Loran-C Cycle Lock warning flag
34 /// 3. Magnitude of Cross Track Error
35 /// 4. Direction to steer
38 /// 5. Cross Track Units
39 /// - N = Nautical Miles
41 /// - A = Arrival Circle Entered
43 /// - A = Perpendicular passed at waypoint
44 /// 8. Bearing origin to destination
45 /// 9. Bearing origin to destination reference
48 /// 10. Destination Waypoint ID
49 /// 11. Bearing, present position to destination
50 /// 12. Bearing, present position to destination reference
53 /// 13. Heading to steer to destination waypoint
54 /// 14. Heading to steer to destination waypoint reference
57 /// 15. Mode indicator
60 /// - D = Differential
62 class apb
: public sentence
64 MARNAV_NMEA_SENTENCE_FRIENDS(apb
)
67 constexpr static const sentence_id ID
= sentence_id::APB
;
68 constexpr static const char * TAG
= "APB";
71 apb(const apb
&) = default;
72 apb
& operator=(const apb
&) = default;
73 apb(apb
&&) = default;
74 apb
& operator=(apb
&&) = default;
77 apb(const std::string
& talker
, fields::const_iterator first
, fields::const_iterator last
);
78 virtual std::vector
<std::string
> get_data() const override
;
81 utils::optional
<status
> loran_c_blink_warning
;
82 utils::optional
<status
> loran_c_cycle_lock_warning
;
83 utils::optional
<double> cross_track_error_magnitude
;
84 utils::optional
<side
> direction_to_steer
;
85 utils::optional
<unit::distance
> cross_track_unit
;
86 utils::optional
<status
> status_arrival
;
87 utils::optional
<status
> status_perpendicular_passing
;
88 utils::optional
<double> bearing_origin_to_destination
;
89 utils::optional
<reference
> bearing_origin_to_destination_ref
;
90 utils::optional
<waypoint
> waypoint_id
;
91 utils::optional
<double> bearing_pos_to_destination
;
92 utils::optional
<reference
> bearing_pos_to_destination_ref
;
93 utils::optional
<double> heading_to_steer_to_destination
;
94 utils::optional
<reference
> heading_to_steer_to_destination_ref
;
95 utils::optional
<mode_indicator
> mode_ind
;
100 MARNAV_NMEA_GETTER(loran_c_blink_warning
)
101 MARNAV_NMEA_GETTER(loran_c_cycle_lock_warning
)
102 MARNAV_NMEA_GETTER(cross_track_error_magnitude
)
103 MARNAV_NMEA_GETTER(direction_to_steer
)
104 MARNAV_NMEA_GETTER(cross_track_unit
)
105 MARNAV_NMEA_GETTER(status_arrival
)
106 MARNAV_NMEA_GETTER(status_perpendicular_passing
)
107 MARNAV_NMEA_GETTER(bearing_origin_to_destination
)
108 MARNAV_NMEA_GETTER(bearing_origin_to_destination_ref
)
109 MARNAV_NMEA_GETTER(waypoint_id
)
110 MARNAV_NMEA_GETTER(bearing_pos_to_destination
)
111 MARNAV_NMEA_GETTER(bearing_pos_to_destination_ref
)
112 MARNAV_NMEA_GETTER(heading_to_steer_to_destination
)
113 MARNAV_NMEA_GETTER(heading_to_steer_to_destination_ref
)
114 MARNAV_NMEA_GETTER(mode_ind
)
116 void set_loran_c_blink_warning(status t
) noexcept
{ loran_c_blink_warning
= t
; }
117 void set_loran_c_cycle_lock_warning(status t
) noexcept
{ loran_c_cycle_lock_warning
= t
; }
118 void set_cross_track_error_magnitude(double t
) noexcept
120 cross_track_error_magnitude
= t
;
121 cross_track_unit
= unit::distance::nm
;
123 void set_direction_to_steer(side t
) noexcept
{ direction_to_steer
= t
; }
124 void set_status_arrival(status t
) noexcept
{ status_arrival
= t
; }
125 void set_status_perpendicular_passing(status t
) noexcept
127 status_perpendicular_passing
= t
;
129 void set_bearing_origin_to_destination(double t
, reference ref
);
130 void set_waypoint_id(const waypoint
& id
) { waypoint_id
= id
; }
131 void set_bearing_pos_to_destination(double t
, reference ref
);
132 void set_heading_to_steer_to_destination(double t
, reference ref
);
133 void set_mode_indicator(mode_indicator t
);