/Users/brianlane/projs/aisparser/c/src/imo.c File Reference


Detailed Description

IMO Binary Message Parsing.

Author:
Copyright 2006-2008 by Brian C. Lane <bcl@brianlane.com>, All Rights Reserved
Version:
1.0
For exact definitions of each field you should see the IMO SN/Circ. 236 28 May 2004

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.


Function Documentation

int __stdcall parse_imo1_11 ( sixbit state,
imo1_11 result 
)

Meteorological and Hydrological data.

Parameters:
state pointer to parser state
result pointer to result structure
return

This function parses a Meteorological and Hydrological message into a imo1_11 structure

int __stdcall parse_imo1_12 ( sixbit state,
imo1_12 result 
)

Dangerous Cargo Indication.

Parameters:
state pointer to parser state
result pointer to result structure
return

This function parses a Meteorological and Hydrological message into a imo1_12 structure

int __stdcall parse_imo1_13 ( sixbit state,
imo1_13 result 
)

Fairway Closed.

Parameters:
state pointer to parser state
result pointer to result structure
return

This function parses a Meteorological and Hydrological message into a imo1_13 structure

int __stdcall parse_imo1_14 ( sixbit state,
imo1_14 result 
)

Tidal Window.

Parameters:
state pointer to parser state
result pointer to result structure
return

This function parses a Meteorological and Hydrological message into a imo1_14 structure

int __stdcall parse_imo1_15 ( sixbit state,
imo1_15 result 
)

Extended Ship Static and Voyage Related Data.

Parameters:
state pointer to parser state
result pointer to result structure
return

This function parses a Meteorological and Hydrological message into a imo1_15 structure

int __stdcall parse_imo1_16 ( sixbit state,
imo1_16 result 
)

Number of Persons on Board.

Parameters:
state pointer to parser state
result pointer to result structure
return

This function parses a Meteorological and Hydrological message into a imo1_16 structure

int __stdcall parse_imo1_17 ( sixbit state,
imo1_17 result 
)

Number of Persons on Board.

Parameters:
state pointer to parser state
result pointer to result structure
return

This function parses a Meteorological and Hydrological message into a imo1_16 structure


Generated on Tue Aug 26 13:57:50 2008 for AIS Parser by  doxygen 1.5.2