| 1 | // Msg 23 - G - Channel Management |
| 2 | |
| 3 | #include "ais.h" |
| 4 | |
| 5 | namespace libais { |
| 6 | |
| 7 | Ais23::Ais23(const char *nmea_payload, const size_t pad) |
| 8 | : AisMsg(nmea_payload, pad), spare(0), station_type(0), type_and_cargo(0), |
| 9 | spare2(3), txrx_mode(0), interval_raw(0), quiet(0), spare3(0) { |
| 10 | if (!CheckStatus()) { |
| 11 | return; |
| 12 | } |
| 13 | if (pad != 2 || num_chars != 27) { |
| 14 | status = AIS_ERR_BAD_BIT_COUNT; |
| 15 | return; |
| 16 | } |
| 17 | |
| 18 | assert(message_id == 23); |
| 19 | |
| 20 | bits.SeekTo(38); |
| 21 | spare = bits.ToUnsignedInt(38, 2); |
| 22 | |
| 23 | position1 = bits.ToAisPoint(40, 35); |
| 24 | position2 = bits.ToAisPoint(75, 35); |
| 25 | |
| 26 | station_type = bits.ToUnsignedInt(110, 4); |
| 27 | type_and_cargo = bits.ToUnsignedInt(114, 8); |
| 28 | spare2 = bits.ToUnsignedInt(122, 22); |
| 29 | |
| 30 | txrx_mode = bits.ToUnsignedInt(144, 2); |
| 31 | interval_raw = bits.ToUnsignedInt(146, 4); |
| 32 | quiet = bits.ToUnsignedInt(150, 4); |
| 33 | spare3 = bits.ToUnsignedInt(154, 6); |
| 34 | |
| 35 | assert(bits.GetRemaining() == 0); |
| 36 | status = AIS_OK; |
| 37 | } |
| 38 | |
| 39 | } // namespace libais |