Bitstream -- Binary Data for Humans

Roel Schroeven roel at roelschroeven.net
Tue Mar 6 17:15:04 EST 2018


Sébastien Boisgérault schreef op 6/03/2018 10:23:
> I had a look at the AIS message format from your link(https://en.wikipedia.org/wiki/Automatic_identification_system#Message_format) and this seems to be a nice use case; all the data components seem to be nicely aligned on the byte boundary ... until you see that the payload uses ASCII6(*), which I didn't know about. 
> 
> Thanks again for the info!

ASCII6 is only the first layer where your Bitstream could be useful. 
It's the easy part :).

The main work comes after that: decoding ASCII6 results in binary data 
which we need to decode into AIS messages. You can see the most 
important ones at https://navcen.uscg.gov/?pageName=AISMessagesA and 
https://navcen.uscg.gov/?pageName=AISMessagesAStatic but there are many 
more.

So for each message we first extract the first 6 bits, which tells us 
the message identifier. What we need to do afterwards depends on that 
message identifier. The links above describe how to deal with messages 
1, 2 and 3 (they are identical except for the message identifier; I 
don't know why there are 3 instead of just one) and 5. Basically it's 
things like 2 bits for this, next 30 bits for that, etc. That's where 
I'm hoping your Bitstream can really shine.

Also note, but now I'm getting off topic,  that we don't have to deal 
with the low-level data as is described in your link: that is handled by 
the AIS transponder or AIS receiver, from which we receive it using 
simple NMEA 0183 serial sentences: see 
https://en.wikipedia.org/w/index.php?title=NMEA_0183&oldid=828034316#Message_structure

-- 
The saddest aspect of life right now is that science gathers knowledge
faster than society gathers wisdom.
   -- Isaac Asimov

Roel Schroeven




More information about the Python-list mailing list