NMEA: detectio of the optional tag block in front of a sentence, ignoring it for...
[marnav.git] / src / marnav / ais / message_19.hpp
blob8adf55b1f8459a3fde0c09a7b7b9fe553b39ef5e
1 #ifndef __MARNAV__AIS__MESSAGE_19__HPP__
2 #define __MARNAV__AIS__MESSAGE_19__HPP__
4 #include <marnav/ais/message.hpp>
5 #include <marnav/geo/angle.hpp>
6 #include <marnav/utils/mmsi.hpp>
7 #include <marnav/utils/optional.hpp>
9 namespace marnav
11 namespace ais
13 MARNAV_AIS_DECLARE_MESSAGE_PARSE_FUNC(message_19)
15 /// @brief Extended Class B Equipment Position Report
16 class message_19 : public message
18 MARNAV_AIS_MESSAGE_FRIENDS(message_19)
20 public:
21 constexpr static const message_id ID
22 = message_id::extended_class_b_equipment_position_report;
23 constexpr static const int SIZE_BITS = 312;
25 message_19();
26 message_19(const message_19 &) = default;
27 message_19 & operator=(const message_19 &) = default;
28 message_19(message_19 &&) = default;
29 message_19 & operator=(message_19 &&) = default;
31 protected:
32 message_19(message_id id);
33 message_19(const raw & bits);
34 void read_data(const raw & bits);
35 virtual raw get_data() const override;
37 private:
38 // clang-format off
39 bitset_value< 6, 2, uint32_t > repeat_indicator = 0;
40 bitset_value< 8, 30, uint32_t > mmsi = 0;
41 bitset_value< 46, 10, uint32_t > sog = sog_not_available; // speed over ground, in 0.1 knots
42 bitset_value< 56, 1, bool > position_accuracy = false;
43 bitset_value< 57, 28, uint32_t > longitude_minutes = longitude_not_available; // in 10000 minutes
44 bitset_value< 85, 27, uint32_t > latitude_minutes = latitude_not_available; // in 10000 minutes
45 bitset_value<112, 12, uint32_t > cog = cog_not_available; // course of ground in 0.1 deg true north
46 bitset_value<124, 9, uint32_t > hdg = hdg_not_available; // true heading in deg
47 bitset_value<133, 6, uint32_t > timestamp = timestamp_not_available;
48 bitset_value<143, 20, std::string > shipname;
49 bitset_value<263, 8, ship_type > shiptype = ship_type::not_available;
50 bitset_value<271, 9, uint32_t > to_bow = 0;
51 bitset_value<280, 9, uint32_t > to_stern = 0;
52 bitset_value<289, 6, uint32_t > to_port = 0;
53 bitset_value<295, 6, uint32_t > to_starboard = 0;
54 bitset_value<301, 4, epfd_fix_type> epfd_fix = epfd_fix_type::undefined;
55 bitset_value<305, 1, bool > raim = false;
56 bitset_value<306, 1, data_terminal> dte = data_terminal::not_ready;
57 bitset_value<307, 1, bool > assigned = false;
58 // clang-format on
60 public:
61 uint32_t get_repeat_indicator() const noexcept { return repeat_indicator; }
62 utils::mmsi get_mmsi() const noexcept { return utils::mmsi{mmsi}; }
63 uint32_t get_sog() const noexcept { return sog; }
64 bool get_position_accuracy() const noexcept { return position_accuracy; }
65 uint32_t get_cog() const noexcept { return cog; }
66 uint32_t get_hdg() const noexcept { return hdg; }
67 uint32_t get_timestamp() const noexcept { return timestamp; }
68 std::string get_shipname() const { return shipname; }
69 ship_type get_shiptype() const noexcept { return shiptype; }
70 uint32_t get_to_bow() const noexcept { return to_bow; }
71 uint32_t get_to_stern() const noexcept { return to_stern; }
72 uint32_t get_to_port() const noexcept { return to_port; }
73 uint32_t get_to_starboard() const noexcept { return to_starboard; }
74 epfd_fix_type get_epfd_fix() const noexcept { return epfd_fix; }
75 bool get_raim() const noexcept { return raim; }
76 data_terminal get_dte() const noexcept { return dte; }
77 bool get_assigned() const noexcept { return assigned; }
79 void set_repeat_indicator(uint32_t t) noexcept { repeat_indicator = t; }
80 void set_mmsi(const utils::mmsi & t) noexcept { mmsi = t; }
81 void set_sog(uint32_t t) noexcept { sog = t; }
82 void set_position_accuracy(bool t) noexcept { position_accuracy = t; }
83 void set_cog(uint32_t t) noexcept { cog = t; }
84 void set_hdg(uint32_t t) noexcept { hdg = t; }
85 void set_timestamp(uint32_t t) noexcept { timestamp = t; }
86 void set_shipname(const std::string & t);
87 void set_shiptype(ship_type t) noexcept { shiptype = t; }
88 void set_to_bow(uint32_t t) noexcept { to_bow = t; }
89 void set_to_stern(uint32_t t) noexcept { to_stern = t; }
90 void set_to_port(uint32_t t) noexcept { to_port = t; }
91 void set_to_starboard(uint32_t t) noexcept { to_starboard = t; }
92 void set_epfd_fix(epfd_fix_type t) noexcept { epfd_fix = t; }
93 void set_raim(bool t) noexcept { raim = t; }
94 void set_dte(data_terminal t) noexcept { dte = t; }
95 void set_assigned(bool t) noexcept { assigned = t; }
97 utils::optional<geo::longitude> get_longitude() const;
98 utils::optional<geo::latitude> get_latitude() const;
99 void set_longitude(const utils::optional<geo::longitude> & t);
100 void set_latitude(const utils::optional<geo::latitude> & t);
105 #endif