diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2010-04-25 23:14:06 -0400 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2010-04-25 23:14:06 -0400 |
commit | ea4a0e6359d76ae4ce182b2dc725a5833d66b7d1 (patch) | |
tree | 30576078df8a311eb675666bf63d43d3e9bd18e2 /driver_rtcm2.c | |
parent | fd0d28646098dead8027b521287b9b41afaf022d (diff) | |
download | gpsd-ea4a0e6359d76ae4ce182b2dc725a5833d66b7d1.tar.gz |
Give up on RTCM2 repack support. It's broken, and unlikely ever to be needed.
Diffstat (limited to 'driver_rtcm2.c')
-rw-r--r-- | driver_rtcm2.c | 218 |
1 files changed, 0 insertions, 218 deletions
diff --git a/driver_rtcm2.c b/driver_rtcm2.c index c680cf43..a8941df4 100644 --- a/driver_rtcm2.c +++ b/driver_rtcm2.c @@ -245,224 +245,6 @@ void rtcm2_unpack( /*@out@*/ struct rtcm2_t *tp, char *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; - - msg->w1.msgtype = tp->type; - msg->w2.frmlen = tp->length; - msg->w2.zcnt = (unsigned)round(tp->zcount / ZCOUNT_SCALE); - msg->w1.refstaid = tp->refstaid; - msg->w2.sqnum = tp->seqnum; - msg->w2.stathlth = tp->stathlth; - - len = (int)tp->length; - n = 0; - switch (tp->type) { - 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++; - } - tp->ranges.nentries = n; - } - break; - 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); - - m->w4.x_l = x & 0xff; - m->w3.x_h = x >> 8; - m->w5.y_l = y & 0xffff; - m->w4.y_h = y >> 16; - m->w6.z_l = z & 0xffffff; - m->w5.z_h = z >> 24; - } - break; - case 4: /* D */ - if (tp->reference.valid) { - struct rtcm2_msg4 *m = &msg->msg_type.type4; - - m->w3.dgnss = (unsigned)tp->reference.system; - m->w3.dat = (unsigned)(tp->reference.sense == SENSE_GLOBAL); - /*@ -predboolothers -type @*/ - if (tp->reference.datum[0]) - m->w3.datum_alpha_char1 = tp->reference.datum[0]; - else - m->w3.datum_alpha_char1 = 0; - if (tp->reference.datum[1]) - m->w3.datum_alpha_char2 = tp->reference.datum[1]; - else - m->w3.datum_alpha_char2 = 0; - if (tp->reference.datum[2]) - m->w4.datum_sub_div_char1 = tp->reference.datum[2]; - else - m->w4.datum_sub_div_char1 = 0; - if (tp->reference.datum[3]) - m->w4.datum_sub_div_char2 = tp->reference.datum[3]; - else - m->w4.datum_sub_div_char2 = 0; - if (tp->reference.datum[4]) - m->w4.datum_sub_div_char3 = tp->reference.datum[4]; - else - 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.dy_h = uval >> 8; - m->w6.dy_l = uval & 0xff; - m->w6.dz = (uint) round(tp->reference.dz / DXYZ_SCALE); - } - } - break; - 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]; - - 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->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++) { - 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); - /*@ -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)); - 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++) - if (tx_speed[uval] == np->bitrate) { - mp->w5.bit_rate = uval; - break; - } - if (mp->w5.bit_rate == 0) - return false; - } - tp->almanac.nentries = n; - break; - case 16: /* T */ - /*@ -boolops @*/ - for (w = 0; w < RTCM2_WORDS_MAX - 2; w++) { - if (!tp->message[n]) { - break; - } - msg->msg_type.type16.txt[w].byte1 = (unsigned)tp->message[n++]; - if (!tp->message[n]) { - break; - } - msg->msg_type.type16.txt[w].byte2 = (unsigned)tp->message[n++]; - if (!tp->message[n]) { - break; - } - msg->msg_type.type16.txt[w].byte3 = (unsigned)tp->message[n++]; - } - msg->w2.frmlen = w + 1; - /*@ +boolops @*/ - break; - - default: /* U */ - memcpy(msg->msg_type.rtcm2_msgunk, tp->words, - (RTCM2_WORDS_MAX - 2) * sizeof(isgps30bits_t)); - break; - } - - /* compute parity for each word in the message */ - for (w = 0; w < tp->length; w++) - wp[w].parity = isgps_parity(buf[w]); - - /* FIXME: must do inversion here */ - return true; -} - static bool preamble_match(isgps30bits_t * w) { return (((struct rtcm2_msghw1 *)w)->preamble == PREAMBLE_PATTERN); |