Closed j0nson closed 6 years ago
Try changing the last '0' to '2'.
You need the fill bits from the final part of the message... just before the *
python
>>> import ais
>>> m1 = '#!AIVDM,2,1,4,B,56LUAP02>M9oL`<v2210u<DT@tr0hD4@E:22221?2rhI75Gf0EEDp0PC,0*3A'
>>> m2 = '#!AIVDM,2,2,4,B,888888888888880,2*23'
>>> m = m1.split(',')[5] + m2.split(',')[5]
>>> m
'56LUAP02>M9oL`<v2210u<DT@tr0hD4@E:22221?2rhI75Gf0EEDp0PC888888888888880'
>>> ais.decode(m, 2)
{'destination': 'US BAL ', 'ais_version': 0, 'draught': 8.5, 'eta_minute': 0, 'dim_c': 25, 'fix_type': 1, 'mmsi': 432624000, 'name': 'POSEIDON LEADER ', 'id': 5, 'dim_a': 23, 'imo_num': 9335965, 'type_and_cargo': 79, 'eta_hour': 14, 'dte': 0, 'eta_day': 15, 'eta_month': 5, 'dim_d': 7, 'repeat_indicator': 0, 'dim_b': 176, 'callsign': '7JCO ', 'spare': 0}
The fill bits is found by:
m2.split(',')[6][0]
'2'
The readme is not clear about how to parse multi-line messages without the stream module. I'm trying to do:
And i get this error: AIS_ERROR_BAD_BIT_COUNT
Can anyone help?