source: ntrip/trunk/clock_and_orbit/readco.c@ 1374

Last change on this file since 1374 was 956, checked in by stoecker, 16 years ago

added

  • Property svn:executable set to *
File size: 2.4 KB
Line 
1#include "clock_orbit_rtcm.h"
2#include "clock_orbit_rtcm.c"
3
4#include <stdio.h>
5
6/* prototype, don't use any of this code in a final application */
7
8struct ClockOrbit co;
9double lasttow = -1.0;
10
11int main(void)
12{
13 char buffer[4096];
14 char obuffer[CLOCKORBIT_BUFFERSIZE];
15
16 while(gets(buffer))
17 {
18 char type;
19 int week, prn, iodc, iode;
20 double tow, clock, radial, along, outofplane;
21 int num = sscanf(buffer, "%d %lf %c%d %d %d %lf %lf %lf %lf\n", &week,
22 &tow, &type, &prn, &iodc, &iode, &clock, &radial, &along, &outofplane);
23 if(num == 10)
24 {
25 struct SatData *sd;
26 if(lasttow != tow) /* create block */
27 {
28 if(lasttow >= 0)
29 {
30 int l = MakeClockOrbit(&co, COTYPE_AUTO, 0, obuffer, sizeof(obuffer));
31 if(!l) fprintf(stderr, "BUILD ERROR\n");
32 else
33 {
34 int nl, ns;
35 struct ClockOrbit c;
36
37// fwrite(obuffer, l, 1, stdout);
38 memset(&c, 0, sizeof(c));
39 nl = GetClockOrbitBias(&c, 0, obuffer, l, &ns);
40 if(nl < 0) fprintf(stderr, "EXTRACT ERROR %d\n", nl);
41 else if(nl > 0) fprintf(stderr, "MULTIBLOCK UNSUPPORTED IN TEST\n");
42 else if(ns != l) fprintf(stderr, "SIZE MISMATCH (%d/%d)\n", ns,l);
43 else
44 {
45 int i;
46 for(i = 0; i < c.NumberOfGPSSat; ++i)
47 {
48 printf("%d G%d %d %f %f %f %f\n", c.GPSEpochTime,
49 c.Sat[i].ID, co.Sat[i].IOD, c.Sat[i].Clock.DeltaA0,
50 c.Sat[i].Orbit.DeltaRadial, c.Sat[i].Orbit.DeltaAlongTrack,
51 c.Sat[i].Orbit.DeltaCrossTrack);
52 }
53 }
54 }
55 }
56 memset(&co, 0, sizeof(co));
57 lasttow = tow;
58 co.GPSEpochTime = (int)tow;
59 /* co.GLONASSEpochTime = 0; */
60 co.ClockDataSupplied = 1;
61 co.OrbitDataSupplied = 1;
62 co.SatRefPoint = DATUM_ITRF;
63 co.SatRefDatum = POINT_IONOFREE;
64 }
65
66 sd = co.Sat + co.NumberOfGPSSat;
67 sd->ID = prn;
68 sd->IOD = iode;
69 sd->Clock.DeltaA0 = clock;
70 sd->Orbit.DeltaRadial = radial;
71 sd->Orbit.DeltaAlongTrack = along;
72 sd->Orbit.DeltaCrossTrack = outofplane;
73 printf("%d %d/%f %c %d %d %d %f %f %f %f\n",num, week, tow, type, prn,
74 iodc, iode, clock, radial, along, outofplane);
75 ++co.NumberOfGPSSat;
76 }
77 }
78 return 0;
79}
Note: See TracBrowser for help on using the repository browser.