adrianmo / go-nmea

A NMEA parser library in pure Go
MIT License
226 stars 77 forks source link

Implement support for VDM/VDO encapsulated binary messages #50

Closed BertoldVdb closed 5 years ago

BertoldVdb commented 5 years ago

Hello,

This pull request implements support for VDM/VDO encapsulated message parsing. It requires a change to sentence.go as these messages use '!' instead of '$' as start byte.

VDM and VDO are the same message, depending on the circumstances or configuration the sender will produce one or the other, but they are handled identically. Currently I made one decoder that handles both messages, is this the way to go?

Sincerely, Bertold

coveralls commented 5 years ago

Coverage Status

Coverage remained the same at 100.0% when pulling 4d24af41f2e50f0a404b73f0c6828b81e6cbb5b8 on BertoldVdb:vdmvdo into 3fef253aba55c6897855c359c6b86751ee3f09de on adrianmo:master.

coveralls commented 5 years ago

Coverage Status

Coverage remained the same at 100.0% when pulling bc7ad5c0db2aeed8e4e4f02771731a7ccd1ea483 on BertoldVdb:vdmvdo into 3fef253aba55c6897855c359c6b86751ee3f09de on adrianmo:master.

icholy commented 5 years ago

Are these types of messages usually interleaved with $ prefixed messages?

edit: if not, I think this would work better as a standalone sub-package.

BertoldVdb commented 5 years ago

Usually, yes. There are devices that output for example GPS data and received AIS messages. Then they come interleaved. Class A AIS units will also include some $AI messages for configuration and status reporting.

$ and ! are the only start characters allowed by the current standard, but in principle a later version could add more. (albeit unlikely, as older multiplexers would not pass the messages through)

A standalone decoder may also work. The application code can call both parse functions after another if it expects interleaved traffic.

EDIT: This is the manual of a device that outputs interleaved $ and ! sentences: https://www.navico-commercial.com/Root/SimradProSeries_docs/MX535A_TechMan_EN_3508-102-70860_B_w.pdf See Figure 2.6 on page 31 for an example. This is another one: https://www.sv-zanshin.com/r/manuals/raymarineais500installationinstructions.pdf (see table on page 44)

icholy commented 5 years ago

Thanks for the additional info, I'll take a closer look on Tuesday.

BertoldVdb commented 5 years ago

Sorry, I was a bit busy with another project. I will make the changes tomorrow.

icholy commented 5 years ago

@BertoldVdb no rush.

BertoldVdb commented 5 years ago

Changes committed.

icholy commented 5 years ago

@adrianmo look over this when you get a chance.

BertoldVdb commented 5 years ago

Ah. I didn't see that the supported messages were listed in the README. I will change it.

BertoldVdb commented 5 years ago

Is there a specific way the messages in the readme should be ordered? I just added it to the end now.

adrianmo commented 5 years ago

Is there a specific way the messages in the readme should be ordered? I just added it to the end now.

No, we have been adding them in order of implementation. Maybe we could order them alphabetically, but we will do it on a different PR.

adrianmo commented 5 years ago

@icholy you have the last word :)

icholy commented 5 years ago

@BertoldVdb thanks for the contribution :)

BertoldVdb commented 5 years ago

Thank you very much. I can now replace my own NMEA parser with this one :)