diff options
author | Gary E. Miller <gem@rellim.com> | 2019-03-25 17:52:42 -0700 |
---|---|---|
committer | Gary E. Miller <gem@rellim.com> | 2019-03-25 17:52:42 -0700 |
commit | 1b72497a7f44658b8a3e9b27f1c5d1f5bb7a615a (patch) | |
tree | 784c53f5f95c6efb01ea9cd496473b96fce03076 | |
parent | ee37b0ec95ddda2d744687246c7cf6337211aecd (diff) | |
download | gpsd-1b72497a7f44658b8a3e9b27f1c5d1f5bb7a615a.tar.gz |
gps_data_t: Add datum field. Add decode for $PGRMM.
Sadly, $PGRMM is after a cycle ender and the data is never
reported, so no regression changes. Cycle ender needs to get fixed...
-rw-r--r-- | driver_nmea0183.c | 30 | ||||
-rw-r--r-- | gps.h | 1 | ||||
-rw-r--r-- | gpsd_json.c | 7 | ||||
-rw-r--r-- | gpsutils.c | 3 |
4 files changed, 37 insertions, 4 deletions
diff --git a/driver_nmea0183.c b/driver_nmea0183.c index 7732c089..8c07339c 100644 --- a/driver_nmea0183.c +++ b/driver_nmea0183.c @@ -1423,6 +1423,30 @@ static gps_mask_t processPGRME(int c UNUSED, char *field[], return mask; } +/* Garmin Map Datum + * + * FIXME: seems to happen after cycle ender, so nothing happens... + */ +static gps_mask_t processPGRMM(int c UNUSED, char *field[], + struct gps_device_t *session) +{ + /* + * $PGRMM,NAD83*29 + * 1 = Map Datum + */ + gps_mask_t mask = ONLINE_SET; + + if ('\0' != field[1][0]) { + strlcpy(session->newdata.datum, field[1], + sizeof(session->newdata.datum)); + } + + gpsd_log(&session->context->errout, LOG_DATA, + "PGRMM: datum=%.40s\n", + session->newdata.datum); + return mask; +} + /* Garmin Altitude Information */ static gps_mask_t processPGRMZ(int c UNUSED, char *field[], struct gps_device_t *session) @@ -2442,7 +2466,7 @@ gps_mask_t nmea_parse(char *sentence, struct gps_device_t * session) {"PGRMF", 0, false, NULL}, /* ignore Garmin GPS Fix Data */ {"PGRMH", 0, false, NULL}, /* ignore Garmin Aviation Height... */ {"PGRMI", 0, false, NULL}, /* ignore Garmin Sensor Init */ - {"PGRMM", 0, false, NULL}, /* ignore Garmin Map Datum */ + {"PGRMM", 2, false, processPGRMM}, /* Garmin Map Datum */ {"PGRMO", 0, false, NULL}, /* ignore Garmin Sentence Enable */ {"PGRMT", 0, false, NULL}, /* ignore Garmin Sensor Info */ {"PGRMV", 0, false, NULL}, /* ignore Garmin 3D Velocity Info */ @@ -2463,6 +2487,7 @@ gps_mask_t nmea_parse(char *sentence, struct gps_device_t * session) * 4. The mode is changed back to NMEA, resulting in an * infinite loop. */ + {"BOD", 0, false, NULL}, /* ignore Bearing Origin to Destination */ {"DBT", 7, true, processDBT}, {"DTM", 0, false, NULL}, /* ignore datum */ {"GBS", 7, false, processGBS}, @@ -2503,8 +2528,9 @@ gps_mask_t nmea_parse(char *sentence, struct gps_device_t * session) {"STI", 2, false, processSTI}, /* $STI Skytraq */ #endif /* SKYTRAQ_ENABLE */ {"RMC", 8, false, processRMC}, + {"RTE", 0, false, NULL}, /* ignore Routes */ {"TXT", 5, false, processTXT}, - {"VLW", 0, false, NULL}, /* ignore Dual ground/water distance */ + {"VLW", 0, false, NULL}, /* ignore Dual ground/water distance */ {"VTG", 5, false, processVTG}, {"ZDA", 4, false, processZDA}, }; @@ -124,6 +124,7 @@ struct gps_fix_t { double vx, vy, vz; /* ECEF x, y, z velocity */ double vAcc; /* Velocity Accuracy Estimate, probably SEP */ } ecef; + char datum[40]; /* map datum */ }; /* diff --git a/gpsd_json.c b/gpsd_json.c index a50bed0f..73aed7c7 100644 --- a/gpsd_json.c +++ b/gpsd_json.c @@ -267,10 +267,13 @@ void json_tpv_dump(const struct gps_device_t *session, } #endif /* TIMING_ENABLE */ /* at the end because it is new and microjson chokes on new items */ - if (isfinite(gpsdata->fix.eph) != 0) + if (0 != isfinite(gpsdata->fix.eph)) str_appendf(reply, replylen, "\"eph\":%.3f,", gpsdata->fix.eph); - if (isfinite(gpsdata->fix.sep) != 0) + if (0 != isfinite(gpsdata->fix.sep)) str_appendf(reply, replylen, "\"sep\":%.3f,", gpsdata->fix.sep); + if ('\0' != gpsdata->fix.datum[0]) + str_appendf(reply, replylen, "\"datum\":\"%.40s\",", + gpsdata->fix.datum); } str_rstrip_char(reply, ','); (void)strlcat(reply, "}\r\n", replylen); @@ -363,6 +363,9 @@ void gps_merge_fix(struct gps_fix_t *to, to->ecef.vz = from->ecef.vz; to->ecef.vAcc = from->ecef.vAcc; } + if ('\0' != from->datum[0]) { + strlcpy(to->datum, from->datum, sizeof(to->datum)); + } } /* NOTE: timestamp_t is a double, so this is only precise to |