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