summaryrefslogtreecommitdiff
path: root/libgps.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2009-07-29 16:08:10 +0000
committerEric S. Raymond <esr@thyrsus.com>2009-07-29 16:08:10 +0000
commit29200545c8a666de3ec69fa951f90e72a63b8236 (patch)
treef989a31ba14ef928f97029f6da5fdfd87c2da01d /libgps.c
parent42bbb63a1b66ee64e297d432689833d970a16ed8 (diff)
downloadgpsd-29200545c8a666de3ec69fa951f90e72a63b8236.tar.gz
Update client library to read current JSON - not yet tested.
Diffstat (limited to 'libgps.c')
-rw-r--r--libgps.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/libgps.c b/libgps.c
index e467821e..e650755c 100644
--- a/libgps.c
+++ b/libgps.c
@@ -82,29 +82,29 @@ static void gps_unpack(char *buf, struct gps_data_t *gpsdata)
char *ns, *sp, *tp;
int i;
- /*
- * 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.
- */
- 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];
- }
-
#ifdef GPSDNG_ENABLE
/* detect and process a JSON response */
- if (buf[0] == '!' && (sp = strchr(buf, '='))!=NULL && sp[1] == '{') {
- if (strncmp(buf, "!TPV=", 5) == 0) {
+ if (buf[0] == '{' && (sp = strchr(buf, '='))!= NULL) {
+ if (strstr(buf, "\"class\":\"TPV\"") == 0) {
json_tpv_read(buf+5, gpsdata);
- } else if (strncmp(buf, "!SKY=", 5) == 0) {
+ } else if (strstr(buf, "\"class\":\"SKY\"") == 0) {
json_sky_read(buf+5, gpsdata);
}
} else
#endif /* GPSDNG_ENABLE */
{
+ /*
+ * 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.
+ */
+ 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];
+ }
+
for (ns = buf; ns; ns = strstr(ns+1, "GPSD")) {
if (/*@i1@*/strncmp(ns, "GPSD", 4) == 0) {
bool eol = false;