diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2009-09-21 14:40:11 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2009-09-21 14:40:11 +0000 |
commit | c856f3357d38a6a43690e4e58dad8f2bd793f539 (patch) | |
tree | 5e4494e49402864a0efa7d090c09e8388b7b574c | |
parent | 7d6d1fc1a8fef0c16e8099fbe7046ac8a64837c0 (diff) | |
download | gpsd-c856f3357d38a6a43690e4e58dad8f2bd793f539.tar.gz |
Separate WATCH_NMEA from WATCH_RAW in the visible API.
All regression tests pass. Codebase splints clean.
-rw-r--r-- | TODO | 2 | ||||
-rw-r--r-- | gps.h | 9 | ||||
-rwxr-xr-x | gps.py | 15 | ||||
-rw-r--r-- | libgps.c | 6 | ||||
-rw-r--r-- | www/protocol-transition.txt | 3 |
5 files changed, 22 insertions, 13 deletions
@@ -46,6 +46,8 @@ of mode switch we should be uttering. **** cgps.c still relies on old protocol (that's Jeff Francis's problem). +**** Profiling features (Z and $) need to be ported from the old protocol. + **** Client-side support for RTCM3-JSON RTCM3 support is nonexistent due to a lack of suitable test loads. @@ -967,10 +967,11 @@ struct gps_data_t { }; /* mode flags for gps_stream() */ -#define WATCH_DISABLE 0x00u -#define WATCH_ENABLE 0x01u -#define WATCH_RAW 0x02u -#define WATCH_SCALED 0x04u +#define WATCH_DISABLE 0x00u /* disable watching */ +#define WATCH_ENABLE 0x01u /* enable outputs in gpsd format */ +#define WATCH_NMEA 0x02u /* enable output in NMEA */ +#define WATCH_RAW 0x04u /* enable output of raw packets in hex */ +#define WATCH_SCALED 0x08u /* scale output to floats, when applicable */ #define WATCH_NEWSTYLE 0x10u /* for test purposes only - will go away */ extern int gps_open_r(const char *host, const char *port, @@ -55,7 +55,8 @@ SIGNAL_STRENGTH_UNKNOWN = NaN WATCH_DISABLE = 0x00 WATCH_ENABLE = 0x01 -WATCH_RAW = 0x02 +WATCH_NMEA = 0x02 +WATCH_RAW = 0x04 WATCH_SCALED = 0x08 GPSD_PORT = 2947 @@ -401,10 +402,10 @@ class gps(gpsdata): self.timings.c_recv_time = time.time() if self.raw_hook: self.raw_hook(self.response); - if self.response.startswith("{"): - self.__json_unpack(self.response) - else: - self.__oldstyle_unpack(self.response) + #if self.response.startswith("{"): + # self.__json_unpack(self.response) + #else: + self.__oldstyle_unpack(self.response) if self.profiling: if self.timings.sentence_time != '?': basetime = self.timings.sentence_time @@ -429,12 +430,12 @@ class gps(gpsdata): "Ask gpsd to stream reports at your client." if flags & WATCH_ENABLE: arg = "w+x" - if self.raw_hook or (flags & WATCH_RAW): + if self.raw_hook or (flags & WATCH_NMEA): arg += 'r+' return self.query(arg) elif flags & WATCH_DISABLE: arg = "w-" - if self.raw_hook or (flags & WATCH_RAW): + if self.raw_hook or (flags & WATCH_NMEA): arg += 'r-' return self.query(arg) @@ -511,10 +511,12 @@ int gps_stream(struct gps_data_t *gpsdata, unsigned int flags) if ((flags & WATCH_ENABLE) != 0) { #ifdef OLDSTYLE_ENABLE (void)strlcpy(buf, "w+x", sizeof(buf)); - if (gpsdata->raw_hook != NULL || (flags & WATCH_RAW)!=0) + if (gpsdata->raw_hook != NULL || (flags & WATCH_NMEA)!=0) (void)strlcat(buf, "r+", sizeof(buf)); #else (void)strlcpy(buf, "?WATCH={", sizeof(buf)); + if (flags & WATCH_NMEA) + (void)strlcat(buf, "\"nmea\":true", sizeof(buf)); if (gpsdata->raw_hook != NULL || (flags & WATCH_RAW)!=0) (void)strlcat(buf, "\"raw\":1", sizeof(buf)); if (flags & WATCH_SCALED) @@ -529,6 +531,8 @@ int gps_stream(struct gps_data_t *gpsdata, unsigned int flags) (void)strlcat(buf, "r-", sizeof(buf)); #else (void)strlcpy(buf, "?WATCH={\"enable\":false,", sizeof(buf)); + if (flags & WATCH_NMEA) + (void)strlcat(buf, "\"nmea\":false", sizeof(buf)); if (gpsdata->raw_hook != NULL || (flags & WATCH_RAW)!=0) (void)strlcat(buf, "\"raw\":1,", sizeof(buf)); if (flags & WATCH_SCALED) diff --git a/www/protocol-transition.txt b/www/protocol-transition.txt index c271f574..74b7f285 100644 --- a/www/protocol-transition.txt +++ b/www/protocol-transition.txt @@ -72,7 +72,8 @@ struct gpsdata_t that application developers usually don't or issued unusual configuration commands. Here are the exceptions: * You issued other gps_query() commands, such as "J=1". If so, - you'll need to learn how to say them in the new API. That + you'll need to learn how to say them in the new API (the J command + itself is dead, and you can just remove it entirely). That is not difficult, and this document will cover what you need to know. |