Trees | Indices | Help |
---|
|
Author: Kurt Schwehr
Version: 6288
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-06-04
|
|||
str |
|
||
bool |
|
||
|
|||
str |
|
||
dict |
|
||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
str |
|
||
dict |
|
||
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 =
Lookup table of codes to use in the Information Source of an ACA message. |
|||
powerLUT =
|
|||
powerEncode =
|
|||
ownershipLUT =
|
|||
posSrcLUT =
Position source used in a BCF message |
|
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' >>> cabEncode(prefix='xx') '$xxCAB,0,0,,*40' 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' >>> cabEncode(True,True,prefix='L3') '$L3CAB,1,1,,*3F'
|
>>> 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 |
>>> verQuery(appendEOL=False) '$xxBSQ,VER*2D' >>> verQuery('AI',appendEOL=False) '$AIBSQ,VER*25' |
>>> encodeQuery('VER',appendEOL=False) '$xxBSQ,VER*2D' >>> encodeQuery('VER', prefix='L3', appendEOL=False) '$L3BSQ,VER*52' >>> encodeQuery('VER','AI',appendEOL=False) '$AIBSQ,VER*25' >>> encodeQuery('ACA',appendEOL=False) '$xxBSQ,ACA*2F' >>> encodeQuery('CBM',appendEOL=False) '$xxBSQ,CBM*20' >>> encodeQuery('DLM',appendEOL=False) '$xxBSQ,DLM*29' >>> encodeQuery('DLM', prefix='L3', appendEOL=False) '$L3BSQ,DLM*56' >>> encodeQuery('BCF', prefix='L3', appendEOL=False) '$L3BSQ,BCF*54' >>> encodeQuery('CAB', prefix='L3', appendEOL=False) '$L3BSQ,CAB*53' |
>>> acaEncode(appendEOL=False) '$xxACA,,,,,,,2087,0,2088,0,,,,*4C'Set to high power >>> acaEncode(power=powerEncode['high'],appendEOL=False) '$xxACA,,,,,,,2087,0,2088,0,,0,,*7C'Set to low power >>> acaEncode(power=powerEncode['low'],appendEOL=False) '$xxACA,,,,,,,2087,0,2088,0,,1,,*7D'
See Also: 61993-2 Page 87. |
Decode AIS Regional Channel Assignment Message. 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'} See Also: 61993-2 Page 87. 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'Here are the test messages from 62320-1 80/427/CDV Page 58, 10.2.2.1.2: >>> bbmEncode(1,1,0,1,8,'7E3B3C3E7E',0,appendEOL=False) '!xxBBM,1,1,0,1,8,7E3B3C3E7E,0*1F'Make it go on both >>> bbmEncode(1,1,0,3,8,'7E3B3C3E7E',0,appendEOL=False) '!xxBBM,1,1,0,3,8,7E3B3C3E7E,0*1D'
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 |
>>> bcfDecode('$AIBCF,12345,7,4731.0,N,05249.0,W,1,2087,2088,2087,2088,1,1,3,0,AI*51') {'posAccuracy': '1', 'nmeaPrefix': 'AI', 'TxChanB': '2088', 'mmsi': '12345', 'RepeatIndicator': '0', 'lon': -5249.0, 'PowerB': '1', 'posSrc': '7', 'nmeaCmd': 'BCF', 'PowerA': '1', 'BaseStationTalkerID': 'AI', 'RxChanB': '2088', 'lat': 4731.0, 'RxChanA': '2087', 'TxChanA': '2087', 'VDLretries': '3'}
See Also: 62320-1/CDV 80/427/CDV, Page 76, A.1.6 |
>>> bcfEncode(appendEOL=False) '!AIBCF,,,,,,,,,,,,,,,,AI*47' >>> bcfEncode(12345,7,4731.0,'N',5249.0,'W',1,2087,2088,2087,2088,1,1,3,0,'AI',appendEOL=False) '!AIBCF,12345,7,4731.0,N,5249.0,W,1,2087,2088,2087,2087,1,1,3,0,AI*6E' This is what the L-3 base station returns this. I am not sure what the format of the position is. '$AIBCF,12345,7,4731.0,N,05249.0,W,1,2087,2088,2087,2088,1,1,3,0,AI*51' Set to low power:>>> bcfEncode(PowerA=powerEncode['low'],PowerB=powerEncode['low'],appendEOL=False) '!AIBCF,,,,,,,,,,,,1,1,,,AI*47'My MMSI that is registered for testing at UNH >>> bcfEncode(mmsi=338040883, appendEOL=False,prefix='L3') '!L3BCF,338040883,,,,,,,,,,,,,,,L3*78'
See Also: 62320-1/CDV 80/427/CDV, Page 76, A.1.6 |
|
txrxLUTTransmit and Received modes. See Page 88 61993-2 and XXXX???
|
acaInfoSrcLUTLookup table of codes to use in the Information Source of an ACA message. See acaEncode() and acaDecode()
|
ownershipLUT
|
posSrcLUTPosition source used in a BCF messageNote: EPFD = el;ectronic position fixing device See Also: 62320-1 80/427/CDV Page 76 A.1.6
|
Trees | Indices | Help |
---|
Generated by Epydoc 3.0beta1 on Fri Jan 11 11:03:04 2008 | http://epydoc.sourceforge.net |