AIS: smaller public interface for AIS messages regarding encoding.
[marnav.git] / src / marnav / nmea / bww.hpp
blob5d61505f436e8ea53cdc6029215b2aa0382df739
1 #ifndef __NMEA__BWW__HPP__
2 #define __NMEA__BWW__HPP__
4 #include <marnav/nmea/sentence.hpp>
5 #include <marnav/nmea/waypoint.hpp>
6 #include <marnav/utils/optional.hpp>
8 namespace marnav
10 namespace nmea
12 MARNAV_NMEA_DECLARE_SENTENCE_PARSE_FUNC(bww)
14 /// @brief BWW - Bearing - Waypoint to Waypoint
15 ///
16 /// @code
17 /// 1 2 3 4 5 6
18 /// | | | | | |
19 /// $--BWW,x.x,T,x.x,M,c--c,c--c*hh<CR><LF>
20 /// @endcode
21 ///
22 /// Field Number:
23 /// 1. Bearing Degrees true
24 /// 2. Bearing Degrees true reference
25 /// - T = True
26 /// 3. Bearing Degrees Magnetic
27 /// 4. Bearing Degrees Magnetic reference
28 /// - M = Magnetic
29 /// 5. TO Waypoint ID
30 /// 6. FROM Waypoint ID
31 ///
32 class bww : public sentence
34 MARNAV_NMEA_SENTENCE_FRIENDS(bww)
36 public:
37 constexpr static const sentence_id ID = sentence_id::BWW;
38 constexpr static const char * TAG = "BWW";
40 virtual ~bww() {}
42 bww();
43 bww(const bww &) = default;
44 bww & operator=(const bww &) = default;
46 protected:
47 bww(const std::string & talker, fields::const_iterator first, fields::const_iterator last);
48 virtual std::vector<std::string> get_data() const override;
50 private:
51 utils::optional<double> bearing_true;
52 utils::optional<reference> bearing_true_ref;
53 utils::optional<double> bearing_mag;
54 utils::optional<reference> bearing_mag_ref;
55 utils::optional<waypoint> waypoint_to;
56 utils::optional<waypoint> waypoint_from;
58 public:
59 NMEA_GETTER(bearing_true)
60 NMEA_GETTER(bearing_true_ref)
61 NMEA_GETTER(bearing_mag)
62 NMEA_GETTER(bearing_mag_ref)
63 NMEA_GETTER(waypoint_to)
64 NMEA_GETTER(waypoint_from)
66 void set_bearing_true(double t) noexcept;
67 void set_bearing_mag(double t) noexcept;
68 void set_waypoint_to(const waypoint & id) { waypoint_to = id; }
69 void set_waypoint_from(const waypoint & id) { waypoint_from = id; }
74 #endif