/Users/brianlane/projs/aisparser/c/src/sixbit.h File Reference


Detailed Description

Header file for sixbit.c.

Author:
Brian C. Lane <bcl@brianlane.com>


Data Structures

struct  sixbit
 sixbit state More...

Defines

#define SIXBIT_LEN   255

Functions

char __stdcall binfrom6bit (char ascii)
 Convert an ascii value to a 6-bit binary value.
int __stdcall init_6bit (sixbit *state)
 Initialize a 6-bit datastream structure.
unsigned long __stdcall get_6bit (sixbit *state, short numbits)
 Return 0-32 bits from a 6-bit ASCII stream.
unsigned int __stdcall sixbit_length (sixbit *state)
 Calculate the number of bits remaining in the six_state.
char __stdcall binto6bit (char value)
 Convert a binary value to a 6-bit ASCII value.


Define Documentation

#define SIXBIT_LEN   255


Function Documentation

char __stdcall binfrom6bit ( char  ascii  ) 

Convert an ascii value to a 6-bit binary value.

This function checks the ASCII value to make sure it can be coverted. If not, it returns a -1. Otherwise it returns the 6-bit binary value.

Parameters:
ascii character to convert
returns:

This is used to convert the packed 6-bit value to a binary value. It is not used to convert data from fields such as the name and destination -- Use ais2ascii() instead.

char __stdcall binto6bit ( char  value  ) 

Convert a binary value to a 6-bit ASCII value.

This function checks the binary value to make sure it can be coverted. If not, it returns a -1. Otherwise it returns the 6-bit ASCII value.

Parameters:
value to convert
returns:

This is used to convert a 6 bit binary value to the packed 6-bit value It is not used to convert data from fields such as the name and destination -- Use ais2ascii() instead.

unsigned long __stdcall get_6bit ( sixbit state,
short  numbits 
)

Return 0-32 bits from a 6-bit ASCII stream.

Parameters:
state pointer to a sixbit state structure
numbits number of bits to return
This function returns the requested number of bits to the calling function. It pulls the bits from the raw 6-bit ASCII as they are needed.

The full string can be addressed by pointing to state->bits and the length can be calculated by strlen(state->bits) * 6, but note that the string also includes any final padding, so when checking lengths take into account that it will be a multiples of 6 bits.

Example:

    sixbit  state;
    unsigned char i;

    init_6bit( &state );
    strcpy( state.bits, "5678901234" );
    i = get_6bit( &state, 6 );

    i == 5

int __stdcall init_6bit ( sixbit state  ) 

Initialize a 6-bit datastream structure.

Parameters:
state state of 6-bit parser
This function initializes the state of the sixbit parser variables and 0 terminates the 6-bit string.

Example:

    sixbit state;
    
    init_6bit( &state );

unsigned int __stdcall sixbit_length ( sixbit state  ) 

Calculate the number of bits remaining in the six_state.

Parameters:
state returns:
  • Number of bits remaining


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