gpsd-dev
[Top][All Lists]
Advanced

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

[gpsd-dev] [PATCH 3/3] Support Galileo $GA... talkers and fix a couple o


From: Chris Lawrence
Subject: [gpsd-dev] [PATCH 3/3] Support Galileo $GA... talkers and fix a couple of $GB cases
Date: Mon, 11 Dec 2017 01:12:14 -0500
User-agent: Mutt/1.9.1 (2017-09-22)

Now that the Galileo constellation is live, the NMEA 4.1 standard
appears to have standardized on the "$GA..." prefix for
Galileo-specific messages. The lexer currently filters these out; this
patch ensures they go through to e.g. gpspipe -r. (I tore my hair out
for days trying to figure out why these were not being passed through
even though I could see them using screen etc.)

Also added logic to the GSA and GSV message parsing to account for the
Galileo messages. It probably needs more work to match up satellite
numbers between the GSA and GSV messages and to account for the GNSS
type field in NMEA 4.1, but it's a start at least.

I also fixed a couple of situations where the 'GB' prefix was being
ignored even though 'BD' was not. This leads to a regression in
test/daemon/beidou-gb.log, but the "regression" is actually incorrect
old behavior (JSON messages omitting BeiDou satellites) exposed by the
patch.

Signed-off-by: Chris Lawrence <address@hidden>
---
 driver_nmea0183.c | 16 +++++++++++-----
 gpsd.h            |  2 ++
 packet.c          |  3 ++-
 3 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/driver_nmea0183.c b/driver_nmea0183.c
index 94cf4dc3..4287154f 100644
--- a/driver_nmea0183.c
+++ b/driver_nmea0183.c
@@ -536,6 +536,8 @@ static int nmeaid_to_prn(char *talker, int satnum)
        /* QZSS */
        if (talker[0] == 'Q' && talker[1] == 'Z')
            satnum += 193;
+       if (talker[0] == 'G' && talker[1] == 'A')
+           satnum += 300; /* Used by u-blox at least */
     }
 
     return satnum;
@@ -629,12 +631,14 @@ static gps_mask_t processGSA(int count, char *field[],
            memset(session->nmea.sats_used, 0, sizeof(session->nmea.sats_used));
        }
        session->nmea.last_gsa_talker = GSA_TALKER;
-       if (session->nmea.last_gsa_talker == 'D')
+       if (session->nmea.last_gsa_talker == 'D' || 
session->nmea.last_gsa_talker == 'B')
            session->nmea.seen_bdgsa = true;
        else if (session->nmea.last_gsa_talker == 'L')
            session->nmea.seen_glgsa = true;
        else if (session->nmea.last_gsa_talker == 'N')
            session->nmea.seen_gngsa = true;
+       else if (session->nmea.last_gsa_talker == 'A')
+           session->nmea.seen_gagsa = true;
 
        /* the magic 6 here counts the tag, two mode fields, and the DOP fields 
*/
        for (i = 0; i < count - 6; i++) {
@@ -665,7 +669,7 @@ static gps_mask_t processGSA(int count, char *field[],
     }
     /* assumes GLGSA or BDGSA, if present, is emitted  directly
      * after the GPGSA*/
-    if ((session->nmea.seen_glgsa || session->nmea.seen_bdgsa)
+    if ((session->nmea.seen_glgsa || session->nmea.seen_bdgsa || 
session->nmea.seen_gagsa)
        && GSA_TALKER == 'P')
        return ONLINE_SET;
 
@@ -769,10 +773,12 @@ static gps_mask_t processGSV(int count, char *field[],
        session->nmea.last_gsv_talker = GSV_TALKER;
        if (session->nmea.last_gsv_talker == 'L')
            session->nmea.seen_glgsv = true;
-       if (session->nmea.last_gsv_talker == 'D')
+       if (session->nmea.last_gsv_talker == 'D' || 
session->nmea.last_gsv_talker == 'B')
            session->nmea.seen_bdgsv = true;
        if (session->nmea.last_gsv_talker == 'Z')
            session->nmea.seen_qzss = true;
+       if (session->nmea.last_gsv_talker == 'A')
+           session->nmea.seen_gagsv = true;
     }
 
     for (fldnum = 4; fldnum < count / 4 * 4;) {
@@ -815,7 +821,7 @@ static gps_mask_t processGSV(int count, char *field[],
      *
      * FIXME: Add per-talker totals so we can do this check properly.
      */
-    if (!(session->nmea.seen_glgsv || session->nmea.seen_bdgsv || 
session->nmea.seen_qzss))
+    if (!(session->nmea.seen_glgsv || session->nmea.seen_bdgsv || 
session->nmea.seen_qzss || session->nmea.seen_gagsv))
        if (session->nmea.part == session->nmea.await
                && atoi(field[3]) != session->gpsdata.satellites_visible)
            gpsd_log(&session->context->errout, LOG_WARN,
@@ -852,7 +858,7 @@ static gps_mask_t processGSV(int count, char *field[],
             session->nmea.part, session->nmea.await);
 
     /* assumes GLGSV or BDGSV group, if present, is emitted after the GPGSV */
-    if ((session->nmea.seen_glgsv || session->nmea.seen_bdgsv || 
session->nmea.seen_qzss) && GSV_TALKER == 'P')
+    if ((session->nmea.seen_glgsv || session->nmea.seen_bdgsv || 
session->nmea.seen_qzss || session->nmea.seen_gagsv) && GSV_TALKER == 'P')
        return ONLINE_SET;
 
     /* clear computed DOPs so they get recomputed. */
diff --git a/gpsd.h b/gpsd.h
index a6e60ef5..b14403d4 100644
--- a/gpsd.h
+++ b/gpsd.h
@@ -539,10 +539,12 @@ struct gps_device_t {
        bool seen_glgsv;
        bool seen_bdgsv;
        bool seen_qzss;
+       bool seen_gagsv;
        char last_gsv_talker;
        bool seen_glgsa;
        bool seen_gngsa;
        bool seen_bdgsa;
+       bool seen_gagsa;
        char last_gsa_talker;
        /*
         * State for the cycle-tracking machinery.
diff --git a/packet.c b/packet.c
index bf0e2757..69aced6f 100644
--- a/packet.c
+++ b/packet.c
@@ -94,6 +94,7 @@ PERMISSIONS
  *      $GN -- Mixed GPS and GLONASS data, according to IEIC 61162-1
  *      $BD -- Beidou
  *      $GB -- Beidou
+ *      $GA -- Galileo
  *      $QZ -- QZSS GPS augmentation system
  *      $II -- Integrated Instrumentation (Raytheon's SeaTalk system).
  *      $IN -- Integrated Navigation (Garmin uses this).
@@ -389,7 +390,7 @@ static bool nextstate(struct gps_lexer_t *lexer, unsigned 
char c)
         * We have a log from China with a Beidou device using $GB
         * rather than $BD.
         */
-       if (c == 'B' || c == 'P' || c == 'N' || c == 'L')
+       if (c == 'B' || c == 'P' || c == 'N' || c == 'L' || c == 'A')
            lexer->state = NMEA_LEADER_END;
        else
            (void) character_pushback(lexer, GROUND_STATE);
-- 
2.14.3 (Apple Git-98)


-- 
Chris Lawrence <address@hidden> - http://blog.lordsutch.com/



reply via email to

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