diff options
-rw-r--r-- | NEWS | 3 | ||||
-rw-r--r-- | SConstruct | 1 | ||||
-rw-r--r-- | gps.h | 1 | ||||
-rw-r--r-- | libgps_core.c | 4 | ||||
-rw-r--r-- | libgps_sock.c | 305 | ||||
-rw-r--r-- | test/clientlib/oldstyle.log | 2 | ||||
-rw-r--r-- | test/clientlib/oldstyle.log.chk | 9 | ||||
-rw-r--r-- | www/history.html | 4 |
8 files changed, 49 insertions, 280 deletions
@@ -16,7 +16,8 @@ Repository head: The previously deprecated 'libQgpsmm' option has been removed; use 'qt'. A bug fix for error modeling when NMEA 0183 reports empty DOP fields. On OS X, the "osx-pl203" driver has been explicitly listed - as unsupported. + as unsupported. The last remnants of the old pre-JSON query protocol + have been removed from the client library. 3.11: 2014-07-23 (Eric S. Raymond <esr@snark.thyrsus.com>) A bug that prevented track interpolation has been fixed. @@ -145,7 +145,6 @@ boolopts = ( ("systemd", systemd, "systemd socket activation"), # Client-side options ("clientdebug", True, "client debugging support"), - ("oldstyle", True, "oldstyle (pre-JSON) protocol support"), ("ncurses", True, "build with ncurses"), ("libgpsmm", True, "build C++ bindings"), ("qt", True, "build QT bindings"), @@ -1917,7 +1917,6 @@ typedef int socket_t; #define WATCH_SPLIT24 0x001000u /* split AIS Type 24s */ #define WATCH_PPS 0x002000u /* enable PPS JSON */ #define WATCH_NEWSTYLE 0x010000u /* force JSON streaming */ -#define WATCH_OLDSTYLE 0x020000u /* force old-style streaming */ /* * Main structure that includes all previous substructures diff --git a/libgps_core.c b/libgps_core.c index 637dd204..4ed336cd 100644 --- a/libgps_core.c +++ b/libgps_core.c @@ -363,10 +363,6 @@ void libgps_dump_state(struct gps_data_t *collect) if (collect->set & DEVICE_SET) (void)fprintf(debugfp, "DEVICE: Device is '%s', driver is '%s'\n", collect->dev.path, collect->dev.driver); -#ifdef OLDSTYLE_ENABLE - if (collect->set & DEVICEID_SET) - (void)fprintf(debugfp, "GPSD ID is %s\n", collect->dev.subtype); -#endif /* OLDSTYLE_ENABLE */ if (collect->set & DEVICELIST_SET) { int i; (void)fprintf(debugfp, "DEVICELIST:%d devices:\n", diff --git a/libgps_sock.c b/libgps_sock.c index e5135638..919434f2 100644 --- a/libgps_sock.c +++ b/libgps_sock.c @@ -249,213 +249,7 @@ int gps_unpack(char *buf, struct gps_data_t *gpsdata) #endif /* LIBGPS_DEBUG */ } -#ifdef OLDSTYLE_ENABLE - if (PRIVATE(gpsdata) != NULL) - PRIVATE(gpsdata)->newstyle = true; -#endif /* OLDSTYLE_ENABLE */ } -#ifdef OLDSTYLE_ENABLE - else { - /* - * Get the decimal separator for the current application locale. - * This looks thread-unsafe, but it's not. The key is that - * character assignment is atomic. - */ - char *ns, *sp, *tp; - -#ifdef __UNUSED__ - static char decimal_point = '\0'; - if (decimal_point == '\0') { - struct lconv *locale_data = localeconv(); - if (locale_data != NULL && locale_data->decimal_point[0] != '.') - decimal_point = locale_data->decimal_point[0]; - } -#endif /* __UNUSED__ */ - - for (ns = buf; ns; ns = strstr(ns + 1, "GPSD")) { - /*@i1@*/if (str_starts_with(ns, "GPSD")) { - /* the following should execute each time we have a good next sp */ - for (sp = ns + 5; *sp != '\0'; sp = tp + 1) { - bool eol; - tp = sp + strcspn(sp, ",\r\n"); - eol = *tp == '\r' || *tp == '\n'; - if (*tp == '\0') - tp--; - else - *tp = '\0'; - -#ifdef __UNUSED__ - /* - * The daemon always emits the Anglo-American and SI - * decimal point. Hack these into whatever the - * application locale requires if it's not the same. - * This has to happen *after* we grab the next - * comma-delimited response, or we'll lose horribly - * in locales where the decimal separator is comma. - */ - if (decimal_point != '\0') { - char *cp; - for (cp = sp; cp < tp; cp++) - if (*cp == '.') - *cp = decimal_point; - } -#endif /* __UNUSED__ */ - - /* note, there's a bit of skip logic after the switch */ - - switch (*sp) { - case 'F': /*@ -mustfreeonly */ - if (sp[2] == '?') - gpsdata->dev.path[0] = '\0'; - else { - /*@ -mayaliasunique @*/ - (void)strlcpy(gpsdata->dev.path, sp + 2, - sizeof(gpsdata->dev.path)); - /*@ +mayaliasunique @*/ - gpsdata->set |= DEVICE_SET; - } - /*@ +mustfreeonly */ - break; - case 'I': - /*@ -mustfreeonly */ - if (sp[2] == '?') - gpsdata->dev.subtype[0] = '\0'; - else { - (void)strlcpy(gpsdata->dev.subtype, sp + 2, - sizeof(gpsdata->dev.subtype)); - gpsdata->set |= DEVICEID_SET; - } - /*@ +mustfreeonly */ - break; - case 'O': - if (sp[2] == '?') { - gpsdata->set = MODE_SET | STATUS_SET; - gpsdata->status = STATUS_NO_FIX; - gps_clear_fix(&gpsdata->fix); - } else { - struct gps_fix_t nf; - char alt[20]; - char eph[20], epv[20], track[20], speed[20], - climb[20]; - char epd[20], eps[20], epc[20], mode[2]; - char timestr[20], ept[20], lat[20], lon[20]; - int st = sscanf(sp + 2, - "%*s %19s %19s %19s %19s %19s %19s %19s %19s %19s %19s %19s %19s %19s %1s", - timestr, ept, lat, lon, - alt, eph, epv, track, speed, - climb, - epd, eps, epc, mode); - if (st >= 14) { -#define DEFAULT(val) (val[0] == '?') ? NAN : safe_atof(val) - /*@ +floatdouble @*/ - nf.time = DEFAULT(timestr); - nf.latitude = DEFAULT(lat); - nf.longitude = DEFAULT(lon); - nf.ept = DEFAULT(ept); - nf.altitude = DEFAULT(alt); - /* designed before we split eph into epx+epy */ - nf.epx = nf.epy = DEFAULT(eph) / sqrt(2); - nf.epv = DEFAULT(epv); - nf.track = DEFAULT(track); - nf.speed = DEFAULT(speed); - nf.climb = DEFAULT(climb); - nf.epd = DEFAULT(epd); - nf.eps = DEFAULT(eps); - nf.epc = DEFAULT(epc); - /*@ -floatdouble @*/ -#undef DEFAULT - if (st >= 15) - nf.mode = - (mode[0] == - '?') ? MODE_NOT_SEEN : atoi(mode); - else - nf.mode = - (alt[0] == '?') ? MODE_2D : MODE_3D; - if (alt[0] != '?') - gpsdata->set |= ALTITUDE_SET | CLIMB_SET; - if (isnan(nf.epx) == 0 && isnan(nf.epy) == 0) - gpsdata->set |= HERR_SET; - if (isnan(nf.epv) == 0) - gpsdata->set |= VERR_SET; - if (isnan(nf.track) == 0) - gpsdata->set |= TRACK_SET | SPEED_SET; - if (isnan(nf.eps) == 0) - gpsdata->set |= SPEEDERR_SET; - if (isnan(nf.epc) == 0) - gpsdata->set |= CLIMBERR_SET; - gpsdata->fix = nf; - gpsdata->set |= - TIME_SET | TIMERR_SET | LATLON_SET | - MODE_SET; - gpsdata->status = STATUS_FIX; - gpsdata->set |= STATUS_SET; - } - } - break; - case 'X': - if (sp[2] == '?') - gpsdata->online = (timestamp_t)-1; - else { - // cppcheck-suppress invalidscanf - (void)sscanf(sp, "X=%lf", &gpsdata->online); - gpsdata->set |= ONLINE_SET; - } - break; - case 'Y': - if (sp[2] == '?') { - gpsdata->satellites_visible = 0; - } else { - int j, i1, i2, i3, i5; - double f4; - char timestamp[21]; - - // cppcheck-suppress invalidscanf - (void)sscanf(sp, "Y=%*s %20s %d ", - timestamp, - &gpsdata->satellites_visible); - if (timestamp[0] != '?') { - gpsdata->set |= TIME_SET; - } - memset(&gpsdata->skyview, '\0', sizeof(gpsdata->skyview)); - for (j = 0, gpsdata->satellites_used = 0; - j < gpsdata->satellites_visible; j++) { - if ((sp != NULL) - && ((sp = strchr(sp, ':')) != NULL)) { - sp++; - // cppcheck-suppress invalidscanf - (void)sscanf(sp, "%d %d %d %lf %d", &i1, - &i2, &i3, &f4, &i5); - gpsdata->skyview[j].PRN = (short)i1; - gpsdata->skyview[j].elevation = (short)i2; - gpsdata->skyview[j].azimuth = (short)i3; - gpsdata->skyview[j].ss = (double)f4; - gpsdata->skyview[j].used = (bool)i5; - if (i5 == 1) - gpsdata->satellites_used++; - } - } - } - gpsdata->set |= SATELLITE_SET; - break; - } - -#ifdef LIBGPS_DEBUG - if (libgps_debuglevel >= 1) - libgps_dump_state(gpsdata); -#endif /* LIBGPS_DEBUG */ - - /* - * Skip to next GPSD when we see \r or \n; - * we don't want to try interpreting stuff - * in between that might be raw mode data. - */ - if (eol) - break; - } - } - } - } -#endif /* OLDSTYLE_ENABLE */ #ifndef USE_QT libgps_debug_trace((DEBUG_CALLS, "final flags: (0x%04x) %s\n", gpsdata->set,gps_maskdump(gpsdata->set))); @@ -496,68 +290,55 @@ int gps_sock_stream(struct gps_data_t *gpsdata, unsigned int flags, { char buf[GPS_JSON_COMMAND_MAX]; - if ((flags & (WATCH_JSON | WATCH_OLDSTYLE | WATCH_NMEA | WATCH_RAW)) == 0) { + if ((flags & (WATCH_JSON | WATCH_NMEA | WATCH_RAW)) == 0) { flags |= WATCH_JSON; } if ((flags & WATCH_DISABLE) != 0) { - if ((flags & WATCH_OLDSTYLE) != 0) { - (void)strlcpy(buf, "w-", sizeof(buf)); - if ((flags & WATCH_NMEA) != 0) - (void)strlcat(buf, "r-", sizeof(buf)); - } else { - (void)strlcpy(buf, "?WATCH={\"enable\":false,", sizeof(buf)); - if (flags & WATCH_JSON) - (void)strlcat(buf, "\"json\":false,", sizeof(buf)); - if (flags & WATCH_NMEA) - (void)strlcat(buf, "\"nmea\":false,", sizeof(buf)); - if (flags & WATCH_RAW) - (void)strlcat(buf, "\"raw\":1,", sizeof(buf)); - if (flags & WATCH_RARE) - (void)strlcat(buf, "\"raw\":0,", sizeof(buf)); - if (flags & WATCH_SCALED) - (void)strlcat(buf, "\"scaled\":false,", sizeof(buf)); - if (flags & WATCH_TIMING) - (void)strlcat(buf, "\"timing\":false,", sizeof(buf)); - if (flags & WATCH_SPLIT24) - (void)strlcat(buf, "\"split24\":false,", sizeof(buf)); - if (flags & WATCH_PPS) - (void)strlcat(buf, "\"pps\":false,", sizeof(buf)); - str_rstrip_char(buf, ','); - (void)strlcat(buf, "};", sizeof(buf)); - } + (void)strlcpy(buf, "?WATCH={\"enable\":false,", sizeof(buf)); + if (flags & WATCH_JSON) + (void)strlcat(buf, "\"json\":false,", sizeof(buf)); + if (flags & WATCH_NMEA) + (void)strlcat(buf, "\"nmea\":false,", sizeof(buf)); + if (flags & WATCH_RAW) + (void)strlcat(buf, "\"raw\":1,", sizeof(buf)); + if (flags & WATCH_RARE) + (void)strlcat(buf, "\"raw\":0,", sizeof(buf)); + if (flags & WATCH_SCALED) + (void)strlcat(buf, "\"scaled\":false,", sizeof(buf)); + if (flags & WATCH_TIMING) + (void)strlcat(buf, "\"timing\":false,", sizeof(buf)); + if (flags & WATCH_SPLIT24) + (void)strlcat(buf, "\"split24\":false,", sizeof(buf)); + if (flags & WATCH_PPS) + (void)strlcat(buf, "\"pps\":false,", sizeof(buf)); + str_rstrip_char(buf, ','); + (void)strlcat(buf, "};", sizeof(buf)); libgps_debug_trace((DEBUG_CALLS, "gps_stream() disable command: %s\n", buf)); return gps_send(gpsdata, buf); } else { /* if ((flags & WATCH_ENABLE) != 0) */ - - if ((flags & WATCH_OLDSTYLE) != 0) { - (void)strlcpy(buf, "w+x", sizeof(buf)); - if ((flags & WATCH_NMEA) != 0) - (void)strlcat(buf, "r+", sizeof(buf)); - } else { - (void)strlcpy(buf, "?WATCH={\"enable\":true,", sizeof(buf)); - if (flags & WATCH_JSON) - (void)strlcat(buf, "\"json\":true,", sizeof(buf)); - if (flags & WATCH_NMEA) - (void)strlcat(buf, "\"nmea\":true,", sizeof(buf)); - if (flags & WATCH_RARE) - (void)strlcat(buf, "\"raw\":1,", sizeof(buf)); - if (flags & WATCH_RAW) - (void)strlcat(buf, "\"raw\":2,", sizeof(buf)); - if (flags & WATCH_SCALED) - (void)strlcat(buf, "\"scaled\":true,", sizeof(buf)); - if (flags & WATCH_TIMING) - (void)strlcat(buf, "\"timing\":true,", sizeof(buf)); - if (flags & WATCH_SPLIT24) - (void)strlcat(buf, "\"split24\":true,", sizeof(buf)); - if (flags & WATCH_PPS) - (void)strlcat(buf, "\"pps\":true,", sizeof(buf)); - /*@-nullpass@*//* shouldn't be needed, splint has a bug */ - if (flags & WATCH_DEVICE) - str_appendf(buf, sizeof(buf), "\"device\":\"%s\",", (char *)d); - /*@+nullpass@*/ - str_rstrip_char(buf, ','); - (void)strlcat(buf, "};", sizeof(buf)); - } + (void)strlcpy(buf, "?WATCH={\"enable\":true,", sizeof(buf)); + if (flags & WATCH_JSON) + (void)strlcat(buf, "\"json\":true,", sizeof(buf)); + if (flags & WATCH_NMEA) + (void)strlcat(buf, "\"nmea\":true,", sizeof(buf)); + if (flags & WATCH_RARE) + (void)strlcat(buf, "\"raw\":1,", sizeof(buf)); + if (flags & WATCH_RAW) + (void)strlcat(buf, "\"raw\":2,", sizeof(buf)); + if (flags & WATCH_SCALED) + (void)strlcat(buf, "\"scaled\":true,", sizeof(buf)); + if (flags & WATCH_TIMING) + (void)strlcat(buf, "\"timing\":true,", sizeof(buf)); + if (flags & WATCH_SPLIT24) + (void)strlcat(buf, "\"split24\":true,", sizeof(buf)); + if (flags & WATCH_PPS) + (void)strlcat(buf, "\"pps\":true,", sizeof(buf)); + /*@-nullpass@*//* shouldn't be needed, splint has a bug */ + if (flags & WATCH_DEVICE) + str_appendf(buf, sizeof(buf), "\"device\":\"%s\",", (char *)d); + /*@+nullpass@*/ + str_rstrip_char(buf, ','); + (void)strlcat(buf, "};", sizeof(buf)); libgps_debug_trace((DEBUG_CALLS, "gps_stream() enable command: %s\n", buf)); return gps_send(gpsdata, buf); } diff --git a/test/clientlib/oldstyle.log b/test/clientlib/oldstyle.log deleted file mode 100644 index 29f41d2d..00000000 --- a/test/clientlib/oldstyle.log +++ /dev/null @@ -1,2 +0,0 @@ -GPSD,O=RMC 1207318966.000 0.005 49.026225 12.188348 375.20 19.20 10.40 70.8900 24.899 0.000 75.6699 38.40 ? 3
-$GPVTG,70.89,T,,M,48.40,N,89.6,K,A*34
diff --git a/test/clientlib/oldstyle.log.chk b/test/clientlib/oldstyle.log.chk deleted file mode 100644 index 0cca5f4b..00000000 --- a/test/clientlib/oldstyle.log.chk +++ /dev/null @@ -1,9 +0,0 @@ -flags: (0x137fc) {TIME|TIMERR|LATLON|ALTITUDE|SPEED|TRACK|CLIMB|STATUS|MODE|HERR|VERR|SPEEDERR} -TIME: 1207318966.000000 -LATLON: lat/lon: 49.026225 12.188348 -ALTITUDE: altitude: 375.200000 U: climb: 0.000000 -SPEED: 24.899000 -TRACK: track: 70.890000 -CLIMB: climb: 0.000000 -STATUS: status: 1 (FIX) -MODE: mode: 3 (MODE_3D) diff --git a/www/history.html b/www/history.html index 16de3a68..20d0ab09 100644 --- a/www/history.html +++ b/www/history.html @@ -188,6 +188,10 @@ changes at all were required.</p> would be shutting down at the end of 2011 forced the project to move to Savannah.</p> +<p>In the 3.12 release of January 2015, the undocumented remnants of +client-library support for the pre-JSON query protocol were +removed.</p> + <hr> <script src="datestamp.js" type='text/javascript'></script> </div> |