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

Last change on this file since 3520 was 2421, checked in by stoecker, 15 years ago

update of SSR messages

  • Property svn:executable set to *
File size: 2.3 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.SatRefDatum = DATUM_ITRF;
63 }
64
65 sd = co.Sat + co.NumberOfGPSSat;
66 sd->ID = prn;
67 sd->IOD = iode;
68 sd->Clock.DeltaA0 = clock;
69 sd->Orbit.DeltaRadial = radial;
70 sd->Orbit.DeltaAlongTrack = along;
71 sd->Orbit.DeltaCrossTrack = outofplane;
72 printf("%d %d/%f %c %d %d %d %f %f %f %f\n",num, week, tow, type, prn,
73 iodc, iode, clock, radial, along, outofplane);
74 ++co.NumberOfGPSSat;
75 }
76 }
77 return 0;
78}
Note: See TracBrowser for help on using the repository browser.