gpsd-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gpsd-dev] [PATCH 4/5] Add BS talker ID (used by AIS base stations)


From: chris
Subject: [gpsd-dev] [PATCH 4/5] Add BS talker ID (used by AIS base stations)
Date: Tue, 5 Jun 2012 17:26:23 +0100

From: Christian Gagneraud <address@hidden>

check and packet-regress passed

Signed-off-by: Christian Gagneraud <address@hidden>
---
 packet.c        |   18 ++++++++++++++++++
 packet_states.h |    2 ++
 2 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/packet.c b/packet.c
index fec34b9..3a1ffd1 100644
--- a/packet.c
+++ b/packet.c
@@ -412,6 +412,8 @@ static void nextstate(struct gps_packet_t *lexer, unsigned 
char c)
     case NMEA_BANG:
        if (c == 'A')
            lexer->state = AIS_LEAD_1;
+       else if (c == 'B')
+           lexer->state = AIS_LEAD_ALT1;
        else
            lexer->state = GROUND_STATE;
        break;
@@ -427,6 +429,18 @@ static void nextstate(struct gps_packet_t *lexer, unsigned 
char c)
        else
            lexer->state = GROUND_STATE;
        break;
+    case AIS_LEAD_ALT1:
+       if (c == 'S')
+           lexer->state = AIS_LEAD_ALT2;
+       else
+           lexer->state = GROUND_STATE;
+       break;
+    case AIS_LEAD_ALT2:
+       if (isalpha(c))
+           lexer->state = NMEA_LEADER_END;
+       else
+           lexer->state = GROUND_STATE;
+       break;
 #if defined(TNT_ENABLE) || defined(GARMINTXT_ENABLE) || defined(ONCORE_ENABLE)
     case AT1_LEADER:
        switch (c) {
@@ -1467,6 +1481,10 @@ void packet_parse(struct gps_packet_t *lexer)
                packet_accept(lexer, AIVDM_PACKET);
            else if (strncmp((char *)lexer->inbuffer, "!AIVDO", 6) == 0)
                packet_accept(lexer, AIVDM_PACKET);
+           else if (strncmp((char *)lexer->inbuffer, "!BSVDM", 6) == 0)
+               packet_accept(lexer, AIVDM_PACKET);
+           else if (strncmp((char *)lexer->inbuffer, "!BSVDO", 6) == 0)
+               packet_accept(lexer, AIVDM_PACKET);
            else
 #endif /* AIVDM_ENABLE */
                packet_accept(lexer, NMEA_PACKET);
diff --git a/packet_states.h b/packet_states.h
index 454f815..b2bfeac 100644
--- a/packet_states.h
+++ b/packet_states.h
@@ -23,6 +23,8 @@
    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 */
+   AIS_LEAD_ALT1,      /* seen B of possible marine AIS message */
+   AIS_LEAD_ALT2,      /* seen S of possible marine AIS message */
 
    SEATALK_LEAD_1,     /* SeaTalk/Garmin packet leader 'I' */
    WEATHER_LEAD_1,     /* Weather instrument packet leader 'W' */
-- 
1.7.7




reply via email to

[Prev in Thread] Current Thread [Next in Thread]