Lines Matching +full:v +full:- +full:pos +full:- +full:supply
2 * $Id: refclock_ripencc.c,v 1.13 2002/06/18 14:20:55 marks Exp marks $
29 * using the code made available by Trimble. This was for xntpd-3.x.x
31 * Rewrite of the driver for ntpd-4.x.x by Mark Santcroos <marks@ripe.net>
98 #define PRECISION (-9) /* precision assumed (about 2 ms) */
99 #define PPS_PRECISION (-20) /* precision assumed (about 1 us) */
242 *NavModeText0xBB[] = {"automatic", "time only (0-D)", "", "2-D",
243 "3-D", "", "", "OverDetermined Time"},
248 "Ext Event", "Pos Fix ", "Raw Meas "};
387 /* prototypes for command-encode primitives with suffix convention: */
462 * ripencc_start - open the GPS devices and initialize data for processing
474 pp = peer->procptr;
480 fd = refclock_open(&peer->srcadr, device, SPEED232, LDISC_RAW);
482 pp->io.fd = -1;
486 pp->io.fd = fd;
499 if (tcsetattr(fd, TCSANOW, &tio) == -1) {
509 pp->io.clock_recv = ripencc_receive;
510 pp->io.srcclock = peer;
511 pp->io.datalen = 0;
512 if (!io_addclock(&pp->io)) {
513 pp->io.fd = -1;
518 pp->unitptr = up;
523 peer->precision = PRECISION;
524 pp->clockdesc = DESCRIPTION;
525 memcpy((char *)&pp->refid, REFID, REFID_LEN);
526 up->pollcnt = 2;
527 up->unit = unit;
528 up->leapdelta = 0;
529 up->utcflags = 0;
575 1e-6 * GPS_C); /* turn of biasuncert. > (1us) */
605 if (time_pps_create(fd, &up->handle) < 0) {
606 up->handle = 0;
615 * ripencc_control - fudge control
631 pp = peer->procptr;
632 ripencc_ppsapi(peer, pp->sloppyclockflag & CLK_FLAG2,
633 pp->sloppyclockflag & CLK_FLAG3);
651 pp = peer->procptr;
652 up = pp->unitptr;
653 if (time_pps_getcap(up->handle, &capability) < 0) {
658 memset(&up->pps_params, 0, sizeof(pps_params_t));
660 up->pps_params.mode = capability & PPS_CAPTURECLEAR;
662 up->pps_params.mode = capability & PPS_CAPTUREASSERT;
663 if (!up->pps_params.mode) {
669 up->pps_params.mode |= PPS_TSFMT_TSPEC;
670 if (time_pps_setparams(up->handle, &up->pps_params) < 0) {
676 if (time_pps_kcbind(up->handle, PPS_KC_HARDPPS,
677 up->pps_params.mode & ~PPS_TSFMT_TSPEC,
685 peer->precision = PPS_PRECISION;
689 time_pps_getparams(up->handle, &up->pps_params);
692 capability, up->pps_params.api_version,
693 up->pps_params.mode, enb_hardpps);
725 if (up->handle == 0)
729 memcpy(&pps_info, &up->pps_info, sizeof(pps_info_t));
730 if (time_pps_fetch(up->handle, PPS_TSFMT_TSPEC, &up->pps_info,
733 if (up->pps_params.mode & PPS_CAPTUREASSERT) {
735 up->pps_info.assert_sequence)
737 ts = up->pps_info.assert_timestamp;
738 } else if (up->pps_params.mode & PPS_CAPTURECLEAR) {
740 up->pps_info.clear_sequence)
742 ts = up->pps_info.clear_timestamp;
746 if ((up->ts.tv_sec == ts.tv_sec) && (up->ts.tv_nsec == ts.tv_nsec))
748 up->ts = ts;
764 * ripencc_shutdown - shut down a GPS clock
772 pp = peer->procptr;
773 up = pp->unitptr;
776 if (up->handle != 0)
777 time_pps_destroy(up->handle);
780 if (-1 != pp->io.fd)
781 io_closeclock(&pp->io);
787 * ripencc_poll - called by the transmit procedure
800 pp = peer->procptr;
801 up = pp->unitptr;
802 if (up->pollcnt == 0)
805 up->pollcnt--;
807 pp->polls++;
808 up->polled = 1;
816 * ripencc_send - send message to clock
831 pp = peer->procptr;
832 up = pp->unitptr;
834 printf("ripencc_send(%d, %02X)\n", up->unit, cmd);
844 while (spt.len--) {
845 if (op-obuf > sizeof(obuf)-5) {
864 printf("ripencc_send: len %d\n", op-obuf);
874 if (write(peer->procptr->io.fd, obuf, op-obuf) == -1) {
907 peer = rbufp->recv_peer;
908 pp = peer->procptr;
909 up = pp->unitptr;
914 fprintf(stderr, "ripencc_receive(%d)\n", up->unit);
922 printf("ripencc_receive: len %d\n", rbufp->recv_length);
923 for (i=1, cp=(char*)&rbufp->recv_space;
924 i <= rbufp->recv_length;
934 cp = (char*) &rbufp->recv_space;
935 i=rbufp->recv_length;
937 while (i--) { /* loop over received chars */
960 ** More elegant would be to re-schedule the
966 /* if (up->polled && ns_since_pps > -1 && ns_since_pps < 150) { */
969 if (up->polled && ns_since_pps < 150) {
970 msyslog(LOG_INFO, "%s(): up->polled",
972 ripencc_poll(up->unit, peer);
993 pp->lastrec = up->tstamp = rd_tmp;
994 pp->nsec = 0;
1000 if (!up->polled) {
1007 up->polled = 0;
1008 up->pollcnt = 2;
1079 cmd->len = 0;
1080 cmd->code = 0x1F;
1089 cmd->len = 0;
1090 cmd->code = 0x26;
1099 cmd->len = 0;
1100 cmd->code = 0x2F;
1113 cmd->buf[0] = pos_code;
1114 cmd->buf[1] = vel_code;
1115 cmd->buf[2] = time_code;
1116 cmd->buf[3] = opts_code;
1117 cmd->len = 4;
1118 cmd->code = 0x35;
1128 cmd->buf[0] = sv_prn;
1129 cmd->len = 1;
1130 cmd->code = 0x3C;
1133 /* set Channel A configuration for dual-port operation */
1145 cmd->buf[0] = baud_out; /* XMT baud rate */
1146 cmd->buf[1] = baud_inp; /* RCV baud rate */
1147 cmd->buf[2] = char_code; /* parity and #bits per byte */
1148 cmd->buf[3] = stopbitcode; /* number of stop bits code */
1149 cmd->buf[4] = output_mode; /* Ch. A transmission mode */
1150 cmd->buf[5] = input_mode; /* Ch. A reception mode */
1151 cmd->len = 6;
1152 cmd->code = 0x3D;
1163 cmd->len = 1;
1164 cmd->code = 0xBB;
1165 cmd->buf[0] = subcode;
1170 /* 8E-0B to query 8F-0B controls */
1176 cmd->len = 1;
1177 cmd->code = 0x8E;
1178 cmd->buf[0] = 0x0B;
1182 /* 8F-41 to query board serial number */
1188 cmd->len = 1;
1189 cmd->code = 0x8E;
1190 cmd->buf[0] = 0x41;
1194 /* 8F-42 to query product serial number */
1200 cmd->len = 1;
1201 cmd->code = 0x8E;
1202 cmd->buf[0] = 0x42;
1206 /* 8F-4A to query PPS parameters */
1212 cmd->len = 1;
1213 cmd->code = 0x8E;
1214 cmd->buf[0] = 0x4A;
1229 cmd->len = 16;
1230 cmd->code = 0x8E;
1231 cmd->buf[0] = 0x4A;
1232 cmd->buf[1] = PPSOnOff;
1233 cmd->buf[2] = TimeBase;
1234 cmd->buf[3] = Polarity;
1235 bPutDouble (&PPSOffset, &cmd->buf[4]);
1236 bPutFloat (&Uncertainty, &cmd->buf[12]);
1239 /* 8F-4B query survey limit */
1245 cmd->len = 1;
1246 cmd->code = 0x8E;
1247 cmd->buf[0] = 0x4B;
1251 /* 8E-AD to query 8F-AD controls */
1257 cmd->len = 1;
1258 cmd->code = 0x8E;
1259 cmd->buf[0] = 0xAD;
1269 cmd->len = 5;
1270 cmd->code = 0x8E;
1271 cmd->buf[0] = 0x4D;
1272 bPutULong (&AutoOutputMask, &cmd->buf[1]);
1290 *optr-- = *bp++;
1305 *optr-- = *bp++;
1319 *optr-- = *bp++;
1320 *optr-- = *bp++;
1321 *optr-- = *bp++;
1335 *optr-- = *bp++;
1336 *optr-- = *bp++;
1337 *optr-- = *bp++;
1352 *optr-- = *bp++;
1353 *optr-- = *bp++;
1354 *optr-- = *bp++;
1368 *optr-- = *bp++;
1369 *optr-- = *bp++;
1370 *optr-- = *bp++;
1371 *optr-- = *bp++;
1372 *optr-- = *bp++;
1373 *optr-- = *bp++;
1374 *optr-- = *bp++;
1389 * Byte-reversal is necessary for little-endian (Intel-based) machines.
1390 * TSIP streams are Big-endian (Motorola-based).
1403 *out++ = *inptr--;
1404 *out++ = *inptr--;
1405 *out++ = *inptr--;
1418 *out++ = *inptr--;
1419 *out++ = *inptr--;
1420 *out++ = *inptr--;
1433 *out++ = *inptr--;
1434 *out++ = *inptr--;
1435 *out++ = *inptr--;
1436 *out++ = *inptr--;
1437 *out++ = *inptr--;
1438 *out++ = *inptr--;
1439 *out++ = *inptr--;
1458 * -1 = errors
1478 buf = rpt->buf;
1479 pp = peer->procptr;
1481 if (rpt->len != 22)
1482 return (-1);
1489 return(-1);
1497 return(-1);
1518 record_clock_stats(&peer->srcadr, logbuf);
1521 return(-1);
1524 up = (struct ripencc_unit *) pp->unitptr;
1525 if (utcflags != up->utcflags) {
1529 up->utcflags = utcflags;
1535 * No offense, just defense ;-).
1538 return(-1);
1542 pp->year = year;
1544 return(-1);
1546 if (pp->year % 4) { /* XXX: use is_leapyear() ? */
1547 if (day > day1tab[month - 1])
1548 return(-1);
1549 for (i = 0; i < month - 1; i++)
1552 if (day > day2tab[month - 1])
1553 return(-1);
1554 for (i = 0; i < month - 1; i++)
1557 pp->day = day;
1558 pp->hour = hour;
1559 pp->minute = minute;
1560 pp-> second = second;
1561 pp->nsec = 0;
1563 if ((utcflags&UTCF_LEAP_PNDG) && up->leapdelta != 0)
1564 pp-> leap = (up->leapdelta > 0)
1568 pp-> leap = LEAP_NOWARNING;
1577 * -1 = errors
1606 buf = rpt->buf;
1607 pp = peer->procptr;
1609 if (rpt->len != 74)
1610 return (-1);
1613 return(-1);;
1617 if (tow == -1.0) {
1618 return(-1);
1621 return(-1);
1646 lat = -lat;
1652 lat_min = (lat - lat_deg) * 60.0;
1656 lon = -lon;
1663 lon_min = (lon - lon_deg) * 60.0;
1669 b = (unsigned char) (sv[i]<0 ? -sv[i] : sv[i]);
1688 record_clock_stats(&peer->srcadr, logbuf);
1710 record_clock_stats(&peer->srcadr, &logbuf[1]);
1722 * -1 = errors
1740 buf = rpt->buf;
1742 if (rpt->len != 26)
1743 return (-1);
1754 dt_lsf - dt_ls, dt_ls, dt_lsf, a0, a1, tot, wn_t, wn_lsf, dn);
1761 record_clock_stats(&peer->srcadr, logbuf);
1763 up = (struct ripencc_unit *) peer->procptr->unitptr;
1764 up->leapdelta = dt_lsf - dt_ls;
1773 * -1 = errors
1788 buf = rpt->buf;
1790 if (rpt->len != 24)
1791 return(-1);
1813 record_clock_stats(&peer->srcadr, logbuf);
1827 * Sunnyvale, California 94088-3642
1830 * Telephone: (408) 481-8000
1831 * Fax: (408) 481-6005
1834 * Telephone: (800) 767-4822 (U.S. and Canada)
1835 * (408) 481-6940 (outside U.S. and Canada)
1836 * Fax: (408) 481-6020
1837 * BBS: (408) 481-7800
1838 * e-mail: trimble_support@trimble.com
1843 * ------- BYTE-SWAPPING -------
1844 * TSIP is big-endian (Motorola) protocol. To use on little-endian (Intel)
1845 * systems, the bytes of all multi-byte types (shorts, floats, doubles, etc.)
1847 * assumes little-endian protocol.
1848 * --------------------------------
1897 switch (rpt->status)
1905 rpt->len = 0;
1906 rpt->status = TSIP_PARSED_EMPTY;
1910 rpt->len = 0;
1911 rpt->status = TSIP_PARSED_DLE_1;
1915 rpt->code = newbyte;
1916 rpt->len = 0;
1917 rpt->status = TSIP_PARSED_DATA;
1925 rpt->status = TSIP_PARSED_DLE_2;
1929 rpt->buf[rpt->len] = newbyte;
1930 rpt->len++;
1931 /* no change in rpt->status */
1939 rpt->buf[rpt->len] = newbyte;
1940 rpt->len++;
1941 rpt->status = TSIP_PARSED_DATA;
1945 rpt->status = TSIP_PARSED_FULL;
1949 rpt->code = newbyte;
1950 rpt->len = 0;
1951 rpt->status = TSIP_PARSED_DATA;
1960 rpt->len = 0;
1961 rpt->status = TSIP_PARSED_DLE_1;
1965 rpt->len = 0;
1966 rpt->status = TSIP_PARSED_EMPTY;
1970 if (rpt->len > MAX_RPTBUF) {
1972 rpt->status = TSIP_PARSED_EMPTY;
1973 rpt->len = 0;
1993 buf = rpt->buf;
1995 if (rpt->len != 6) return TRUE;
2024 buf = rpt->buf;
2026 if (rpt->len != 39) return TRUE;
2051 buf = rpt->buf;
2053 if (rpt->len != 10) return TRUE;
2069 buf = rpt->buf;
2071 if (rpt->len != 16) return TRUE;
2089 buf = rpt->buf;
2091 if (rpt->len != 20) return TRUE;
2117 buf = rpt->buf;
2119 if (rpt->len != 10) return TRUE;
2142 buf = rpt->buf;
2144 if (rpt->len != 2) return TRUE;
2161 buf = rpt->buf;
2163 if (rpt->len != 1 + 5*buf[0]) return TRUE;
2180 buf = rpt->buf;
2182 if (rpt->len != 22) return TRUE;
2197 buf = rpt->buf;
2199 if (rpt->len != 32) return TRUE;
2204 /* position in lat-lon-alt, single precision */
2216 buf = rpt->buf;
2218 if (rpt->len != 20) return TRUE;
2238 buf = rpt->buf;
2240 if (rpt->len != 9) return TRUE;
2257 buf = rpt->buf;
2259 if (rpt->len != 3) return TRUE;
2278 buf = rpt->buf;
2280 if (rpt->len != 17) return TRUE;
2297 buf = rpt->buf;
2299 if (rpt->len != 4) return TRUE;
2312 buf = rpt->buf;
2314 if (rpt->len != 1) return TRUE;
2334 buf = rpt->buf;
2336 if (rpt->len != 26) return TRUE;
2349 /* clock offset and frequency offset in 1-SV (0-D) mode */
2359 buf = rpt->buf;
2361 if (rpt->len != 12) return TRUE;
2379 buf = rpt->buf;
2381 if (rpt->len != 4) return TRUE;
2389 /* velocity in east-north-up coordinates */
2399 buf = rpt->buf;
2401 if (rpt->len != 20) return TRUE;
2424 buf = rpt->buf;
2426 if (rpt->len != 8) return TRUE;
2452 buf = rpt->buf;
2455 if (rpt->len < 4) return TRUE;
2456 if (rpt->len != 4+buf[3]) return TRUE;
2458 else if (rpt->len != 3) {
2473 alminfo->t_oa_raw = buf4[0];
2474 alminfo->SV_health = buf4[1];
2475 alminfo->e = bGetSingle(&buf4[2]);
2476 alminfo->t_oa = bGetSingle(&buf4[6]);
2477 alminfo->i_0 = bGetSingle(&buf4[10]);
2478 alminfo->OMEGADOT = bGetSingle(&buf4[14]);
2479 alminfo->sqrt_A = bGetSingle(&buf4[18]);
2480 alminfo->OMEGA_0 = bGetSingle(&buf4[22]);
2481 alminfo->omega = bGetSingle(&buf4[26]);
2482 alminfo->M_0 = bGetSingle(&buf4[30]);
2483 alminfo->a_f0 = bGetSingle(&buf4[34]);
2484 alminfo->a_f1 = bGetSingle(&buf4[38]);
2485 alminfo->Axis = bGetSingle(&buf4[42]);
2486 alminfo->n = bGetSingle(&buf4[46]);
2487 alminfo->OMEGA_n = bGetSingle(&buf4[50]);
2488 alminfo->ODOT_n = bGetSingle(&buf4[54]);
2489 alminfo->t_zc = bGetSingle(&buf4[58]);
2490 alminfo->weeknum = bGetShort(&buf4[62]);
2491 alminfo->wn_oa = bGetShort(&buf4[64]);
2506 ioninfo->alpha_0 = bGetSingle (&buf4[8]);
2507 ioninfo->alpha_1 = bGetSingle (&buf4[12]);
2508 ioninfo->alpha_2 = bGetSingle (&buf4[16]);
2509 ioninfo->alpha_3 = bGetSingle (&buf4[20]);
2510 ioninfo->beta_0 = bGetSingle (&buf4[24]);
2511 ioninfo->beta_1 = bGetSingle (&buf4[28]);
2512 ioninfo->beta_2 = bGetSingle (&buf4[32]);
2513 ioninfo->beta_3 = bGetSingle (&buf4[36]);
2520 utcinfo->A_0 = bGetDouble (&buf4[13]);
2521 utcinfo->A_1 = bGetSingle (&buf4[21]);
2522 utcinfo->delta_t_LS = bGetShort (&buf4[25]);
2523 utcinfo->t_ot = bGetSingle(&buf4[27]);
2524 utcinfo->WN_t = bGetShort (&buf4[31]);
2525 utcinfo->WN_LSF = bGetShort (&buf4[33]);
2526 utcinfo->DN = bGetShort (&buf4[35]);
2527 utcinfo->delta_t_LSF = bGetShort (&buf4[37]);
2532 if (*data_length != sizeof (NAV_INFO) - 1) return TRUE;
2536 navinfo->sv_number = buf4[0];
2537 navinfo->t_ephem = bGetSingle (&buf4[1]);
2538 navinfo->ephclk.weeknum = bGetShort (&buf4[5]);
2540 navinfo->ephclk.codeL2 = buf4[7];
2541 navinfo->ephclk.L2Pdata = buf4[8];
2542 navinfo->ephclk.SVacc_raw = buf4[9];
2543 navinfo->ephclk.SV_health = buf4[10];
2544 navinfo->ephclk.IODC = bGetShort (&buf4[11]);
2545 navinfo->ephclk.T_GD = bGetSingle (&buf4[13]);
2546 navinfo->ephclk.t_oc = bGetSingle (&buf4[17]);
2547 navinfo->ephclk.a_f2 = bGetSingle (&buf4[21]);
2548 navinfo->ephclk.a_f1 = bGetSingle (&buf4[25]);
2549 navinfo->ephclk.a_f0 = bGetSingle (&buf4[29]);
2550 navinfo->ephclk.SVacc = bGetSingle (&buf4[33]);
2552 navinfo->ephorb.IODE = buf4[37];
2553 navinfo->ephorb.fit_interval = buf4[38];
2554 navinfo->ephorb.C_rs = bGetSingle (&buf4[39]);
2555 navinfo->ephorb.delta_n = bGetSingle (&buf4[43]);
2556 navinfo->ephorb.M_0 = bGetDouble (&buf4[47]);
2557 navinfo->ephorb.C_uc = bGetSingle (&buf4[55]);
2558 navinfo->ephorb.e = bGetDouble (&buf4[59]);
2559 navinfo->ephorb.C_us = bGetSingle (&buf4[67]);
2560 navinfo->ephorb.sqrt_A = bGetDouble (&buf4[71]);
2561 navinfo->ephorb.t_oe = bGetSingle (&buf4[79]);
2562 navinfo->ephorb.C_ic = bGetSingle (&buf4[83]);
2563 navinfo->ephorb.OMEGA_0 = bGetDouble (&buf4[87]);
2564 navinfo->ephorb.C_is = bGetSingle (&buf4[95]);
2565 navinfo->ephorb.i_0 = bGetDouble (&buf4[99]);
2566 navinfo->ephorb.C_rc = bGetSingle (&buf4[107]);
2567 navinfo->ephorb.omega = bGetDouble (&buf4[111]);
2568 navinfo->ephorb.OMEGADOT=bGetSingle (&buf4[119]);
2569 navinfo->ephorb.IDOT = bGetSingle (&buf4[123]);
2570 navinfo->ephorb.Axis = bGetDouble (&buf4[127]);
2571 navinfo->ephorb.n = bGetDouble (&buf4[135]);
2572 navinfo->ephorb.r1me2 = bGetDouble (&buf4[143]);
2573 navinfo->ephorb.OMEGA_n=bGetDouble (&buf4[151]);
2574 navinfo->ephorb.ODOT_n = bGetDouble (&buf4[159]);
2591 buf = rpt->buf;
2593 if (rpt->len != 33) return TRUE;
2600 /* raw measurement data - code phase/Doppler */
2613 buf = rpt->buf;
2615 if (rpt->len != 25) return TRUE;
2639 buf = rpt->buf;
2641 if (rpt->len != 16) return TRUE;
2672 buf = rpt->buf;
2674 if (rpt->len != 24) return TRUE;
2694 /* over-determined satellite selection for position fixes, PDOP, fix mode */
2710 buf = rpt->buf;
2714 if (rpt->len != 17 + (*nsvs) ) return TRUE;
2736 buf = rpt->buf;
2738 if (rpt->len != 1) return TRUE;
2753 buf = rpt->buf;
2755 if (rpt->len != 36) return TRUE;
2764 /* position, lat-lon-alt double precision */
2776 buf = rpt->buf;
2778 if (rpt->len != 36) return TRUE;
2794 buf = rpt->buf;
2797 /* if (rpt->len != 40) return TRUE; */
2798 if (rpt->len != 43) return TRUE;
2800 TsipxBB->bSubcode = buf[0];
2801 TsipxBB->operating_mode = buf[1];
2802 TsipxBB->dyn_code = buf[3];
2803 TsipxBB->elev_mask = bGetSingle (&buf[5]);
2804 TsipxBB->cno_mask = bGetSingle (&buf[9]);
2805 TsipxBB->dop_mask = bGetSingle (&buf[13]);
2806 TsipxBB->dop_switch = bGetSingle (&buf[17]);
2827 buf = rpt->buf;
2829 if (rpt->len != 10) return TRUE;
2869 buf = rpt->buf;
2870 if (rpt->len != 74) return TRUE;
2899 buf = rpt->buf;
2901 if (rpt->len != 43) return TRUE;
2921 buf = rpt->buf;
2923 if (rpt->len != 43) return TRUE;
2963 buf = rpt->buf;
2965 if (rpt->len != 56) return TRUE;
2979 if (*lon > GPS_PI) *lon -= 2.0*GPS_PI;
2983 (*datum_index) = (short)((short)buf[26]-1);
3010 if (rpt->len != 17) return FALSE;
3011 *bSearchRange = rpt->buf[1];
3012 *bBoardOptions = rpt->buf[2];
3013 *iiSerialNumber = bGetLong(&rpt->buf[3]);
3014 *bBuildYear = rpt->buf[7];
3015 *bBuildMonth = rpt->buf[8];
3016 *bBuildDay = rpt->buf[9];
3017 *bBuildHour = rpt->buf[10];
3018 *fOscOffset = bGetSingle(&rpt->buf[11]);
3019 *iTestCodeId = bGetShort(&rpt->buf[15]);
3037 if (rpt->len != 19) return FALSE;
3038 *bProdOptionsPre = rpt->buf[1];
3039 *bProdNumberExt = rpt->buf[2];
3040 *iCaseSerialNumberPre = bGetShort(&rpt->buf[3]);
3041 *iiCaseSerialNumber = bGetLong(&rpt->buf[5]);
3042 *iiProdNumber = bGetLong(&rpt->buf[9]);
3043 *iPremiumOptions = bGetShort(&rpt->buf[13]);
3044 *iMachineID = bGetShort(&rpt->buf[15]);
3045 *iKey = bGetShort(&rpt->buf[17]);
3055 if (rpt->len != 2) return FALSE;
3056 *bSegMask = rpt->buf[1];
3074 buf = rpt->buf;
3075 if (rpt->len != 16) return TRUE;
3093 buf = rpt->buf;
3094 if (rpt->len != 5) return TRUE;
3108 buf = rpt->buf;
3109 if (rpt->len != 5) return TRUE;
3123 buf = rpt->buf;
3124 if (rpt->len != 5) return TRUE;
3147 if (rpt->len != 22) return TRUE;
3149 *COUNT = bGetUShort(&rpt->buf[1]);
3150 *FracSec = bGetDouble(&rpt->buf[3]);
3151 *Hour = rpt->buf[11];
3152 *Minute = rpt->buf[12];
3153 *Second = rpt->buf[13];
3154 *Day = rpt->buf[14];
3155 *Month = rpt->buf[15];
3156 *Year = bGetUShort(&rpt->buf[16]);
3157 *Status = rpt->buf[18];
3158 *Flags = rpt->buf[19];
3170 * Sunnyvale, California 94088-3642
3173 * Telephone: (408) 481-8000
3174 * Fax: (408) 481-6005
3177 * Telephone: (800) 767-4822 (U.S. and Canada)
3178 * (408) 481-6940 (outside U.S. and Canada)
3179 * Fax: (408) 481-6020
3180 * BBS: (408) 481-7800
3181 * e-mail: trimble_support@trimble.com
3193 * A large case statement directs processing to one of many mid-level
3194 * functions. The mid-level functions specific to the current report
3222 /* convert time of week into day-hour-minute-second and print */
3233 if (time_of_week == -1.0)
3295 pbuf += sprintf(pbuf, "\n Character format (bits/char, parity, stop bits): %d-%s-%d",
3583 lat = -lat;
3586 lat_min = (lat - lat_deg) * 60.0;
3593 lon = -lon;
3596 lon_min = (lon - lon_deg) * 60.0;
3810 "\n WGS-84 altitude output");
3814 "\n WGS-84 altitude input");
3861 pbuf += sprintf(pbuf, "\n Code-phase smoothed before output");
3977 pbuf += sprintf(pbuf, "\n t_oa_raw = % -12d SV_hlth = % -12d ",
3978 almanac->t_oa_raw , almanac->SV_health );
3979 pbuf += sprintf(pbuf, "\n e = % -12g t_oa = % -12g ",
3980 almanac->e , almanac->t_oa );
3981 pbuf += sprintf(pbuf, "\n i_0 = % -12g OMEGADOT = % -12g ",
3982 almanac->i_0 , almanac->OMEGADOT );
3983 pbuf += sprintf(pbuf, "\n sqrt_A = % -12g OMEGA_0 = % -12g ",
3984 almanac->sqrt_A , almanac->OMEGA_0 );
3985 pbuf += sprintf(pbuf, "\n omega = % -12g M_0 = % -12g ",
3986 almanac->omega , almanac->M_0 );
3987 pbuf += sprintf(pbuf, "\n a_f0 = % -12g a_f1 = % -12g ",
3988 almanac->a_f0 , almanac->a_f1 );
3989 pbuf += sprintf(pbuf, "\n Axis = % -12g n = % -12g ",
3990 almanac->Axis , almanac->n );
3991 pbuf += sprintf(pbuf, "\n OMEGA_n = % -12g ODOT_n = % -12g ",
3992 almanac->OMEGA_n , almanac->ODOT_n );
3993 pbuf += sprintf(pbuf, "\n t_zc = % -12g weeknum = % -12d ",
3994 almanac->t_zc , almanac->weeknum );
3995 pbuf += sprintf(pbuf, "\n wn_oa = % -12d", almanac->wn_oa );
4002 almh->t_oa, almh->WN_a);
4007 (iprn+1) , almh->SV_health[iprn]);
4018 pbuf += sprintf(pbuf, "\n alpha_0 = % -12g alpha_1 = % -12g ",
4019 ionosphere->alpha_0, ionosphere->alpha_1);
4020 pbuf += sprintf(pbuf, "\n alpha_2 = % -12g alpha_3 = % -12g ",
4021 ionosphere->alpha_2, ionosphere->alpha_3);
4022 pbuf += sprintf(pbuf, "\n beta_0 = % -12g beta_1 = % -12g ",
4023 ionosphere->beta_0, ionosphere->beta_1);
4024 pbuf += sprintf(pbuf, "\n beta_2 = % -12g beta_3 = % -12g ",
4025 ionosphere->beta_2, ionosphere->beta_3);
4031 pbuf += sprintf(pbuf, "\n A_0 = %g ", utc->A_0);
4032 pbuf += sprintf(pbuf, "\n A_1 = %g ", utc->A_1);
4033 pbuf += sprintf(pbuf, "\n delta_t_LS = %d ", utc->delta_t_LS);
4034 pbuf += sprintf(pbuf, "\n t_ot = %.0f ", utc->t_ot );
4035 pbuf += sprintf(pbuf, "\n WN_t = %d ", utc->WN_t );
4036 pbuf += sprintf(pbuf, "\n WN_LSF = %d ", utc->WN_LSF );
4037 pbuf += sprintf(pbuf, "\n DN = %d ", utc->DN );
4038 pbuf += sprintf(pbuf, "\n delta_t_LSF = %d ", utc->delta_t_LSF );
4048 pbuf += sprintf(pbuf, "\n SV_PRN = % -12d . t_ephem = % -12g . ",
4049 nav_data->sv_number , nav_data->t_ephem );
4050 cdata = &(nav_data->ephclk);
4052 "\n weeknum = % -12d . codeL2 = % -12d . L2Pdata = % -12d",
4053 cdata->weeknum , cdata->codeL2 , cdata->L2Pdata );
4055 "\n SVacc_raw = % -12d .SV_health = % -12d . IODC = % -12d",
4056 cdata->SVacc_raw, cdata->SV_health, cdata->IODC );
4058 "\n T_GD = % -12g . t_oc = % -12g . a_f2 = % -12g",
4059 cdata->T_GD, cdata->t_oc, cdata->a_f2 );
4061 "\n a_f1 = % -12g . a_f0 = % -12g . SVacc = % -12g",
4062 cdata->a_f1, cdata->a_f0, cdata->SVacc );
4063 edata = &(nav_data->ephorb);
4065 "\n IODE = % -12d .fit_intvl = % -12d . C_rs = % -12g",
4066 edata->IODE, edata->fit_interval, edata->C_rs );
4068 "\n delta_n = % -12g . M_0 = % -12g . C_uc = % -12g",
4069 edata->delta_n, edata->M_0, edata->C_uc );
4071 "\n ecc = % -12g . C_us = % -12g . sqrt_A = % -12g",
4072 edata->e, edata->C_us, edata->sqrt_A );
4074 "\n t_oe = % -12g . C_ic = % -12g . OMEGA_0 = % -12g",
4075 edata->t_oe, edata->C_ic, edata->OMEGA_0 );
4077 "\n C_is = % -12g . i_0 = % -12g . C_rc = % -12g",
4078 edata->C_is, edata->i_0, edata->C_rc );
4080 "\n omega = % -12g . OMEGADOT = % -12g . IDOT = % -12g",
4081 edata->omega, edata->OMEGADOT, edata->IDOT );
4083 "\n Axis = % -12g . n = % -12g . r1me2 = % -12g",
4084 edata->Axis, edata->n, edata->r1me2 );
4086 "\n OMEGA_n = % -12g . ODOT_n = % -12g",
4087 edata->OMEGA_n, edata->ODOT_n );
4243 pbuf += sprintf(pbuf, "\nMode: Searching, %d-SV:", nsvs);
4246 pbuf += sprintf(pbuf, "\nMode: One-SV Timing:");
4249 pbuf += sprintf(pbuf, "\nMode: %c-%dD, %d-SV:",
4250 manual_mode ? 'M' : 'A', ndim - 1, nsvs);
4253 pbuf += sprintf(pbuf, "\nMode: Timing, %d-SV:", nsvs);
4266 pbuf += sprintf(pbuf, "; DOPs: P %.1f H %.1f V %.1f T %.1f",
4287 pbuf += sprintf(pbuf, "\nFix is%s DGPS-corrected (%s mode) (%d)",
4344 lat = -lat;
4349 lat_min = (lat - lat_deg) * 60.0;
4353 lon = -lon;
4358 lon_min = (lon - lon_deg) * 60.0;
4417 pbuf += sprintf(pbuf, "\n I/O Baud %s/%s, %d - %s - %d",
4458 "horizontal (2-D)",
4459 "full position (3-D)",
4460 "single satellite (0-D)",
4542 lat = -lat;
4550 lat_min = (lat - lat_deg) * 60.0;
4554 lon = -lon;
4562 lon_min = (lon - lon_deg) * 60.0;
4617 if (datum_idx == -1)
4619 pbuf += sprintf(pbuf, "\nUser-Entered Datum:");
4623 pbuf += sprintf(pbuf, "\n a-axis = %10.3f", datum_coeffs[3]);
4624 pbuf += sprintf(pbuf, "\n e-squared = %16.14f", datum_coeffs[4]);
4628 pbuf += sprintf(pbuf, "\nWGS-84 datum, Index 0 ");
4654 if (datum_idx == -1)
4656 pbuf += sprintf(pbuf, "\nUser-Entered Datum:");
4660 pbuf += sprintf(pbuf, "\n a-axis = %10.3f", datum_coeffs[3]);
4661 pbuf += sprintf(pbuf, "\n e-squared = %16.14f", datum_coeffs[4]);
4665 pbuf += sprintf(pbuf, "\nWGS-84 datum, Index 0 ");
4712 (char)rpt->buf[29], /* UTC offset */
4715 (info & INFO_FILTERED)?"-Filtrd":"");
4727 sprintf(datum_string, "WGS-84");
4734 "\n Pos: %4d:%09.6f %c %5d:%09.6f %c %10.2f m HAE (%s)",
4898 /* fast-SA decorrolation time for self-survey */
4914 "\nMax # of position fixes for self-survey : %ld",
4943 pbuf += sprintf(pbuf, "\nAuto-Report Mask: %02X %02X %02X %02X",
4950 pbuf += sprintf(pbuf, "\nAuto-Reports scheduled for Output:");
4959 if (pbuf-linestart > 60) linestart = pbuf;
4963 pbuf += sprintf(pbuf, "\nAuto-Reports NOT scheduled for Output:");
4971 if (pbuf-linestart > 60) linestart = pbuf;
4989 pbuf += sprintf(pbuf, "\nSuperpacket auto-output mask: %02X %02X %02X %02X",
4992 if (spktmask[0]&0x01) pbuf+= sprintf (pbuf, "\n PPS 8F-0B");
4993 if (spktmask[0]&0x02) pbuf+= sprintf (pbuf, "\n Event 8F-0B");
4994 if (spktmask[0]&0x10) pbuf+= sprintf (pbuf, "\n PPS 8F-AD");
4995 if (spktmask[0]&0x20) pbuf+= sprintf (pbuf, "\n Event 8F-AD");
4996 if (spktmask[2]&0x01) pbuf+= sprintf (pbuf, "\n ppos Fix 8F-20");
5082 /* force header is to help auto-output function */
5093 /* supply a header in console output */
5127 /* app-specific rpt packets */
5131 rpt->code, rpt->len);
5137 rpt->code, rpt->len);
5144 rpt->code, rpt->len);
5147 for (i = 0; i < rpt->len; i++) {
5149 pbuf += sprintf(pbuf, " %02X", rpt->buf[i]);
5171 pbuf += print_msg_table_header (rpt->code, pbuf, FALSE);
5174 switch (rpt->code)
5186 case 0x4A: switch (rpt->len) {
5188 ** special case (=slip-up) in the TSIP protocol;
5215 case 0x8F: switch (rpt->buf[0])