Trees | Indices | Help |
---|
|
Author: Kurt Schwehr
Version: 5698
Copyright: 2006
Since: 2006-Sep-26 FIX: replace with the file creation date
Status: under development
Organization: CCOM - FIX: if not CCOM change the name and link
License: GPL v2
Note: This package does not respence the maximum number of characters per line that is required in the NMEA specification.
Date: 2007-03-03
|
|||
str |
|
||
bool |
|
||
|
|||
str |
|
||
dict |
|
||
|
|||
|
|||
|
|||
|
|||
str |
|
||
dict |
|
|
|||
EOL =
DOS style end-of-line (<cr><lf>) for talking to AIS base stations |
|||
nmeaChecksumRegExStr =
|
|||
nmeaChecksumRE = re.compile(r'\*
|
|||
txrxLUT =
Transmit and Received modes. |
|||
acaInfoSrcLUT =
|
|||
ownershipLUT =
|
|
Take a NMEA 0183 string and compute the checksum. Checksum is calculated by xor'ing everything between ? or ! and the *>>> checksumStr("!AIVDM,1,1,,B,35MsUdPOh8JwI:0HUwquiIFH21>i,0*09") '09' >>> checksumStr("AIVDM,1,1,,B,35MsUdPOh8JwI:0HUwquiIFH21>i,0") '09' >>> checksumStr('$AIACA,0,,,,,,,,,5,2087,0,2088,0,0,0,I,1,000000*15') '15'This is an example I made up >>> checksumStr('$xxCAB,1,1,1,1*5D') '40'
|
>>> isChecksumValid("!AIVDM,1,1,,B,35MsUdPOh8JwI:0HUwquiIFH21>i,0*09") TrueCorrupted: >>> isChecksumValid("!AIVDM,11,1,,B,35MsUdPOh8JwI:0HUwquiIFH21>i,0*09") False >>> isChecksumValid('$AIACA,0,,,,,,,,,5,2087,0,2088,0,0,0,I,1,000000*15') True
|
To Do: sync names of prefix and serviceType to NMEA spec. See Also: reference the appropriate spec documents for all this stuff. |
>>> cabEncode() '$AICAB,0,0,,*48' Note that xx is probably not valid in this next example, but it is used by L3 Made up example:>>> cabEncode(True,True,True,True,prefix='xx') '$xxCAB,1,1,1,1*40'
|
>>> cabDecode('$AICAB,,,,*48') {'Reset': False, 'nmeaPrefix': 'AI', 'nmeaCmd': 'CAB', 'TransB': False, 'TransA': False, 'Restart': False}Note that ZZ is probably not valid in this next example >>> cabDecode('$ZZCAB,1,1,1,1*40') {'Reset': False, 'nmeaPrefix': 'ZZ', 'nmeaCmd': 'CAB', 'TransB': True, 'TransA': True, 'Restart': True}
To Do: How do I make stable doctests with dictionary returns To Do (FIX): throw an exception if not valid |
Decode AIS Regional Channel Assignment Message. See 61993-2 Page 87. This is an example of an unconfigured base station, plus there is a USCG timestamp at the end.>>> acaDecode('$AIACA,0,,,,,,,,,5,2087,0,2088,0,0,0,I,1,000000*15,1172786646.1') {'inuse': '1', 'north': None, 'txrxMode': '0', 'power': '0', 'nmeaPrefix': 'AI', 'timeinuse': '000000', 'seqnum': '0', 'chanBbandwidth': '0', 'nmeaCmd': 'ACA', 'chanAbandwidth': '0', 'west': None, 'transitionSize': '5', 'infosrc': 'I', 'east': None, 'chanA': '2087', 'south': None, 'chanB': '2088'} To Do: get a complete example to decode as a doctest |
>>> cbmDecode('$AICBM,61,76,35,2,60,999,100,999,52,999,1,60,999,100,999*55,1172787005.46') {'msg17chanAnumslots': '1', 'nmeaPrefix': 'AI', 'msg4slot': '61', 'msg17chanAslotinterval': '999', 'nmeaCmd': 'CBM', 'msg20chanAslotinterval': '999', 'msg20chanAstartslot': '60', 'msg17chanAstartslot': '52', 'msg22chanAslotinterval': '999', 'msg22chanAstartslot': '100'} See Also: 62320-1/CDV 80/427/CDV page 78, A.1.8 |
>>> dlmDecode ('$AIDLM,0,A,L,0,2,7,540,L,4,1,7,250,L,2511,1,7,0,,,,,*40,1172787005.5') {'nmeaPrefix': 'AI', 'timeout3': '7', 'timeout2': '7', 'timeout1': '7', 'timeout4': '', 'startslot2': '4', 'startslot3': '2511', 'incr4': '*40', 'incr3': '0', 'incr2': '250', 'incr1': '540', 'aisChannel': 'A', 'seqNum': '0', 'startslot1': '0', 'startslot4': '', 'nmeaCmd': 'DLM', 'ownership4': '', 'ownership3': 'L', 'ownership2': 'L', 'ownership1': 'L', 'numslots4': '', 'numslots1': '2', 'numslots2': '1', 'numslots3': '1'} See Also: 62320-1/CDV 80/427/CDV page 79, A.1.9 |
Encode a binary broadcast message. I have no idea what this message says... !AIVDM,1,1,,A,85NqMF1Kf=Vsdt`l;0bnfFjd<uQeT2p<vmIRTB=mM5mtIT;sUL2t,0*54,rs003669982,1172918061 >>> bbmEncode(1,1,0,3,8,'Fs[Ifs?:=2h:ec]dc3?HKI0f3?eFHa4[MGAMO6I2vqG0g',4) '!xxBBM,1,1,0,3,8,Fs[Ifs?:=2h:ec]dc3?HKI0f3?eFHa4[MGAMO6I2vqG0g,4*32'
To Do: put in some doc tests with know messages and what would be received as the VDM message(s) See Also: IEC-PAS 61162-100 80/330/PAS, Page 19 |
>>> bbmDecode('!xxBBM,1,1,0,3,8,Fs[Ifs?:=2h:ec]dc3?HKI0f3?eFHa4[MGAMO6I2vqG0g,4*32') {'numFillBits': '4', 'nmeaPrefix': 'xx', 'msgId': '8', 'aisChan': '3', 'data': 'Fs[Ifs?:=2h:ec]dc3?HKI0f3?eFHa4[MGAMO6I2vqG0g', 'seqId': '0', 'nmeaCmd': 'BBM', 'sentNum': '1', 'totSent': '1'}
To Do:
See Also: IEC-PAS 61162-100 80/330/PAS, Page 19 |
|
txrxLUTTransmit and Received modes. See Page 88 61993-2 and XXXX???
|
acaInfoSrcLUT
|
ownershipLUT
|
Trees | Indices | Help |
---|
Generated by Epydoc 3.0beta1 on Mon Mar 5 09:28:42 2007 | http://epydoc.sourceforge.net |