From 41a911788fee388d4df527d1751ba9def19f9413 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Sat, 26 Feb 2011 16:43:45 -0500 Subject: Make the length of ISGPS packets accessible. --- gpsd.h-tail | 7 ++++++- isgps.c | 2 ++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/gpsd.h-tail b/gpsd.h-tail index 05a322a2..7431f109 100644 --- a/gpsd.h-tail +++ b/gpsd.h-tail @@ -129,8 +129,13 @@ struct gps_packet_t { bool locked; int curr_offset; isgps30bits_t curr_word; - isgps30bits_t buf[RTCM2_WORDS_MAX]; unsigned int bufindex; + /* + * Only these sgould be referenced from elsewhere, and only when + * RTCM_MESSAGE has just been returned. + */ + isgps30bits_t buf[RTCM2_WORDS_MAX]; /* packet data */ + unsigned int buflen; /* packet length in bytes */ } isgps; }; diff --git a/isgps.c b/isgps.c index 16d0cf35..13c37cf2 100644 --- a/isgps.c +++ b/isgps.c @@ -171,6 +171,7 @@ void isgps_init( /*@out@*/ struct gps_packet_t *session) session->isgps.curr_offset = 24; /* first word */ session->isgps.locked = false; session->isgps.bufindex = 0; + session->isgps.buflen = 0; } /*@ -usereleased -compdef @*/ @@ -278,6 +279,7 @@ enum isgpsstat_t isgps_decode(struct gps_packet_t *session, if (length_check(session)) { /* jackpot, we have a complete packet */ + session->isgps.buflen = session->isgps.bufindex * sizeof(isgps30bits_t); session->isgps.bufindex = 0; res = ISGPS_MESSAGE; } -- cgit v1.2.1