Debian Codegraph @

src/libais/ais27.cpp

raw symbols SCIP
1 // 'K' - 27 - Long-range AIS broadcast message
2
3 #include "ais.h"
4
5 namespace libais {
6
7 Ais27::Ais27(const char *nmea_payload, const size_t pad)
8 : AisMsg(nmea_payload, pad), position_accuracy(0), raim(false),
9 nav_status(0), sog(0), cog(0), gnss(false), spare(0) {
10 if (!CheckStatus()) {
11 return;
12 }
13 if (pad != 0 || num_bits != 96) {
14 status = AIS_ERR_BAD_BIT_COUNT;
15 return;
16 }
17
18 assert(message_id == 27);
19
20 bits.SeekTo(38);
21 position_accuracy = bits[38];
22 raim = bits[39];
23 nav_status = bits.ToUnsignedInt(40, 4);
24 position = bits.ToAisPoint(44, 35);
25 sog = bits.ToUnsignedInt(79, 6); // Knots.
26 cog = bits.ToUnsignedInt(85, 9); // Degrees.
27 // 0 is a current GNSS position. 1 is NOT the current GNSS position
28 gnss = !bits[94];
29 spare = bits[95];
30
31 assert(bits.GetRemaining() == 0);
32 status = AIS_OK;
33 }
34
35 } // namespace libais