[erlang-questions] decoding nmea messages

info <>
Thu Aug 12 16:19:06 CEST 2010

Hi Richard,
The fields don't contain commas but sometimes they are empty. Therefore the size of the messages is not a constant.
And what about the syntax analysis if each field is considered as a binary ?
Someone suggest to use regexp ... 
On Aug 12, 2010, at 5:44 AM, info wrote:

> Hi All,
> According to your experience, what is the best method for decoding an NMEA 0183 message ? I mean:
> - extract each field,
> - detect those which are missing,
> - check syntax

You mean things like the example in the Wikipedia?


Binary matching will let you
 - check for $
 - extract GP (talker)
 - extract AAM (type)
 - extract the rest (because you know how long the binary is)
 - check for *
 - extract the two hex digits
 - check for "\r\n"
As for "the rest", I haven't read the standard, so I don't know
whether the fields can contain commas or not.  If not, you can
break "the rest" up using binary:split/[2,3].  Where you go from
there depends on what the kind of message at hand expects to find.

More information about the erlang-questions mailing list