summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gpsd.c4
-rw-r--r--gpsd.h6
-rw-r--r--isgps.c2
-rw-r--r--rtcm.c15
-rw-r--r--rtcmdecode.c8
-rw-r--r--sirfmon.c4
6 files changed, 21 insertions, 18 deletions
diff --git a/gpsd.c b/gpsd.c
index 36224e44..c714bc6c 100644
--- a/gpsd.c
+++ b/gpsd.c
@@ -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 */
}
diff --git a/gpsd.h b/gpsd.h
index e89c87ca..daa0efa1 100644
--- a/gpsd.h
+++ b/gpsd.h
@@ -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);
diff --git a/isgps.c b/isgps.c
index f429503a..63e08808 100644
--- a/isgps.c
+++ b/isgps.c
@@ -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
diff --git a/rtcm.c b/rtcm.c
index 5fe1d093..aa333b2b 100644
--- a/rtcm.c
+++ b/rtcm.c
@@ -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));
diff --git a/sirfmon.c b/sirfmon.c
index b5f15e85..12bdc364 100644
--- a/sirfmon.c
+++ b/sirfmon.c
@@ -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);
}
}
}