summaryrefslogtreecommitdiff
path: root/driver_rtcm2.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2010-04-14 01:59:50 -0400
committerEric S. Raymond <esr@thyrsus.com>2010-04-14 01:59:50 -0400
commit5329e53076fb92dc494bacf52d7386b18559efa9 (patch)
treebd019f9508850f90658be246dd26cc3dafd092f5 /driver_rtcm2.c
parentc8c48fad551f0c48cea3cec644281d367269a9ea (diff)
downloadgpsd-5329e53076fb92dc494bacf52d7386b18559efa9.tar.gz
Reindent the RTCM drivers. All regression tesrs pass.
Diffstat (limited to 'driver_rtcm2.c')
-rw-r--r--driver_rtcm2.c364
1 files changed, 188 insertions, 176 deletions
diff --git a/driver_rtcm2.c b/driver_rtcm2.c
index aff0c2c9..42476a81 100644
--- a/driver_rtcm2.c
+++ b/driver_rtcm2.c
@@ -60,7 +60,7 @@ BSD terms apply: see the file COPYING in the distribution root for details.
#include <string.h>
#include <stdbool.h>
#include <stdio.h>
-#include <math.h> /* for round() */
+#include <math.h> /* for round() */
#include "gpsd.h"
#include "driver_rtcm2.h"
@@ -73,7 +73,7 @@ static unsigned int tx_speed[] = { 25, 50, 100, 110, 150, 200, 250, 300 };
#define DIMENSION(a) (unsigned)(sizeof(a)/sizeof(a[0]))
-void rtcm2_unpack(/*@out@*/struct rtcm2_t *tp, char *buf)
+void rtcm2_unpack( /*@out@*/ struct rtcm2_t *tp, char *buf)
/* break out the raw bits into the content fields */
{
int len;
@@ -92,67 +92,69 @@ void rtcm2_unpack(/*@out@*/struct rtcm2_t *tp, char *buf)
switch (tp->type) {
case 1:
case 9:
- {
- struct b_correction_t *m = &msg->msg_type.type1.corrections[0];
-
- while (len >= 0) {
- if (len >= 2) {
- tp->ranges.sat[n].ident = m->w3.satident1;
- tp->ranges.sat[n].udre = m->w3.udre1;
- tp->ranges.sat[n].issuedata = m->w4.issuedata1;
- tp->ranges.sat[n].rangerr = m->w3.pc1 *
- (m->w3.scale1 ? PCLARGE : PCSMALL);
- tp->ranges.sat[n].rangerate = m->w4.rangerate1 *
- (m->w3.scale1 ? RRLARGE : RRSMALL);
- n++;
- }
- if (len >= 4) {
- tp->ranges.sat[n].ident = m->w4.satident2;
- tp->ranges.sat[n].udre = m->w4.udre2;
- tp->ranges.sat[n].issuedata = m->w6.issuedata2;
- tp->ranges.sat[n].rangerr = m->w5.pc2 *
- (m->w4.scale2 ? PCLARGE : PCSMALL);
- tp->ranges.sat[n].rangerate = m->w5.rangerate2 *
- (m->w4.scale2 ? RRLARGE : RRSMALL);
- n++;
- }
- if (len >= 5) {
- tp->ranges.sat[n].ident = m->w6.satident3;
- tp->ranges.sat[n].udre = m->w6.udre3;
- tp->ranges.sat[n].issuedata = m->w7.issuedata3;
- /*@ -shiftimplementation @*/
- tp->ranges.sat[n].rangerr = ((m->w6.pc3_h<<8)|(m->w7.pc3_l)) *
- (m->w6.scale3 ? PCLARGE : PCSMALL);
- tp->ranges.sat[n].rangerate = m->w7.rangerate3 *
- (m->w6.scale3 ? RRLARGE : RRSMALL);
- /*@ +shiftimplementation @*/
- n++;
- }
- len -= 5;
- m++;
+ {
+ struct b_correction_t *m = &msg->msg_type.type1.corrections[0];
+
+ while (len >= 0) {
+ if (len >= 2) {
+ tp->ranges.sat[n].ident = m->w3.satident1;
+ tp->ranges.sat[n].udre = m->w3.udre1;
+ tp->ranges.sat[n].issuedata = m->w4.issuedata1;
+ tp->ranges.sat[n].rangerr = m->w3.pc1 *
+ (m->w3.scale1 ? PCLARGE : PCSMALL);
+ tp->ranges.sat[n].rangerate = m->w4.rangerate1 *
+ (m->w3.scale1 ? RRLARGE : RRSMALL);
+ n++;
+ }
+ if (len >= 4) {
+ tp->ranges.sat[n].ident = m->w4.satident2;
+ tp->ranges.sat[n].udre = m->w4.udre2;
+ tp->ranges.sat[n].issuedata = m->w6.issuedata2;
+ tp->ranges.sat[n].rangerr = m->w5.pc2 *
+ (m->w4.scale2 ? PCLARGE : PCSMALL);
+ tp->ranges.sat[n].rangerate = m->w5.rangerate2 *
+ (m->w4.scale2 ? RRLARGE : RRSMALL);
+ n++;
}
- tp->ranges.nentries = n;
+ if (len >= 5) {
+ tp->ranges.sat[n].ident = m->w6.satident3;
+ tp->ranges.sat[n].udre = m->w6.udre3;
+ tp->ranges.sat[n].issuedata = m->w7.issuedata3;
+ /*@ -shiftimplementation @*/
+ tp->ranges.sat[n].rangerr =
+ ((m->w6.pc3_h << 8) | (m->w7.pc3_l)) *
+ (m->w6.scale3 ? PCLARGE : PCSMALL);
+ tp->ranges.sat[n].rangerate =
+ m->w7.rangerate3 * (m->w6.scale3 ? RRLARGE : RRSMALL);
+ /*@ +shiftimplementation @*/
+ n++;
+ }
+ len -= 5;
+ m++;
}
+ tp->ranges.nentries = n;
+ }
break;
case 3:
- {
- struct rtcm2_msg3 *m = &msg->msg_type.type3;
+ {
+ struct rtcm2_msg3 *m = &msg->msg_type.type3;
- if ((tp->ecef.valid = len >= 4)) {
- tp->ecef.x = ((m->w3.x_h<<8)|(m->w4.x_l))*XYZ_SCALE;
- tp->ecef.y = ((m->w4.y_h<<16)|(m->w5.y_l))*XYZ_SCALE;
- tp->ecef.z = ((m->w5.z_h<<24)|(m->w6.z_l))*XYZ_SCALE;
- }
+ if ((tp->ecef.valid = len >= 4)) {
+ tp->ecef.x = ((m->w3.x_h << 8) | (m->w4.x_l)) * XYZ_SCALE;
+ tp->ecef.y = ((m->w4.y_h << 16) | (m->w5.y_l)) * XYZ_SCALE;
+ tp->ecef.z = ((m->w5.z_h << 24) | (m->w6.z_l)) * XYZ_SCALE;
}
+ }
break;
case 4:
if ((tp->reference.valid = len >= 2)) {
- struct rtcm2_msg4 *m = &msg->msg_type.type4;
+ struct rtcm2_msg4 *m = &msg->msg_type.type4;
tp->reference.system =
- (m->w3.dgnss==0) ? NAVSYSTEM_GPS :
- ((m->w3.dgnss==1) ? NAVSYSTEM_GLONASS : NAVSYSTEM_UNKNOWN);
- tp->reference.sense = (m->w3.dat != 0) ? SENSE_GLOBAL : SENSE_LOCAL;
+ (m->w3.dgnss == 0) ? NAVSYSTEM_GPS :
+ ((m->w3.dgnss == 1) ? NAVSYSTEM_GLONASS : NAVSYSTEM_UNKNOWN);
+ tp->reference.sense =
+ (m->w3.dat != 0) ? SENSE_GLOBAL : SENSE_LOCAL;
if (m->w3.datum_alpha_char1) {
tp->reference.datum[n++] = (char)(m->w3.datum_alpha_char1);
}
@@ -171,9 +173,10 @@ void rtcm2_unpack(/*@out@*/struct rtcm2_t *tp, char *buf)
tp->reference.datum[n++] = '\0';
if (len >= 4) {
tp->reference.dx = m->w5.dx * DXYZ_SCALE;
- tp->reference.dy = ((m->w5.dy_h << 8) | m->w6.dy_l) * DXYZ_SCALE;
+ tp->reference.dy =
+ ((m->w5.dy_h << 8) | m->w6.dy_l) * DXYZ_SCALE;
tp->reference.dz = m->w6.dz * DXYZ_SCALE;
- } else
+ } else
tp->reference.sense = SENSE_INVALID;
}
break;
@@ -183,13 +186,14 @@ void rtcm2_unpack(/*@out@*/struct rtcm2_t *tp, char *buf)
struct b_health_t *m = &msg->msg_type.type5.health[n];
csp->ident = m->sat_id;
- csp->iodl = m->issue_of_data_link!=0;
+ csp->iodl = m->issue_of_data_link != 0;
csp->health = m->data_health;
- /*@i@*/csp->snr = (uint)(m->cn0?(m->cn0+CNR_OFFSET):SNR_BAD);
- csp->health_en = m->health_enable!=0;
- csp->new_data = m->new_nav_data!=0;
- csp->los_warning = m->loss_warn!=0;
- csp->tou = m->time_unhealthy*TU_SCALE;
+ /*@i@*/ csp->snr =
+ (uint) (m->cn0 ? (m->cn0 + CNR_OFFSET) : SNR_BAD);
+ csp->health_en = m->health_enable != 0;
+ csp->new_data = m->new_nav_data != 0;
+ csp->los_warning = m->loss_warn != 0;
+ csp->tou = m->time_unhealthy * TU_SCALE;
}
tp->conhealth.nentries = n;
break;
@@ -199,15 +203,18 @@ void rtcm2_unpack(/*@out@*/struct rtcm2_t *tp, char *buf)
struct b_station_t *mp = &msg->msg_type.type7.almanac[w];
np->latitude = mp->w3.lat * LA_SCALE;
- /*@i@*/np->longitude = ((mp->w3.lon_h << 8) | mp->w4.lon_l) * LO_SCALE;
+ /*@i@*/ np->longitude =
+ ((mp->w3.lon_h << 8) | mp->w4.lon_l) * LO_SCALE;
np->range = mp->w4.range;
- np->frequency = (((mp->w4.freq_h << 6) | mp->w5.freq_l) * FREQ_SCALE) + FREQ_OFFSET;
+ np->frequency =
+ (((mp->w4.freq_h << 6) | mp->w5.freq_l) * FREQ_SCALE) +
+ FREQ_OFFSET;
np->health = mp->w5.health;
np->station_id = mp->w5.station_id,
- np->bitrate = tx_speed[mp->w5.bit_rate];
+ np->bitrate = tx_speed[mp->w5.bit_rate];
n++;
}
- tp->almanac.nentries = (unsigned)(len/3);
+ tp->almanac.nentries = (unsigned)(len / 3);
break;
case 16:
/*@ -boolops @*/
@@ -230,22 +237,23 @@ void rtcm2_unpack(/*@out@*/struct rtcm2_t *tp, char *buf)
break;
default:
- memcpy(tp->words, msg->msg_type.rtcm2_msgunk, (RTCM2_WORDS_MAX-2)*sizeof(isgps30bits_t));
+ memcpy(tp->words, msg->msg_type.rtcm2_msgunk,
+ (RTCM2_WORDS_MAX - 2) * sizeof(isgps30bits_t));
break;
}
}
-bool rtcm2_repack(struct rtcm2_t *tp, isgps30bits_t *buf)
+bool rtcm2_repack(struct rtcm2_t *tp, isgps30bits_t * buf)
/* repack the content fields into the raw bits */
{
int len, sval;
unsigned int n, w, uval;
- struct rtcm2_msg_t *msg = (struct rtcm2_msg_t *)buf;
- struct rtcm2_msghw1 *wp = (struct rtcm2_msghw1 *)buf;
+ struct rtcm2_msg_t *msg = (struct rtcm2_msg_t *)buf;
+ struct rtcm2_msghw1 *wp = (struct rtcm2_msghw1 *)buf;
msg->w1.msgtype = tp->type;
msg->w2.frmlen = tp->length;
- msg->w2.zcnt = (unsigned) round(tp->zcount / ZCOUNT_SCALE);
+ msg->w2.zcnt = (unsigned)round(tp->zcount / ZCOUNT_SCALE);
msg->w1.refstaid = tp->refstaid;
msg->w2.sqnum = tp->seqnum;
msg->w2.stathlth = tp->stathlth;
@@ -253,67 +261,79 @@ bool rtcm2_repack(struct rtcm2_t *tp, isgps30bits_t *buf)
len = (int)tp->length;
n = 0;
switch (tp->type) {
- case 1: /* S */
+ case 1: /* S */
case 9:
- {
- struct b_correction_t *m = &msg->msg_type.type1.corrections[0];
-
- while (len >= 0) {
- if (len >= 2) {
- struct rangesat_t *ssp = &tp->ranges.sat[n];
- m->w3.satident1 = ssp->ident;
- m->w3.udre1 = ssp->udre;
- m->w4.issuedata1 = ssp->issuedata;
- m->w3.scale1 = (unsigned)((ssp->rangerr > MAXPCSMALL) ||
- (ssp->rangerr < (-MAXPCSMALL)) ||
- (ssp->rangerate > MAXRRSMALL) ||
- (ssp->rangerate < (-MAXRRSMALL)));
- m->w3.pc1 = (int) round(ssp->rangerr / (m->w3.scale1 ? PCLARGE : PCSMALL));
- m->w4.rangerate1 = (int) round(ssp->rangerate / (m->w3.scale1 ? RRLARGE : RRSMALL));
- n++;
- }
- if (len >= 4) {
- struct rangesat_t *ssp = &tp->ranges.sat[n];
- m->w4.satident2 = ssp->ident;
- m->w4.udre2 = ssp->udre;
- m->w6.issuedata2 = ssp->issuedata;
- m->w4.scale2 = (unsigned)((ssp->rangerr > MAXPCSMALL) ||
- (ssp->rangerr < (-MAXPCSMALL)) ||
- (ssp->rangerate > MAXRRSMALL) ||
- (ssp->rangerate < (-MAXRRSMALL)));
- m->w5.pc2 = (int) round(ssp->rangerr / (m->w4.scale2 ? PCLARGE : PCSMALL));
- m->w5.rangerate2 = (int) round(ssp->rangerate / (m->w4.scale2 ? RRLARGE : RRSMALL));
- n++;
- }
- if (len >= 5) {
- struct rangesat_t *ssp = &tp->ranges.sat[n];
- m->w6.satident3 = ssp->ident;
- m->w6.udre3 = ssp->udre;
- m->w7.issuedata3 = ssp->issuedata;
- m->w6.scale3 = (unsigned)((ssp->rangerr > MAXPCSMALL) ||
- (ssp->rangerr < (-MAXPCSMALL)) ||
- (ssp->rangerate > MAXRRSMALL) ||
- (ssp->rangerate < (-MAXRRSMALL)));
- sval = (int) round(ssp->rangerr / (m->w6.scale3 ? PCLARGE : PCSMALL));
- /*@ -shiftimplementation @*/
- m->w6.pc3_h = sval >> 8;
- /*@ +shiftimplementation @*/
- m->w7.pc3_l = (unsigned)sval & 0xff;
- m->w7.rangerate3 = (int) round(ssp->rangerate / (m->w6.scale3 ? RRLARGE : RRSMALL));
- n++;
- }
- len -= 5;
- m++;
+ {
+ struct b_correction_t *m = &msg->msg_type.type1.corrections[0];
+
+ while (len >= 0) {
+ if (len >= 2) {
+ struct rangesat_t *ssp = &tp->ranges.sat[n];
+ m->w3.satident1 = ssp->ident;
+ m->w3.udre1 = ssp->udre;
+ m->w4.issuedata1 = ssp->issuedata;
+ m->w3.scale1 = (unsigned)((ssp->rangerr > MAXPCSMALL) ||
+ (ssp->rangerr < (-MAXPCSMALL)) ||
+ (ssp->rangerate > MAXRRSMALL) ||
+ (ssp->rangerate < (-MAXRRSMALL)));
+ m->w3.pc1 =
+ (int)round(ssp->rangerr /
+ (m->w3.scale1 ? PCLARGE : PCSMALL));
+ m->w4.rangerate1 =
+ (int)round(ssp->rangerate /
+ (m->w3.scale1 ? RRLARGE : RRSMALL));
+ n++;
}
- tp->ranges.nentries = n;
+ if (len >= 4) {
+ struct rangesat_t *ssp = &tp->ranges.sat[n];
+ m->w4.satident2 = ssp->ident;
+ m->w4.udre2 = ssp->udre;
+ m->w6.issuedata2 = ssp->issuedata;
+ m->w4.scale2 = (unsigned)((ssp->rangerr > MAXPCSMALL) ||
+ (ssp->rangerr < (-MAXPCSMALL)) ||
+ (ssp->rangerate > MAXRRSMALL) ||
+ (ssp->rangerate < (-MAXRRSMALL)));
+ m->w5.pc2 =
+ (int)round(ssp->rangerr /
+ (m->w4.scale2 ? PCLARGE : PCSMALL));
+ m->w5.rangerate2 =
+ (int)round(ssp->rangerate /
+ (m->w4.scale2 ? RRLARGE : RRSMALL));
+ n++;
+ }
+ if (len >= 5) {
+ struct rangesat_t *ssp = &tp->ranges.sat[n];
+ m->w6.satident3 = ssp->ident;
+ m->w6.udre3 = ssp->udre;
+ m->w7.issuedata3 = ssp->issuedata;
+ m->w6.scale3 = (unsigned)((ssp->rangerr > MAXPCSMALL) ||
+ (ssp->rangerr < (-MAXPCSMALL)) ||
+ (ssp->rangerate > MAXRRSMALL) ||
+ (ssp->rangerate < (-MAXRRSMALL)));
+ sval =
+ (int)round(ssp->rangerr /
+ (m->w6.scale3 ? PCLARGE : PCSMALL));
+ /*@ -shiftimplementation @*/
+ m->w6.pc3_h = sval >> 8;
+ /*@ +shiftimplementation @*/
+ m->w7.pc3_l = (unsigned)sval & 0xff;
+ m->w7.rangerate3 =
+ (int)round(ssp->rangerate /
+ (m->w6.scale3 ? RRLARGE : RRSMALL));
+ n++;
+ }
+ len -= 5;
+ m++;
}
+ tp->ranges.nentries = n;
+ }
break;
- case 3: /* R */
+ case 3: /* R */
if (tp->ecef.valid) {
- struct rtcm2_msg3 *m = &msg->msg_type.type3;
- unsigned x = (unsigned) round(tp->ecef.x / XYZ_SCALE);
- unsigned y = (unsigned) round(tp->ecef.y / XYZ_SCALE);
- unsigned z = (unsigned) round(tp->ecef.z / XYZ_SCALE);
+ struct rtcm2_msg3 *m = &msg->msg_type.type3;
+ unsigned x = (unsigned)round(tp->ecef.x / XYZ_SCALE);
+ unsigned y = (unsigned)round(tp->ecef.y / XYZ_SCALE);
+ unsigned z = (unsigned)round(tp->ecef.z / XYZ_SCALE);
m->w4.x_l = x & 0xff;
m->w3.x_h = x >> 8;
@@ -323,9 +343,9 @@ bool rtcm2_repack(struct rtcm2_t *tp, isgps30bits_t *buf)
m->w5.z_h = z >> 24;
}
break;
- case 4: /* D */
+ case 4: /* D */
if (tp->reference.valid) {
- struct rtcm2_msg4 *m = &msg->msg_type.type4;
+ struct rtcm2_msg4 *m = &msg->msg_type.type4;
m->w3.dgnss = (unsigned)tp->reference.system;
m->w3.dat = (unsigned)(tp->reference.sense == SENSE_GLOBAL);
@@ -352,15 +372,15 @@ bool rtcm2_repack(struct rtcm2_t *tp, isgps30bits_t *buf)
m->w4.datum_sub_div_char3 = 0;
/*@ +predboolothers +type @*/
if (tp->reference.system != NAVSYSTEM_UNKNOWN) {
- m->w5.dx = (uint)round(tp->reference.dx / DXYZ_SCALE);
- uval = (uint)round(tp->reference.dy / DXYZ_SCALE);
+ m->w5.dx = (uint) round(tp->reference.dx / DXYZ_SCALE);
+ uval = (uint) round(tp->reference.dy / DXYZ_SCALE);
m->w5.dy_h = uval >> 8;
m->w6.dy_l = uval & 0xff;
- m->w6.dz = (uint)round(tp->reference.dz / DXYZ_SCALE);
+ m->w6.dz = (uint) round(tp->reference.dz / DXYZ_SCALE);
}
}
break;
- case 5: /* C */
+ case 5: /* C */
for (n = 0; n < (unsigned)len; n++) {
struct consat_t *csp = &tp->conhealth.sat[n];
struct b_health_t *m = &msg->msg_type.type5.health[n];
@@ -368,32 +388,36 @@ bool rtcm2_repack(struct rtcm2_t *tp, isgps30bits_t *buf)
m->sat_id = csp->ident;
m->issue_of_data_link = (unsigned)csp->iodl;
m->data_health = csp->health;
- m->cn0 = (csp->snr == SNR_BAD) ? 0 : (unsigned)csp->snr-CNR_OFFSET;
+ m->cn0 =
+ (csp->snr == SNR_BAD) ? 0 : (unsigned)csp->snr - CNR_OFFSET;
m->health_enable = (unsigned)csp->health_en;
m->new_nav_data = (unsigned)csp->new_data;
m->loss_warn = (unsigned)csp->los_warning;
m->time_unhealthy = (unsigned)(csp->tou / TU_SCALE);
}
break;
- case 7: /* A */
- for (w = 0; w < (RTCM2_WORDS_MAX - 2)/ 3; w++) {
+ case 7: /* A */
+ for (w = 0; w < (RTCM2_WORDS_MAX - 2) / 3; w++) {
struct station_t *np = &tp->almanac.station[n++];
struct b_station_t *mp = &msg->msg_type.type7.almanac[w];
- mp->w3.lat = (int) round(np->latitude / LA_SCALE);
- sval = (int) round(np->longitude / LO_SCALE);
+ mp->w3.lat = (int)round(np->latitude / LA_SCALE);
+ sval = (int)round(np->longitude / LO_SCALE);
/*@ -shiftimplementation @*/
mp->w3.lon_h = sval >> 8;
/*@ +shiftimplementation @*/
mp->w4.lon_l = (unsigned)sval & 0xff;
mp->w4.range = np->range;
- uval = (unsigned) round(((np->frequency-FREQ_OFFSET) / FREQ_SCALE));
+ uval =
+ (unsigned)round(((np->frequency - FREQ_OFFSET) / FREQ_SCALE));
mp->w4.freq_h = uval >> 6;
mp->w5.freq_l = uval & 0x3f;
mp->w5.health = np->health;
mp->w5.station_id = np->station_id;
mp->w5.bit_rate = 0;
- for (uval = 0; uval < (unsigned)(sizeof(tx_speed)/sizeof(tx_speed[0])); uval++)
+ for (uval = 0;
+ uval < (unsigned)(sizeof(tx_speed) / sizeof(tx_speed[0]));
+ uval++)
if (tx_speed[uval] == np->bitrate) {
mp->w5.bit_rate = uval;
break;
@@ -403,7 +427,7 @@ bool rtcm2_repack(struct rtcm2_t *tp, isgps30bits_t *buf)
}
tp->almanac.nentries = n;
break;
- case 16: /* T */
+ case 16: /* T */
/*@ -boolops @*/
for (w = 0; w < RTCM2_WORDS_MAX - 2; w++) {
if (!tp->message[n]) {
@@ -419,12 +443,13 @@ bool rtcm2_repack(struct rtcm2_t *tp, isgps30bits_t *buf)
}
msg->msg_type.type16.txt[w].byte3 = (unsigned)tp->message[n++];
}
- msg->w2.frmlen = w+1;
+ msg->w2.frmlen = w + 1;
/*@ +boolops @*/
break;
- default: /* U */
- memcpy(msg->msg_type.rtcm2_msgunk, tp->words, (RTCM2_WORDS_MAX-2)*sizeof(isgps30bits_t));
+ default: /* U */
+ memcpy(msg->msg_type.rtcm2_msgunk, tp->words,
+ (RTCM2_WORDS_MAX - 2) * sizeof(isgps30bits_t));
break;
}
@@ -436,38 +461,34 @@ bool rtcm2_repack(struct rtcm2_t *tp, isgps30bits_t *buf)
return true;
}
-static bool preamble_match(isgps30bits_t *w)
+static bool preamble_match(isgps30bits_t * w)
{
return (((struct rtcm2_msghw1 *)w)->preamble == PREAMBLE_PATTERN);
}
static bool length_check(struct gps_packet_t *lexer)
{
- return lexer->isgps.bufindex >= 2
- && lexer->isgps.bufindex >= ((struct rtcm2_msg_t *)lexer->isgps.buf)->w2.frmlen + 2u;
+ return lexer->isgps.bufindex >= 2
+ && lexer->isgps.bufindex >=
+ ((struct rtcm2_msg_t *)lexer->isgps.buf)->w2.frmlen + 2u;
}
enum isgpsstat_t rtcm2_decode(struct gps_packet_t *lexer, unsigned int c)
{
- return isgps_decode(lexer,
- preamble_match,
- length_check,
- RTCM2_WORDS_MAX,
- c);
+ return isgps_decode(lexer,
+ preamble_match, length_check, RTCM2_WORDS_MAX, c);
}
-void rtcm2_sager_dump(const struct rtcm2_t *rtcm, /*@out@*/char buf[], size_t buflen)
+void rtcm2_sager_dump(const struct rtcm2_t *rtcm, /*@out@*/ char buf[],
+ size_t buflen)
/* dump the contents of a parsed RTCM104 message */
{
unsigned int n;
(void)snprintf(buf, buflen, "H\t%u\t%u\t%0.1f\t%u\t%u\t%u\n",
- rtcm->type,
- rtcm->refstaid,
- rtcm->zcount,
- rtcm->seqnum,
- rtcm->length,
- rtcm->stathlth);
+ rtcm->type,
+ rtcm->refstaid,
+ rtcm->zcount, rtcm->seqnum, rtcm->length, rtcm->stathlth);
switch (rtcm->type) {
case 1:
@@ -479,9 +500,7 @@ void rtcm2_sager_dump(const struct rtcm2_t *rtcm, /*@out@*/char buf[], size_t bu
rsp->ident,
rsp->udre,
rsp->issuedata,
- rtcm->zcount,
- rsp->rangerr,
- rsp->rangerate);
+ rtcm->zcount, rsp->rangerr, rsp->rangerate);
}
break;
@@ -489,22 +508,18 @@ void rtcm2_sager_dump(const struct rtcm2_t *rtcm, /*@out@*/char buf[], size_t bu
if (rtcm->ecef.valid)
(void)snprintf(buf + strlen(buf), buflen - strlen(buf),
"R\t%.2f\t%.2f\t%.2f\n",
- rtcm->ecef.x,
- rtcm->ecef.y,
- rtcm->ecef.z);
+ rtcm->ecef.x, rtcm->ecef.y, rtcm->ecef.z);
break;
case 4:
if (rtcm->reference.valid)
(void)snprintf(buf + strlen(buf), buflen - strlen(buf),
"D\t%s\t%1d\t%s\t%.1f\t%.1f\t%.1f\n",
- (rtcm->reference.system==NAVSYSTEM_GPS) ? "GPS"
- : ((rtcm->reference.system==NAVSYSTEM_GLONASS) ? "GLONASS"
- : "UNKNOWN"),
- rtcm->reference.sense,
- rtcm->reference.datum,
- rtcm->reference.dx,
- rtcm->reference.dy,
+ (rtcm->reference.system == NAVSYSTEM_GPS) ? "GPS"
+ : ((rtcm->reference.system ==
+ NAVSYSTEM_GLONASS) ? "GLONASS" : "UNKNOWN"),
+ rtcm->reference.sense, rtcm->reference.datum,
+ rtcm->reference.dx, rtcm->reference.dy,
rtcm->reference.dz);
break;
@@ -519,12 +534,11 @@ void rtcm2_sager_dump(const struct rtcm2_t *rtcm, /*@out@*/char buf[], size_t bu
csp->snr,
(unsigned)csp->health_en,
(unsigned)csp->new_data,
- (unsigned)csp->los_warning,
- csp->tou);
+ (unsigned)csp->los_warning, csp->tou);
}
break;
- case 6: /* NOP msg */
+ case 6: /* NOP msg */
(void)strlcat(buf, "N\n", buflen);
break;
@@ -537,9 +551,7 @@ void rtcm2_sager_dump(const struct rtcm2_t *rtcm, /*@out@*/char buf[], size_t bu
ssp->longitude,
ssp->range,
ssp->frequency,
- ssp->health,
- ssp->station_id,
- ssp->bitrate);
+ ssp->health, ssp->station_id, ssp->bitrate);
}
break;
case 16: