Trees | Indices | Help |
---|
|
Handle encoding and decoding AIS strings.
Author: Kurt Schwehr
Version: 2068
Copyright: 2006
Date: 2006-05-02
|
|||
str |
|
||
BitVector |
|
||
str |
|
||
str |
|
|
|||
list |
characterLUT =
lookup table for decode to fetch characters faster |
||
characterDict =
Fast lookup for the AIS int code for a character |
|||
dict |
characterBits = {} lookup table for going from a single character to a 6 bit BitVector |
|
Decode bits as a string. Does not remove the end space or @@@@. Must be an multiple of 6 bits.
|
Bugs:
|
Remove AIS string padding >>> unpad('@') '' >>> unpad('A@') 'A' >>> unpad('ABCDEF1234@@@@@') 'ABCDEF1234' FIX: is this the correct response? >>> unpad('A@B') 'A@B' This is non standard behavior, but some AIS systems space pad the right >>> unpad(' ') '' >>> unpad('MY SHIP NAME ') 'MY SHIP NAME' The standard implies this behavior with is less fun >>> unpad('MY SHIP NAME ',removeBlanks=False) 'MY SHIP NAME '
Bug: use a faster algorithm for truncating the string |
pad a string out to the proper length with the @ character as required by the ais spec >>> pad('',0) '' >>> pad('',1) '@' >>> pad('A',1) 'A' >>> pad('A',2) 'A@' >>> pad('MY SHIP NAME',20) 'MY SHIP NAME@@@@@@@@'
Bug: Use a list and join to make the string building faster |
|
characterLUTlookup table for decode to fetch characters faster
|
characterDictFast lookup for the AIS int code for a character
|
Trees | Indices | Help |
---|
Generated by Epydoc 3.0.1 on Sat Feb 9 07:33:14 2008 | http://epydoc.sourceforge.net |