The message format is
!AIVDM,2,1,,B,177KQJ5000G?tO`K>RA1wUbN0TKH,0*5C
The second field (in this case, 2
), designates the number of parts in the AIS message and the third field (in this case, 1
) indicates the part or fragment sequence.
If the messages do NOT arrive in sequence, is there a fail safe method of linking the message fragments? [I understand that several fragments can arrive in random order.]
The AIS payloads are encapsulated within the NMEA message format -- NMEA sees them only as a black box -- so you should not expect a NMEA parser to be sensitive to the encoded AIS content.
If you were desperate, you could try to match the multipart messages by the expected lengths of each AIS payload message type, but you'd run into the following problems:
The best you can do in practice is assume that multipart messages may only arrive interleaved if the two messages have different NMEA message types (e.g. one message is
AIVDM
, and the other isSAVDM
). This is the approach taken in the NMEA parsing library I wrote, undereach_complete_message
.You could go further and use the total number of message parts as a way to differentiate messages, but in practice 3-part messages seem to be exceedingly rare.
TL;DR
No, there is no fail safe method of linking fragments.