[erlang-questions] decoding nmea messages
Richard O'Keefe
ok@REDACTED
Thu Aug 12 05:47:15 CEST 2010
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?
$GPAAM,A,A,0.10,N,WPTNME*32
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