The format of the !AIVDM strings are covered in IEC 61993-2
AIS Messages 6 and 8 are used to pass the data.
Includes information like Meteorological and Hydrological data, Dangerous Cargo Indication, etc.
Example Code:
ais_state state; aismsg_8 message; sixbit imo; int dac, fi; imo1_11 msg1_11; unsigned int result; char buf_1[] = "!AIVDM,2,1,2,B,8030ojA?0@=DE3@?BDPA3onQiUFttP1Wh01DE3<1EJ?>0onlkUG0e01I,0*3D"; char buf_2[] = "!AIVDM,2,2,2,B,h00,2*7D"; memset( &state, 0, sizeof(state) ); assemble_vdm( &state, buf_1 ); assemble_vdm( &state, buf_2 ); state.msgid = (char) get_6bit( &state.six_state, 6 ); if (state.msgid == 8 ) { result = parse_ais_8( &state, &message ); // Get the seaway info from the payload of the message 8 memset( &imo, 0, sizeof( imo ) ); // Copy the DAC and FI from the message 8 over to seaway dac = message.app_id >> 6; fi = message.app_id & 0x3F; imo = message.data; // Is it a ... if ((dac == 1) && (fi == 11)) { result = parse_imo1_11( &imo, &msg1_11); // msg1_11 now holds the water level information } }
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "portable.h"
#include "nmea.h"
#include "sixbit.h"
#include "vdm_parse.h"
#include "imo.h"
Functions | |
| int __stdcall | parse_imo1_11 (sixbit *state, imo1_11 *result) |
| Meteorological and Hydrological data. | |
| int __stdcall | parse_imo1_12 (sixbit *state, imo1_12 *result) |
| Dangerous Cargo Indication. | |
| int __stdcall | parse_imo1_13 (sixbit *state, imo1_13 *result) |
| Fairway Closed. | |
| int __stdcall | parse_imo1_14 (sixbit *state, imo1_14 *result) |
| Tidal Window. | |
| int __stdcall | parse_imo1_15 (sixbit *state, imo1_15 *result) |
| Extended Ship Static and Voyage Related Data. | |
| int __stdcall | parse_imo1_16 (sixbit *state, imo1_16 *result) |
| Number of Persons on Board. | |
| int __stdcall | parse_imo1_17 (sixbit *state, imo1_17 *result) |
| Number of Persons on Board. | |
Meteorological and Hydrological data.
| state | pointer to parser state | |
| result | pointer to result structure |
This function parses a Meteorological and Hydrological message into a imo1_11 structure
Dangerous Cargo Indication.
| state | pointer to parser state | |
| result | pointer to result structure |
This function parses a Meteorological and Hydrological message into a imo1_12 structure
Fairway Closed.
| state | pointer to parser state | |
| result | pointer to result structure |
This function parses a Meteorological and Hydrological message into a imo1_13 structure
Tidal Window.
| state | pointer to parser state | |
| result | pointer to result structure |
This function parses a Meteorological and Hydrological message into a imo1_14 structure
Extended Ship Static and Voyage Related Data.
| state | pointer to parser state | |
| result | pointer to result structure |
This function parses a Meteorological and Hydrological message into a imo1_15 structure
Number of Persons on Board.
| state | pointer to parser state | |
| result | pointer to result structure |
This function parses a Meteorological and Hydrological message into a imo1_16 structure
Number of Persons on Board.
| state | pointer to parser state | |
| result | pointer to result structure |
This function parses a Meteorological and Hydrological message into a imo1_16 structure
1.5.2