1 #include "message_05.hpp"
7 MARNAV_AIS_DEFINE_MESSAGE_PARSE_FUNC(message_05
)
9 message_05::message_05()
12 , shipname("@@@@@@@@@@@@@@@@@@@@")
13 , destination("@@@@@@@@@@@@@@@@@@@@")
17 /// @todo also handle message with length of 420 and 422 bits
18 message_05::message_05(const raw
& bits
)
21 , shipname("@@@@@@@@@@@@@@@@@@@@")
22 , destination("@@@@@@@@@@@@@@@@@@@@")
24 if (bits
.size() != SIZE_BITS
)
25 throw std::invalid_argument
{"invalid number of bits in message_05"};
29 void message_05::read_data(const raw
& bits
)
31 get(bits
, repeat_indicator
);
33 get(bits
, ais_version
);
34 get(bits
, imo_number
);
41 get(bits
, to_starboard
);
46 get(bits
, eta_minute
);
48 get(bits
, destination
);
52 raw
message_05::get_data() const
56 bits
.set(type(), 0, 6);
57 set(bits
, repeat_indicator
);
59 set(bits
, ais_version
);
60 set(bits
, imo_number
);
67 set(bits
, to_starboard
);
72 set(bits
, eta_minute
);
74 set(bits
, destination
);
80 std::string
message_05::get_callsign() const
82 return trim_ais_string(callsign
);
85 std::string
message_05::get_shipname() const
87 return trim_ais_string(shipname
);
90 std::string
message_05::get_destination() const
92 return trim_ais_string(destination
);
95 void message_05::set_callsign(const std::string
& t
)
98 callsign
= t
.substr(0, 7);
104 void message_05::set_shipname(const std::string
& t
)
107 shipname
= t
.substr(0, 20);
113 void message_05::set_destination(const std::string
& t
)
116 destination
= t
.substr(0, 20);