Package ais :: Module allaistypes
[hide private]
[frames] | no frames]

Module allaistypes

source code

Autogenerated python functions to serialize/deserialize binary messages.

Generated by: ./aisxmlbinmsg2py.py

Need to then wrap these functions with the outer AIS packet and then convert the whole binary blob to a NMEA string. Those functions are not currently provided in this file.

serialize: python to ais binary deserialize: ais binary to python

The generated code uses translators.py, binary.py, and aisstring.py which should be packaged with the resulting files.


Requires:

Author: xmlbinmsg

Version: 4791

Status: under development

License: Generated code has no license

Classes [hide private]
  Testalltypesmsg
Use testvalue tag text from each type to build test case the alltypesmsg message

Functions [hide private]
BitVector encode(params, validate=False)
Create a alltypesmsg binary message payload to pack into an AIS Msg alltypesmsg.
dict decode(bv, validate=False)
Unpack a alltypesmsg message
  decodedac(bv, validate=False)
  decodereqDecimal(bv, validate=False)
  decodeunavail_uint(bv, validate=False)
  decodeanUInt(bv, validate=False)
  decodeanInt(bv, validate=False)
  decodeaBool(bv, validate=False)
  decodeaStr(bv, validate=False)
  decodeanUDecimal(bv, validate=False)
  decodeaDecimal(bv, validate=False)
  decodeaFloat(bv, validate=False)
stdout printFields(params, out=sys.stdout, format='std')
Print a alltypesmsg message to stdout.
dict testParams()
Return a params file base on the testvalue tags.
  addMsgOptions(parser)

Variables [hide private]
  __date__ = '2007-01-04'
Date of last svn commit
  TrueBV = <ais.BitVector.BitVector object at 0x218ba30>
Why always rebuild the True bit? This should speed things up a bunch
  FalseBV = <ais.BitVector.BitVector object at 0x218b810>
Why always rebuild the False bit? This should speed things up a bunch
  typeChoices = 'binary', 'nmeapayload', 'nmea'
  outputChoices = 'std', 'html', 'xml'
  outfile = file(options.outputFileName, 'w')
  msgDict = {'dac': '366', 'reqDecimal': '122', 'unavail_uint': ...
  bitLen = len(bits)
  bits = bits+ BitVector(size= (6-(bitLen % 6)))

Function Details [hide private]

encode(params, validate=False)

source code 

Create a alltypesmsg binary message payload to pack into an AIS Msg alltypesmsg.

Fields in params:
  • dac(uint): Designated Area Code (field automatically set to "366")
  • reqDecimal(decimal): required decimal value... FIX: scale or no? (field automatically set to "122")
  • unavail_uint(uint): Unavailable unsigned integer
  • anUInt(uint): NO unavailable unsigned integer
  • anInt(int): NO unavailable signed integer
  • aBool(bool): Simple bool
  • aStr(aisstr6): An ais string of 5 characters
  • anUDecimal(udecimal): An unsigned decimal. Allow smaller numbers
  • aDecimal(decimal): A decimal
  • aFloat(float): An IEEE floating point number
Parameters:
  • params - Dictionary of field names/values. Throws a ValueError exception if required is missing
  • validate - Set to true to cause checking to occur. Runs slower. FIX: not implemented.
Returns: BitVector
encoded binary message (for binary messages, this needs to be wrapped in a msg 8

Note: The returned bits may not be 6 bit aligned. It is up to you to pad out the bits.

decode(bv, validate=False)

source code 

Unpack a alltypesmsg message

Fields in params:
  • dac(uint): Designated Area Code (field automatically set to "366")
  • reqDecimal(decimal): required decimal value... FIX: scale or no? (field automatically set to "122")
  • unavail_uint(uint): Unavailable unsigned integer
  • anUInt(uint): NO unavailable unsigned integer
  • anInt(int): NO unavailable signed integer
  • aBool(bool): Simple bool
  • aStr(aisstr6): An ais string of 5 characters
  • anUDecimal(udecimal): An unsigned decimal. Allow smaller numbers
  • aDecimal(decimal): A decimal
  • aFloat(float): An IEEE floating point number
Parameters:
  • bv (BitVector) - Bits defining a message
  • validate - Set to true to cause checking to occur. Runs slower. FIX: not implemented.
Returns: dict
params

decodedac(bv, validate=False)

source code 
None

decodereqDecimal(bv, validate=False)

source code 
None

decodeunavail_uint(bv, validate=False)

source code 
None

decodeanUInt(bv, validate=False)

source code 
None

decodeanInt(bv, validate=False)

source code 
None

decodeaBool(bv, validate=False)

source code 
None

decodeaStr(bv, validate=False)

source code 
None

decodeanUDecimal(bv, validate=False)

source code 
None

decodeaDecimal(bv, validate=False)

source code 
None

decodeaFloat(bv, validate=False)

source code 
None

printFields(params, out=sys.stdout, format='std')

source code 

Print a alltypesmsg message to stdout.

Fields in params:
  • dac(uint): Designated Area Code (field automatically set to "366")
  • reqDecimal(decimal): required decimal value... FIX: scale or no? (field automatically set to "122")
  • unavail_uint(uint): Unavailable unsigned integer
  • anUInt(uint): NO unavailable unsigned integer
  • anInt(int): NO unavailable signed integer
  • aBool(bool): Simple bool
  • aStr(aisstr6): An ais string of 5 characters
  • anUDecimal(udecimal): An unsigned decimal. Allow smaller numbers
  • aDecimal(decimal): A decimal
  • aFloat(float): An IEEE floating point number
Parameters:
  • params - Dictionary of field names/values.
  • out - File like object to write to
Returns: stdout
text to out

testParams()

source code 
Return a params file base on the testvalue tags.
Returns: dict
params based on testvalue tags

addMsgOptions(parser)

source code 
None

Variables Details [hide private]

__date__

Date of last svn commit
Value:
'2007-01-04'                                                           
      

TrueBV

Why always rebuild the True bit? This should speed things up a bunch
Value:
<ais.BitVector.BitVector object at 0x218ba30>                          
      

FalseBV

Why always rebuild the False bit? This should speed things up a bunch
Value:
<ais.BitVector.BitVector object at 0x218b810>                          
      

typeChoices

None
Value:
'binary', 'nmeapayload', 'nmea'                                        
      

outputChoices

None
Value:
'std', 'html', 'xml'                                                   
      

outfile

None
Value:
file(options.outputFileName, 'w')                                      
      

msgDict

None
Value:
{'dac': '366', 'reqDecimal': '122', 'unavail_uint': options.unavail_ui
ntField, 'anUInt': options.anUIntField, 'anInt': options.anIntField, '
aBool': options.aBoolField, 'aStr': options.aStrField, 'anUDecimal': o
ptions.anUDecimalField, 'aDecimal': options.aDecimalField, 'aFloat': o
ptions.aFloatField,}                                                   
      

bitLen

None
Value:
len(bits)                                                              
      

bits

None
Value:
bits+ BitVector(size= (6-(bitLen % 6)))