| 1 | // Msg 19 C - Extended Class B equipment position report |
| 2 | |
| 3 | #include "ais.h" |
| 4 | |
| 5 | namespace libais { |
| 6 | |
| 7 | Ais19::Ais19(const char *nmea_payload, const size_t pad) |
| 8 | : AisMsg(nmea_payload, pad), spare(0), sog(0.0), position_accuracy(0), |
| 9 | cog(0.0), true_heading(0), timestamp(0), spare2(0), type_and_cargo(0), |
| 10 | dim_a(0), dim_b(0), dim_c(0), dim_d(0), fix_type(0), raim(false), dte(0), |
| 11 | assigned_mode(0), spare3(0) { |
| 12 | if (!CheckStatus()) { |
| 13 | return; |
| 14 | } |
| 15 | if (pad != 0 || num_chars != 52) { |
| 16 | status = AIS_ERR_BAD_BIT_COUNT; |
| 17 | return; |
| 18 | } |
| 19 | |
| 20 | assert(message_id == 19); |
| 21 | |
| 22 | bits.SeekTo(38); |
| 23 | spare = bits.ToUnsignedInt(38, 8); |
| 24 | sog = bits.ToUnsignedInt(46, 10) / 10.; |
| 25 | |
| 26 | position_accuracy = bits[56]; |
| 27 | position = bits.ToAisPoint(57, 55); |
| 28 | |
| 29 | cog = bits.ToUnsignedInt(112, 12) / 10.; |
| 30 | true_heading = bits.ToUnsignedInt(124, 9); |
| 31 | timestamp = bits.ToUnsignedInt(133, 6); |
| 32 | spare2 = bits.ToUnsignedInt(139, 4); |
| 33 | |
| 34 | name = bits.ToString(143, 120); |
| 35 | |
| 36 | type_and_cargo = bits.ToUnsignedInt(263, 8); |
| 37 | dim_a = bits.ToUnsignedInt(271, 9); |
| 38 | dim_b = bits.ToUnsignedInt(280, 9); |
| 39 | dim_c = bits.ToUnsignedInt(289, 6); |
| 40 | dim_d = bits.ToUnsignedInt(295, 6); |
| 41 | |
| 42 | fix_type = bits.ToUnsignedInt(301, 4); |
| 43 | raim = bits[305]; |
| 44 | dte = bits[306]; |
| 45 | assigned_mode = bits[307]; |
| 46 | spare3 = bits.ToUnsignedInt(308, 4); |
| 47 | |
| 48 | assert(bits.GetRemaining() == 0); |
| 49 | status = AIS_OK; |
| 50 | } |
| 51 | |
| 52 | } // namespace libais |