diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2005-07-08 12:29:26 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2005-07-08 12:29:26 +0000 |
commit | 36d754d9c2c34f68b03f9e2dc8571a778d8ae269 (patch) | |
tree | 03a406ca50a797bf881248d4b6cd5871e6cbb9e0 /nmea_parse.c | |
parent | 7946dd7553fe593d18dc206e5a49ac12ab149833 (diff) | |
download | gpsd-36d754d9c2c34f68b03f9e2dc8571a778d8ae269.tar.gz |
It is now possible to configure out NMEA support.
I did this more to document the dependencies in the code than anything
else.
Diffstat (limited to 'nmea_parse.c')
-rw-r--r-- | nmea_parse.c | 40 |
1 files changed, 21 insertions, 19 deletions
diff --git a/nmea_parse.c b/nmea_parse.c index 552c3335..79025458 100644 --- a/nmea_parse.c +++ b/nmea_parse.c @@ -10,6 +10,7 @@ #include "gpsd.h" #include "timebase.h" +#ifdef NMEA_ENABLE /************************************************************************** * * Parser helpers begin here @@ -474,25 +475,6 @@ static short nmea_checksum(char *sentence, unsigned char *correct_sum) * **************************************************************************/ -void nmea_add_checksum(char *sentence) -/* add NMEA checksum to a possibly *-terminated sentence */ -{ - unsigned char sum = '\0'; - char c, *p = sentence; - - if (*p == '$') { - p++; - } else { - gpsd_report(1, "Bad NMEA sentence: '%s'\n", sentence); - } - while ( ((c = *p) != '*') && (c != '\0')) { - sum ^= c; - p++; - } - *p++ = '*'; - (void)snprintf(p, 5, "%02X\r\n", (unsigned)sum); -} - gps_mask_t nmea_parse(char *sentence, struct gps_device_t *session) /* parse an NMEA sentence, unpack it into a session structure */ { @@ -553,6 +535,26 @@ gps_mask_t nmea_parse(char *sentence, struct gps_device_t *session) /*@ +usedef @*/ return retval; } +#endif /* NMEA_ENABLE */ + +void nmea_add_checksum(char *sentence) +/* add NMEA checksum to a possibly *-terminated sentence */ +{ + unsigned char sum = '\0'; + char c, *p = sentence; + + if (*p == '$') { + p++; + } else { + gpsd_report(1, "Bad NMEA sentence: '%s'\n", sentence); + } + while ( ((c = *p) != '*') && (c != '\0')) { + sum ^= c; + p++; + } + *p++ = '*'; + (void)snprintf(p, 5, "%02X\r\n", (unsigned)sum); +} int nmea_send(int fd, const char *fmt, ... ) /* ship a command to the GPS, adding * and correct checksum */ |