1 #include "message_22.hpp"
4 #include <marnav/ais/angle.hpp>
10 MARNAV_AIS_DEFINE_MESSAGE_PARSE_FUNC(message_22
)
12 message_22::message_22()
17 message_22::message_22(const raw
& bits
)
20 if (bits
.size() != SIZE_BITS
)
21 throw std::invalid_argument
{"invalid number of bits in message_22"};
25 void message_22::read_data(const raw
& bits
)
27 get(bits
, repeat_indicator
);
49 raw
message_22::get_data() const
53 bits
.set(type(), 0, 6);
54 set(bits
, repeat_indicator
);
78 geo::position
message_22::get_position_ne() const noexcept
80 return {geo::latitude
{ne_lat
/ (60.0 * 10.0)}, geo::longitude
{ne_lon
/ (60.0 * 10.0)}};
83 geo::position
message_22::get_position_sw() const noexcept
85 return {geo::latitude
{sw_lat
/ (60.0 * 10.0)}, geo::longitude
{sw_lon
/ (60.0 * 10.0)}};
88 void message_22::set_position_ne(const geo::position
& t
) noexcept
90 ne_lat
= std::floor(60.0 * 10.0 * t
.lat());
91 ne_lon
= std::floor(60.0 * 10.0 * t
.lon());
94 void message_22::set_position_sw(const geo::position
& t
) noexcept
96 sw_lat
= std::floor(60.0 * 10.0 * t
.lat());
97 sw_lon
= std::floor(60.0 * 10.0 * t
.lon());