1 #ifndef MARNAV_AIS_MESSAGE_12_HPP
2 #define MARNAV_AIS_MESSAGE_12_HPP
4 #include <marnav/ais/message.hpp>
5 #include <marnav/utils/mmsi.hpp>
11 /// @brief Addressed Safety-Related Message
12 class message_12
: public message
14 friend class detail::factory
;
17 constexpr static message_id ID
= message_id::addressed_safety_related_message
;
18 constexpr static std::size_t SIZE_BITS_HEAD
= 72u;
19 constexpr static std::size_t SIZE_BITS_MAX
= 1008u;
20 constexpr static std::size_t SIZE_TEXT_MAX
= 156u;
23 message_12(const message_12
&) = default;
24 message_12
& operator=(const message_12
&) = default;
25 message_12(message_12
&&) = default;
26 message_12
& operator=(message_12
&&) = default;
29 message_12(const raw
& bits
);
30 void read_data(const raw
& bits
);
31 virtual raw
get_data() const override
;
35 bitset_value
< 6, 2, uint32_t> repeat_indicator
= 0;
36 bitset_value
< 8, 30, uint32_t> mmsi
= 0;
37 bitset_value
<38, 2, uint32_t> seqno
= 0; ///< Sequence Number
38 bitset_value
<40, 30, uint32_t> dest_mmsi
= 0;
39 bitset_value
<70, 1, bool > retransmit
= false;
42 std::string text
; // bits 72..1008
45 uint32_t get_repeat_indicator() const noexcept
{ return repeat_indicator
; }
46 utils::mmsi
get_mmsi() const noexcept
{ return utils::mmsi
{mmsi
}; }
47 uint32_t get_seqno() const noexcept
{ return seqno
; }
48 utils::mmsi
get_dest_mmsi() const noexcept
{ return utils::mmsi
{dest_mmsi
}; }
49 bool get_retransmit() const noexcept
{ return retransmit
; }
50 std::string
get_text() const { return text
; }
52 void set_repeat_indicator(uint32_t t
) noexcept
{ repeat_indicator
= t
; }
53 void set_mmsi(const utils::mmsi
& t
) noexcept
{ mmsi
= t
; }
54 void set_seqno(uint32_t t
);
55 void set_dest_mmsi(const utils::mmsi
& t
) noexcept
{ dest_mmsi
= t
; }
56 void set_retransmit(bool t
) noexcept
{ retransmit
= t
; }
57 void set_text(const std::string
& t
);