1 #ifndef __AIS__MESSAGE_09__HPP__
2 #define __AIS__MESSAGE_09__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>
13 MARNAV_AIS_DECLARE_MESSAGE_PARSE_FUNC(message_09
)
15 /// @brief Standard SAR Aircraft Position Report.
16 class message_09
: public message
18 MARNAV_AIS_MESSAGE_FRIENDS(message_09
)
21 constexpr static const message_id ID
= message_id::standard_sar_aircraft_position_report
;
22 constexpr static const int SIZE_BITS
= 168;
24 constexpr static const uint32_t altitude_not_available
= 4095;
26 virtual ~message_09() {}
29 message_09(const message_09
&) = default;
30 message_09
& operator=(const message_09
&) = default;
33 message_09(const raw
& bits
);
34 void read_data(const raw
& bits
);
35 virtual raw
get_data() const override
;
39 bitset_value
< 6, 2, uint32_t> repeat_indicator
= 0;
40 bitset_value
< 8, 30, uint32_t> mmsi
= 0;
41 bitset_value
< 38, 12, uint32_t> altitude
= altitude_not_available
;
42 bitset_value
< 50, 10, uint32_t> speed
= sog_not_available
; // speed over ground in knots
43 bitset_value
< 60, 1, bool > position_accuracy
= false;
44 bitset_value
< 61, 28, uint32_t> longitude_minutes
= longitude_not_available
; // in 10000 minutes
45 bitset_value
< 89, 27, uint32_t> latitude_minutes
= latitude_not_available
; // in 10000 minutes
46 bitset_value
<116, 12, uint32_t> course
= cog_not_available
; // in 0.1 degrees
47 bitset_value
<128, 6, uint32_t> utc_second
= second_not_available
;
48 bitset_value
<134, 8, uint8_t > reserved
= 0;
49 bitset_value
<142, 1, bool > dte
= false;
50 bitset_value
<146, 1, bool > assigned
= false;
51 bitset_value
<147, 1, bool > raim
= false;
52 bitset_value
<148, 20, uint32_t> radio_status
= 0;
56 uint32_t get_repeat_indicator() const noexcept
{ return repeat_indicator
; }
57 utils::mmsi
get_mmsi() const noexcept
{ return utils::mmsi
{mmsi
}; }
58 uint32_t get_altitude() const noexcept
{ return altitude
; }
59 uint32_t get_speed() const noexcept
{ return speed
; }
60 bool get_position_accuracy() const noexcept
{ return position_accuracy
; }
61 uint32_t get_course() const noexcept
{ return course
; }
62 uint32_t get_utc_second() const noexcept
{ return utc_second
; }
63 bool get_dte() const noexcept
{ return dte
; }
64 bool get_assigned() const noexcept
{ return assigned
; }
65 bool get_raim() const noexcept
{ return raim
; }
66 uint32_t get_radio_status() const noexcept
{ return radio_status
; }
68 void set_repeat_indicator(uint32_t t
) noexcept
{ repeat_indicator
= t
; }
69 void set_mmsi(const utils::mmsi
& t
) noexcept
{ mmsi
= t
; }
70 void set_altitude(uint32_t t
) noexcept
{ altitude
= t
; }
71 void set_speed(uint32_t t
) noexcept
{ speed
= t
; }
72 void set_position_accuracy(bool t
) noexcept
{ position_accuracy
= t
; }
73 void set_course(uint32_t t
) noexcept
{ course
= t
; }
74 void set_utc_second(uint32_t t
) noexcept
{ utc_second
= t
; }
75 void set_dte(bool t
) noexcept
{ dte
= t
; }
76 void set_assigned(bool t
) noexcept
{ assigned
= t
; }
77 void set_raim(bool t
) noexcept
{ raim
= t
; }
78 void set_radio_status(uint32_t t
) noexcept
{ radio_status
= t
; }
80 utils::optional
<geo::longitude
> get_longitude() const;
81 utils::optional
<geo::latitude
> get_latitude() const;
82 void set_longitude(const utils::optional
<geo::longitude
> & t
);
83 void set_latitude(const utils::optional
<geo::latitude
> & t
);