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

Module aisfield

source code

Create a basic field for an ais message

Here is one of the simplest possible examples of an integer that goes from 0 to 255:

FIX: how do I do epydoc indented text?

./aisfield.py -n MyName -t uint -d "My unsigned integer field"

<field name="MyName" numberofbits="8" type="uint"> <description>My unsigned integer field</description> </field>


Author: Kurt Schwehr

Version: 5231

Copyright: 2006

Since: 2006-Sep-21

Status: under development

Organization: CCOM

License: GPL

Date: 2006-12-20

Functions [hide private]
 
tag(outfile, tagName, value, indent='')
Write out one complete tag
source code
 
getStubFieldDict()
Convenience for thos that just want to tweak one or two things
source code
 
makeField(options, out=sys.stdout)
Write out one field of xml.
source code
 
validate(options, notify=True)
Check all of the options to make sure they work
source code
Variables [hide private]
  typeBitsGuess = {'aisstr6': 6, 'ascii7': 7, 'bool': 1, 'double...
Best initial guess for each type size.
  typeChoices = ['bool', 'uint', 'sint', 'udecimal', 'sdecimal',...
List of all the available types that may be used to fill an AIS message.
  numberTypes = ['uint', 'sint', 'udecimal', 'sdecimal', 'float'...
Subset of typeChoices that only has the numeric types
Function Details [hide private]

tag(outfile, tagName, value, indent='')

source code 
Write out one complete tag
Parameters:
  • outfile - open file to write to
  • tagName - string containing the xml tag
  • value - what to put between the begin and end tag. Converts to a string
  • indent - how much to indent the tag

getStubFieldDict()

source code 
Convenience for thos that just want to tweak one or two things
Returns:
example dictionary that can then be added to.

makeField(options, out=sys.stdout)

source code 

Write out one field of xml. Here is a sample options dict

{'maxRange': None, 'outputFile': None, 'lut': None, 'description': None, 'notes': None, 'required': None, 'minRange': None, 'numberOfBits': 1, 'units': None, 'scale': None, 'arrayLength': None, 'completeXml': False, 'decimalPlaces': None, 'unavailable': None, 'type': 'bool', 'name': None}
Parameters:
  • options - dict of all the required fields

validate(options, notify=True)

source code 
Check all of the options to make sure they work
Parameters:
  • options - dict with all option fields
  • notify - if true, emit error messages to stdout
Returns:
True if options all ok

Variables Details [hide private]

typeBitsGuess

Best initial guess for each type size. The floating point and string values must be these sizes.
Value:
{'aisstr6': 6,
 'ascii7': 7,
 'bool': 1,
 'double': 64,
 'float': 32,
 'sdecimal': 8,
 'sint': 8,
 'udecimal': 8,
...

typeChoices

List of all the available types that may be used to fill an AIS message.
Value:
['bool',
 'uint',
 'sint',
 'udecimal',
 'sdecimal',
 'float',
 'double',
 'aisstr6',
...

numberTypes

Subset of typeChoices that only has the numeric types
Value:
['uint', 'sint', 'udecimal', 'sdecimal', 'float', 'double']