summaryrefslogtreecommitdiff
path: root/packet.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2009-03-09 18:37:19 +0000
committerEric S. Raymond <esr@thyrsus.com>2009-03-09 18:37:19 +0000
commit4996fc1cfdf2510d6d9063a30516bcf5ef4f9a8b (patch)
tree8152e2d59e9eb526f4575da2599f582f24530847 /packet.c
parentf309aecdd914e578a0e64ffc700c9cd20cb726f0 (diff)
downloadgpsd-4996fc1cfdf2510d6d9063a30516bcf5ef4f9a8b.tar.gz
The shell of an AIVDM driver.
This gets packets and delivers them to a stub analyzer, fields parsed out and checksum verified.
Diffstat (limited to 'packet.c')
-rw-r--r--packet.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/packet.c b/packet.c
index 077007e6..e5645cb0 100644
--- a/packet.c
+++ b/packet.c
@@ -961,9 +961,14 @@ void packet_parse(struct gps_packet_t *lexer)
checksum_ok = (csum[0]==toupper(trailer[1])
&& csum[1]==toupper(trailer[2]));
}
- if (checksum_ok)
- packet_accept(lexer, NMEA_PACKET);
- else
+ if (checksum_ok) {
+#ifdef AIVDM_ENABLE
+ if (strncmp((char *)lexer->inbuffer, "!AIVDM", 6) == 0)
+ packet_accept(lexer, AIVDM_PACKET);
+ else
+#endif /* AIVDM_ENABLE */
+ packet_accept(lexer, NMEA_PACKET);
+ } else
lexer->state = GROUND_STATE;
packet_discard(lexer);
break;