Debian Codegraph @

src/libais/ais25.cpp

raw symbols SCIP
1 // Msg 25 - I - Single slot binary message
2
3 // See also: http://www.e-navigation.nl/asm
4
5 #include "ais.h"
6
7 namespace libais {
8
9 Ais25::Ais25(const char *nmea_payload, const size_t pad)
10 : AisMsg(nmea_payload, pad), use_app_id(false), dest_mmsi_valid(false),
11 dest_mmsi(false), dac(0), fi(0) {
12 if (!CheckStatus()) {
13 return;
14 }
15 if (num_bits < 40 || num_bits > 168) {
16 status = AIS_ERR_BAD_BIT_COUNT;
17 return;
18 }
19
20 assert(message_id == 25);
21
22 bits.SeekTo(38);
23 const bool addressed = bits[38];
24 use_app_id = bits[39];
25 if (addressed) {
26 dest_mmsi_valid = true;
27 dest_mmsi = bits.ToUnsignedInt(40, 30);
28 if (use_app_id) {
29 dac = bits.ToUnsignedInt(70, 10);
30 fi = bits.ToUnsignedInt(80, 6);
31 }
32 // TODO(schwehr): Handle the payloads.
33 } else {
34 // broadcast
35 if (use_app_id) {
36 dac = bits.ToUnsignedInt(40, 10);
37 fi = bits.ToUnsignedInt(50, 6);
38 }
39 // TODO(schwehr): Handle the payloads.
40 }
41
42 // TODO(schwehr): Add assert(bits.GetRemaining() == 0);
43 status = AIS_OK;
44 }
45
46 } // namespace libais