I noticed that messages that decode when I call ais.decode don't decode when I use the tag_block interface. I've traced it to the following:
Parse('!ANVDO,1,1,,Y,E>k?g@VWW:3WVRa<gVC2000000M80l=;BCH00000PP20,4*72')
Traceback (most recent call last):
File "/home/avanpelt/git/libais/ais/vdm.py", line 117, in Parse
result = VDM_RE.search(data).groupdict()
AttributeError: 'NoneType' object has no attribute 'groupdict'
Here's a test script:
import ais
from ais import tag_block
MESSAGES = ["\\c:1632515401,s:AS-LRP-OHMNTGMR,n:50780*28\\!ANVDO,1,1,,Y,E>k`?g@VWW:3WVRa<gVC2000000M80l=;`BCH00000PP20,4*72"]
queue = tag_block.TagQueue()
for line_no, line in enumerate(MESSAGES):
queue.put(line, line_no)
while not queue.empty():
tag_msg = queue.get()
if "decoded" not in tag_msg:
print("Message NOT decoded using tag_block queue")
payload = tag_msg["lines"][0]
print("payload = '{}'".format(payload))
body = payload.split(',')[-2]
pad = int(payload.split('*')[-2][-1])
print("Calling ais.decode('{}', {})".format(body, pad))
msg = ais.decode(body, pad)
print(msg)
else:
print("Message decoded using tag_block queue")
I noticed that messages that decode when I call ais.decode don't decode when I use the tag_block interface. I've traced it to the following:
Here's a test script:
Here's the output: