Skip to main content

Crate aivdm

Crate aivdm 

Source
Expand description

A no_std, allocation-free parser and encoder for AIS (Automatic Identification System) messages, per ITU-R M.1371, as carried over NMEA 0183 !AIVDM/!AIVDO sentences.

§Layering

  • nmea parses and checksum-validates !AIVDM/!AIVDO sentences and reassembles multi-fragment messages into a single armored payload.
  • bits reads and writes arbitrary-width fields directly against the six-bit ASCII-armored payload bytes; there is no separate “unpacked bitstream” buffer, since AIS fields do not align to byte boundaries.
  • message decodes/encodes the bit-packed payload into a typed AisMessage, one variant per ITU-R M.1371 message type.

§No allocation

Nothing in this crate uses alloc. Multi-fragment reassembly (nmea::FragmentAssembler) uses a fixed-capacity, caller-sized buffer instead of a growable one, so it works with no allocator at all.

Re-exports§

pub use error::AisError;
pub use message::AisMessage;
pub use nmea::Channel;
pub use nmea::CompleteMessage;
pub use nmea::FragmentAssembler;
pub use nmea::Sentence;
pub use message::common::*;

Modules§

bits
Bit-level codec for AIS payload data.
error
Error types for every layer of the decode/encode pipeline.
message
ITU-R M.1371 message layer: typed messages decoded from (and encoded to) a bit-packed AIS payload.
nmea
NMEA 0183 sentence layer: checksum, !AIVDM/!AIVDO parsing, and multi-fragment reassembly.
string
Six-bit ASCII conversions and a fixed-capacity string type for decoded text fields (vessel name, callsign, destination).

Structs§

LineDecoder
A stateful decoder that handles both single- and multi-fragment !AIVDM/!AIVDO sentences, so callers reading a live/mixed feed don’t need to hand-roll the parse/assemble/decode state machine themselves.

Functions§

decode_line
Decodes a single, complete NMEA line into a typed AIS message.
decode_payload
Decodes a typed AIS message from an already-assembled six-bit ASCII-armored payload.
encode_line
Encodes a typed AIS message into a single, complete !AIVDM/!AIVDO NMEA line on the given channel, writing into buf and returning the written slice. Set is_own_ship to emit !AIVDO (a simulated/own-ship report) rather than !AIVDM.
encode_payload
Encodes a typed AIS message into buf as a six-bit ASCII-armored payload.