summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Kuethe <chris.kuethe@gmail.com>2007-03-11 19:51:22 +0000
committerChris Kuethe <chris.kuethe@gmail.com>2007-03-11 19:51:22 +0000
commit918cb57109d78201e9f8a2db6c31aa26aa619ea8 (patch)
treeabe2d3915942ca7d6f612b3d30201ee85cfa1fd4
parentbbce51c656ee078feb5a2a620633857c00a427ce (diff)
downloadgpsd-918cb57109d78201e9f8a2db6c31aa26aa619ea8.tar.gz
Allow NMEA-style messages prefixed with '!' to be passed in super-raw mode.
This is useful for devices like the Milltech Marine SR162G integrated GPS/ Automatic Identification System. With help from Maitland Bottoms, who reported this device originally.
-rw-r--r--packet.c26
-rw-r--r--packet_states.h3
2 files changed, 29 insertions, 0 deletions
diff --git a/packet.c b/packet.c
index 961c627c..b8e7a3be 100644
--- a/packet.c
+++ b/packet.c
@@ -89,6 +89,10 @@ static void nextstate(struct gps_packet_t *lexer,
lexer->state = NMEA_DOLLAR;
break;
}
+ if (c == '!') {
+ lexer->state = NMEA_BANG;
+ break;
+ }
#endif /* NMEA_ENABLE */
#ifdef TNT_ENABLE
if (c == '@') {
@@ -198,6 +202,24 @@ static void nextstate(struct gps_packet_t *lexer,
else
lexer->state = GROUND_STATE;
break;
+ case NMEA_BANG:
+ if (c == 'A')
+ lexer->state = AIS_LEAD_1;
+ else
+ lexer->state = GROUND_STATE;
+ break;
+ case AIS_LEAD_1:
+ if (c == 'I')
+ lexer->state = AIS_LEAD_2;
+ else
+ lexer->state = GROUND_STATE;
+ break;
+ case AIS_LEAD_2:
+ if (isalpha(c))
+ lexer->state = NMEA_LEADER_END;
+ else
+ lexer->state = GROUND_STATE;
+ break;
#ifdef TNT_ENABLE
case TNT_LEADER:
lexer->state = NMEA_LEADER_END;
@@ -224,6 +246,8 @@ static void nextstate(struct gps_packet_t *lexer,
case NMEA_RECOGNIZED:
if (c == '$')
lexer->state = NMEA_DOLLAR;
+ else if (c == '!')
+ lexer->state = NMEA_BANG;
else
lexer->state = GROUND_STATE;
break;
@@ -360,6 +384,8 @@ static void nextstate(struct gps_packet_t *lexer,
case SIRF_ACK_LEAD_1:
if (c == 'c')
lexer->state = SIRF_ACK_LEAD_2;
+ else if (c == 'I')
+ lexer->state = AIS_LEAD_2;
else
lexer->state = GROUND_STATE;
break;
diff --git a/packet_states.h b/packet_states.h
index 696360af..42d03627 100644
--- a/packet_states.h
+++ b/packet_states.h
@@ -6,6 +6,7 @@
#ifdef NMEA_ENABLE
NMEA_DOLLAR, /* we've seen first character of NMEA leader */
+ NMEA_BANG, /* we've seen first character of an AIS message '!' */
NMEA_PUB_LEAD, /* seen second character of NMEA G leader */
NMEA_VENDOR_LEAD, /* seen second character of NMEA P leader */
NMEA_LEADER_END, /* seen end char of NMEA leader, in body */
@@ -14,6 +15,8 @@
SIRF_ACK_LEAD_1, /* seen A of possible SiRF Ack */
SIRF_ACK_LEAD_2, /* seen c of possible SiRF Ack */
+ AIS_LEAD_1, /* seen A of possible marine AIS message */
+ AIS_LEAD_2, /* seen I of possible marine AIS message */
SEATALK_LEAD_1, /* SeaTalk/Garmin packet leader 'I' */
#endif /* NMEA_ENABLE */