1 #ifndef __AIS__MESSAGE_04__HPP__
2 #define __AIS__MESSAGE_04__HPP__
4 #include <marnav/ais/message.hpp>
5 #include <marnav/geo/angle.hpp>
6 #include <marnav/utils/mmsi.hpp>
13 /// @brief Base Station Report
14 class message_04
: public message
17 constexpr static const message_id ID
= message_id::base_station_report
;
18 constexpr static const int SIZE_BITS
= 168;
20 constexpr static const uint32_t eta_month_not_available
= 0;
21 constexpr static const uint32_t eta_day_not_available
= 0;
22 constexpr static const uint32_t eta_hour_not_available
= 24;
23 constexpr static const uint32_t eta_minute_not_available
= 60;
26 message_04(const message_04
&) = default;
27 message_04
& operator=(const message_04
&) = default;
29 virtual raw
get_data() const override
;
31 static std::unique_ptr
<message
> parse(const raw
& bits
);
34 message_04(message_id id
);
35 void read_data(const raw
& bits
);
38 unsigned int repeat_indicator
= 0;
40 uint32_t year
= year_not_available
; // UTC, 1..9999
41 uint32_t month
= month_not_available
; // UTC, 1..12
42 uint32_t day
= day_not_available
; // UTC, 1..31
43 uint32_t hour
= hour_not_available
; // UTC, 0..23
44 uint32_t minute
= minute_not_available
;
45 uint32_t second
= second_not_available
;
46 bool position_accuracy
= false;
47 uint32_t longitude_minutes
= longitude_not_available
; // in 10000 minutes
48 uint32_t latitude_minutes
= latitude_not_available
; // in 10000 minutes
49 epfd_fix_type epfd_fix
= epfd_fix_type::undefined
;
51 uint32_t radio_status
= 0;
54 unsigned int get_repeat_indicator() const noexcept
{ return repeat_indicator
; }
55 utils::mmsi
get_mmsi() const noexcept
{ return utils::mmsi
{mmsi
}; }
56 uint32_t get_year() const noexcept
{ return year
; }
57 uint32_t get_month() const noexcept
{ return month
; }
58 uint32_t get_day() const noexcept
{ return day
; }
59 uint32_t get_hour() const noexcept
{ return hour
; }
60 uint32_t get_minute() const noexcept
{ return minute
; }
61 uint32_t get_second() const noexcept
{ return second
; }
62 bool get_position_accuracy() const noexcept
{ return position_accuracy
; }
63 epfd_fix_type
get_epfd_fix() const noexcept
{ return epfd_fix
; }
64 bool get_raim() const noexcept
{ return raim
; }
65 uint32_t get_radio_status() const noexcept
{ return radio_status
; }
67 void set_repeat_indicator(unsigned int t
) noexcept
{ repeat_indicator
= t
; }
68 void set_mmsi(const utils::mmsi
& t
) noexcept
{ mmsi
= t
; }
69 void set_year(uint32_t t
) noexcept
{ year
= t
; }
70 void set_month(uint32_t t
) noexcept
{ month
= t
; }
71 void set_day(uint32_t t
) noexcept
{ day
= t
; }
72 void set_hour(uint32_t t
) noexcept
{ hour
= t
; }
73 void set_minute(uint32_t t
) noexcept
{ minute
= t
; }
74 void set_second(uint32_t t
) noexcept
{ second
= t
; }
75 void set_position_accuracy(bool t
) noexcept
{ position_accuracy
= t
; }
76 void set_epfd_fix(epfd_fix_type t
) noexcept
{ epfd_fix
= t
; }
77 void set_raim(bool t
) noexcept
{ raim
= t
; }
78 void set_radio_status(uint32_t t
) noexcept
{ radio_status
= t
; }
80 geo::longitude
get_longitude() const;
81 geo::latitude
get_latitude() const;
82 void set_longitude(const geo::longitude
& t
);
83 void set_latitude(const geo::latitude
& t
);