1 #ifndef __MARNAV__NMEA__BWC__HPP__
2 #define __MARNAV__NMEA__BWC__HPP__
4 #include <marnav/nmea/sentence.hpp>
5 #include <marnav/nmea/angle.hpp>
6 #include <marnav/nmea/time.hpp>
7 #include <marnav/nmea/waypoint.hpp>
8 #include <marnav/utils/optional.hpp>
14 MARNAV_NMEA_DECLARE_SENTENCE_PARSE_FUNC(bwc
)
16 /// @brief BWC - Bearing & Distance to Waypoint - Geat Circle
20 /// 1 2 3 4 5 6 7 8 9 10 11| 13
21 /// | | | | | | | | | | | | |
22 /// $--BWC,hhmmss.ss,llll.ll,a,yyyyy.yy,a,x.x,T,x.x,M,x.x,N,c--c,m*hh<CR><LF>
27 /// 2. Waypoint Latitude
28 /// 3. Latitude Hemisphere
31 /// 4. Waypoint Longitude
32 /// 5. Longitude Hemisphere
36 /// 7. Bearing True reference
38 /// 8. Bearing Magnetic
39 /// 9. Bearing Magnetic reference
41 /// 10. Nautical Miles
42 /// 11. Nautical Miles unit
43 /// - N = Nautical Miles
45 /// 13. Mode Indicator
47 /// - D = Differential
49 /// - M = Manual Input
51 /// - N = Data not valid
53 /// Example: <tt>$GPBWC,081837,,,,,,T,,M,,N,*13</tt>
55 /// Example: <tt>$GPBWC,220516,5130.02,N,00046.34,W,213.8,T,218.0,M,0004.6,N,EGLM*11</tt>
57 class bwc
: public sentence
59 MARNAV_NMEA_SENTENCE_FRIENDS(bwc
)
62 constexpr static const sentence_id ID
= sentence_id::BWC
;
63 constexpr static const char * TAG
= "BWC";
66 bwc(const bwc
&) = default;
67 bwc
& operator=(const bwc
&) = default;
68 bwc(bwc
&&) = default;
69 bwc
& operator=(bwc
&&) = default;
72 bwc(talker talk
, fields::const_iterator first
, fields::const_iterator last
);
73 virtual std::vector
<std::string
> get_data() const override
;
76 utils::optional
<nmea::time
> time_utc
;
77 utils::optional
<geo::latitude
> lat
;
78 utils::optional
<direction
> lat_hem
;
79 utils::optional
<geo::longitude
> lon
;
80 utils::optional
<direction
> lon_hem
;
81 utils::optional
<double> bearing_true
;
82 utils::optional
<reference
> bearing_true_ref
;
83 utils::optional
<double> bearing_mag
;
84 utils::optional
<reference
> bearing_mag_ref
;
85 utils::optional
<double> distance
; // nautical miles
86 utils::optional
<unit::distance
> distance_unit
;
87 utils::optional
<waypoint
> waypoint_id
;
88 utils::optional
<mode_indicator
> mode_ind
; // NMEA 2.3 and later
91 decltype(time_utc
) get_time_utc() const { return time_utc
; }
92 decltype(bearing_true
) get_bearing_true() const { return bearing_true
; }
93 decltype(bearing_true_ref
) get_bearing_true_ref() const { return bearing_true_ref
; }
94 decltype(bearing_mag
) get_bearing_mag() const { return bearing_mag
; }
95 decltype(bearing_mag_ref
) get_bearing_mag_ref() const { return bearing_mag_ref
; }
96 decltype(distance
) get_distance() const { return distance
; }
97 decltype(distance_unit
) get_distance_unit() const { return distance_unit
; }
98 decltype(waypoint_id
) get_waypoint_id() const { return waypoint_id
; }
99 decltype(mode_ind
) get_mode_ind() const { return mode_ind
; }
101 utils::optional
<geo::longitude
> get_longitude() const;
102 utils::optional
<geo::latitude
> get_latitude() const;
104 void set_time_utc(const nmea::time
& t
) noexcept
{ time_utc
= t
; }
105 void set_lat(const geo::latitude
& t
);
106 void set_lon(const geo::longitude
& t
);
107 void set_bearing_true(double t
) noexcept
;
108 void set_bearing_mag(double t
) noexcept
;
109 void set_distance(double t
) noexcept
;
110 void set_waypoint(const waypoint
& id
) { waypoint_id
= id
; }
111 void set_mode_indicator(mode_indicator t
) noexcept
{ mode_ind
= t
; }