1 #ifndef __AIS__MESSAGE_23__HPP__
2 #define __AIS__MESSAGE_23__HPP__
4 #include <marnav/ais/message.hpp>
5 #include <marnav/geo/position.hpp>
6 #include <marnav/utils/mmsi.hpp>
12 MARNAV_AIS_DECLARE_MESSAGE_PARSE_FUNC(message_23
)
14 /// @brief Group Assignment Command
16 class message_23
: public message
18 MARNAV_AIS_MESSAGE_FRIENDS(message_23
)
21 constexpr static const message_id ID
= message_id::group_assignment_command
;
22 constexpr static const int SIZE_BITS
= 160;
24 enum class report_interval
: uint8_t {
36 // reserved for future use: 11 - 15
39 virtual ~message_23() {}
42 message_23(const message_23
&) = default;
43 message_23
& operator=(const message_23
&) = default;
46 message_23(const raw
& bits
);
47 void read_data(const raw
& bits
);
48 virtual raw
get_data() const override
;
52 bitset_value
< 6, 2, uint32_t > repeat_indicator
= 0;
53 bitset_value
< 8, 30, uint32_t > mmsi
= 0;
54 bitset_value
< 40, 18, uint32_t > ne_lon
= longitude_not_available_short
;
55 bitset_value
< 58, 17, uint32_t > ne_lat
= latitude_not_available_short
;
56 bitset_value
< 75, 18, uint32_t > sw_lon
= longitude_not_available_short
;
57 bitset_value
< 93, 17, uint32_t > sw_lat
= latitude_not_available_short
;
58 bitset_value
<110, 4, uint32_t > station_type
= 0;
59 bitset_value
<114, 8, ship_type
> shiptype
= ship_type::not_available
;
60 bitset_value
<144, 2, uint32_t > txrx_mode
= 0;
61 bitset_value
<146, 4, report_interval
> interval
= report_interval::autonomous_mode
;
62 bitset_value
<150, 4, uint32_t > quiet_time
= 0; // minutes (0=none, 1..15 minutes)
66 uint32_t get_repeat_indicator() const noexcept
{ return repeat_indicator
; }
67 utils::mmsi
get_mmsi() const noexcept
{ return utils::mmsi
{mmsi
}; }
68 uint32_t get_station_type() const noexcept
{ return station_type
; }
69 uint32_t get_txrx_mode() const noexcept
{ return txrx_mode
; }
70 report_interval
get_interval() const noexcept
{ return interval
; }
71 uint32_t get_quiet_time() const noexcept
{ return quiet_time
; }
73 geo::position
get_position_ne() const noexcept
;
74 geo::position
get_position_sw() const noexcept
;
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_station_type(uint32_t t
) noexcept
{ station_type
= t
; }
79 void set_txrx_mode(uint32_t t
) noexcept
{ txrx_mode
= t
; }
80 void set_interval(report_interval t
) { interval
= t
; }
81 void set_quiet_time(uint32_t t
) noexcept
{ quiet_time
= t
; }
83 void set_position_ne(const geo::position
& t
) noexcept
;
84 void set_position_sw(const geo::position
& t
) noexcept
;