diff options
-rw-r--r-- | gpsd.c | 4 | ||||
-rw-r--r-- | gpsd.h | 6 | ||||
-rw-r--r-- | isgps.c | 2 | ||||
-rw-r--r-- | rtcm.c | 15 | ||||
-rw-r--r-- | rtcmdecode.c | 8 | ||||
-rw-r--r-- | sirfmon.c | 4 |
6 files changed, 21 insertions, 18 deletions
@@ -1364,8 +1364,8 @@ int main(int argc, char *argv[]) if ((changed & RTCM_SET) != 0) { FD_CLR(channel->gpsdata.gps_fd, &all_fds); for (gps = channels; gps < channels + MAXDEVICES; gps++) - if (gps->device_type && gps->device_type->rtcm_writer) - gps->device_type->rtcm_writer(gps, (char *)channel->outbuffer, channel->outbuflen); + if (gps->device_type != NULL && gps->device_type->rtcm_writer != NULL) + (void)gps->device_type->rtcm_writer(gps, (char *)channel->outbuffer, channel->outbuflen); } #endif /* RTCM104_ENABLE */ } @@ -262,10 +262,10 @@ extern int ntpshm_pps(struct gps_device_t *,struct timeval *); extern void isgps_init(/*@out@*/struct gps_device_t *); enum isgpsstat_t isgps_decode(struct gps_device_t *session, - bool (*preamble_match)(isgps30bits_t *), - bool (*length_check)(struct gps_device_t *), + bool (*preamble_match)(isgps30bits_t *), + bool (*length_check)(struct gps_device_t *), unsigned int c); -extern unsigned bitreverse(unsigned x, unsigned w); +extern unsigned int isgps_parity(isgps30bits_t th); extern enum isgpsstat_t rtcm_decode(struct gps_device_t *, unsigned int); extern void rtcm_dump(struct gps_device_t *, /*@out@*/char[], size_t); @@ -98,7 +98,7 @@ static unsigned int reverse_bits[] = { }; /*@ -charint @*/ -static unsigned int isgps_parity(isgps30bits_t th) +unsigned int isgps_parity(isgps30bits_t th) { #define P_30_MASK 0x40000000u @@ -662,6 +662,7 @@ bool rtcm_repack(struct gps_device_t *session) unsigned int n, w, uval; struct rtcm_t *tp = &session->gpsdata.rtcm; struct rtcm_msg_t *msg = (struct rtcm_msg_t *)session->driver.isgps.buf; + struct rtcm_msghw1 *wp = (struct rtcm_msghw1 *)session->driver.isgps.buf; memset(session->driver.isgps.buf, 0, sizeof(session->driver.isgps.buf)); msg->w1.msgtype = tp->type; @@ -712,8 +713,6 @@ bool rtcm_repack(struct gps_device_t *session) m->w6.udre3 = ssp->udre; m->w7.issuedata3 = ssp->issuedata; m->w6.scale3 = (unsigned)((ssp->rangerr > MAXPCSMALL) || - (ssp->rangerr < (-MAXPCSMALL))); - m->w6.scale3 = (unsigned)((ssp->rangerr > MAXPCSMALL) || (ssp->rangerr < (-MAXPCSMALL)) || (ssp->rangerate > MAXRRSMALL) || (ssp->rangerate < (-MAXRRSMALL))); @@ -734,9 +733,9 @@ bool rtcm_repack(struct gps_device_t *session) case 3: /* R */ if (tp->msg_data.ecef.valid) { struct rtcm_msg3 *m = &msg->msg_type.type3; - unsigned x = (unsigned)(tp->msg_data.ecef.x / XYZ_SCALE); - unsigned y = (unsigned)(tp->msg_data.ecef.y / XYZ_SCALE); - unsigned z = (unsigned)(tp->msg_data.ecef.z / XYZ_SCALE); + unsigned x = (unsigned) round(tp->msg_data.ecef.x / XYZ_SCALE); + unsigned y = (unsigned) round(tp->msg_data.ecef.y / XYZ_SCALE); + unsigned z = (unsigned) round(tp->msg_data.ecef.z / XYZ_SCALE); m->w4.x_l = x & 0xff; m->w3.x_h = x >> 8; @@ -851,7 +850,11 @@ bool rtcm_repack(struct gps_device_t *session) break; } - /* FIXME: must compute parity and inversion here */ + /* compute parity for each word in the message */ + for (w = 0; w < tp->length; w++) + wp[w].parity = isgps_parity(session->driver.isgps.buf[w]); + + /* FIXME: must do inversion here */ return true; } diff --git a/rtcmdecode.c b/rtcmdecode.c index 8f96f8ef..15c3dc7f 100644 --- a/rtcmdecode.c +++ b/rtcmdecode.c @@ -29,7 +29,7 @@ void gpsd_report(int errlevel, const char *fmt, ... ) static void decode(FILE *fpin, FILE *fpout) /* RTCM-104 bits on fpin to dump format on fpout */ { - int c; + int c; struct gps_device_t device; enum isgpsstat_t res; off_t count; @@ -57,7 +57,7 @@ static void passthrough(FILE *fpin, FILE *fpout) struct gps_device_t rtcmdata; memset(&rtcmdata, 0, sizeof(rtcmdata)); - while (fgets(buf, sizeof(buf), fpin) != NULL) { + while (fgets(buf, (int)sizeof(buf), fpin) != NULL) { int status; /* pass through comment lines without interpreting */ @@ -69,8 +69,8 @@ static void passthrough(FILE *fpin, FILE *fpout) status = rtcm_undump(&rtcmdata.gpsdata.rtcm, buf); if (status == 0) { - rtcm_repack(&rtcmdata); - rtcm_unpack(&rtcmdata); + (void)rtcm_repack(&rtcmdata); + (void)rtcm_unpack(&rtcmdata); (void)rtcm_dump(&rtcmdata, buf, sizeof(buf)); (void)fputs(buf, fpout); memset(&rtcmdata, 0, sizeof(rtcmdata)); @@ -142,7 +142,7 @@ static int nmea_send(int fd, const char *fmt, ... ) va_end(ap); strcat(buf, "*"); nmea_add_checksum(buf); - fputs(buf, stderr); /* so user can watch the baud hunt */ + (void)fputs(buf, stderr); /* so user can watch the baud hunt */ status = (size_t)write(fd, buf, strlen(buf)); if (status == strlen(buf)) { return (int)status; @@ -684,7 +684,7 @@ static unsigned int hunt_open(unsigned int *pstopbits) else if (st == NMEA_PACKET) { (void)fprintf(stderr, "Switching to SiRF mode...\n"); (void)nmea_send(controlfd,"$PSRF100,0,%d,8,1,0", *ip); - usleep(10000); + (void)usleep(10000); } } } |