source: ntrip/trunk/clock_and_orbit/clock_orbit_rtcm.h@ 1873

Last change on this file since 1873 was 1842, checked in by stoecker, 16 years ago

fixed a set of decoding bugs

  • Property svn:executable set to *
File size: 4.6 KB
Line 
1#ifndef RTCM3_CLOCK_ORBIT_RTCM_H
2#define RTCM3_CLOCK_ORBIT_RTCM_H
3
4/* Programheader
5
6 Name: clock_orbit_rtcm.h
7 Project: RTCM3
8 Version: $Id: clock_orbit_rtcm.h,v 1.11 2009/05/14 13:24:13 stoecker Exp $
9 Authors: Dirk Stöcker
10 Description: state space approach for RTCM3
11*/
12
13#include <string.h>
14
15enum SatelliteReferenceDatum { DATUM_ITRF=0, DATUM_LOCAL=1 };
16enum SatelliteReferencePoint { POINT_IONOFREE=0, POINT_CENTER=1 };
17enum ClockOrbitType {
18 COTYPE_GPSORBIT=1057, COTYPE_GPSCLOCK=1058,
19 COTYPE_GPSCOMBINED=1060, COTYPE_GPSURA=1061, COTYPE_GPSHR=1062,
20
21 COTYPE_GLONASSORBIT=1063, COTYPE_GLONASSCLOCK=1064,
22 COTYPE_GLONASSCOMBINED=1066, COTYPE_GLONASSURA=1067, COTYPE_GLONASSHR=1068,
23
24 COTYPE_AUTO=0 };
25enum BiasType { BTYPE_GPS=1059, BTYPE_GLONASS=1065, BTYPE_AUTO = 0 };
26
27enum COR_CONSTANTS {
28 CLOCKORBIT_BUFFERSIZE=2048,
29 CLOCKORBIT_NUMGPS=32,
30 CLOCKORBIT_NUMGLONASS=24,
31 CLOCKORBIT_NUMBIAS=10
32};
33
34enum CodeType {
35 CODETYPEGPS_L1_CA = 0,
36 CODETYPEGPS_L1_P = 1,
37 CODETYPEGPS_L1_Z = 2,
38 /* ... */
39
40 CODETYPEGLONASS_L1_CA = 0,
41 CODETYPEGLONASS_L1_P = 1,
42 CODETYPEGLONASS_L2_CA = 2,
43 CODETYPEGLONASS_L2_P = 3,
44};
45
46/* GLONASS data is stored with offset CLOCKORBIT_NUMGPS in the data structures.
47So first GLONASS satellite is at xxx->Sat[CLOCKORBIT_NUMGPS], first
48GPS satellite is xxx->Sat[0]. */
49
50struct ClockOrbit
51{
52 int GPSEpochTime; /* 0 .. 604799 s */
53 int GLONASSEpochTime; /* 0 .. 86399 s (86400 for leap second) */
54 int NumberOfGPSSat; /* 0 .. 32 */
55 int NumberOfGLONASSSat; /* 0 .. 24 */
56 int ClockDataSupplied; /* boolean */
57 int HRDataSupplied; /* boolean */
58 int OrbitDataSupplied; /* boolean */
59 int URADataSupplied; /* boolean */
60 int epochGPS[101]; /* Weber, for latency */
61 int epochSize; /* Weber, for latency */
62 int UpdateInterval;
63 enum SatelliteReferencePoint SatRefPoint;
64 enum SatelliteReferenceDatum SatRefDatum;
65 struct SatData {
66 int ID; /* GPS or GLONASS */
67 int IOD; /* GPS or GLONASS */
68 int URA;
69 double hrclock;
70 struct OrbitPart
71 {
72 double DeltaRadial; /* m */
73 double DeltaAlongTrack; /* m */
74 double DeltaCrossTrack; /* m */
75 double DotDeltaRadial; /* m/s */
76 double DotDeltaAlongTrack; /* m/s */
77 double DotDeltaCrossTrack; /* m/s */
78 double DotDotDeltaRadial; /* m/ss */
79 double DotDotDeltaAlongTrack; /* m/ss */
80 double DotDotDeltaCrossTrack; /* m/ss */
81 } Orbit;
82 struct ClockPart
83 {
84 double DeltaA0; /* m */
85 double DeltaA1; /* m/s */
86 double DeltaA2; /* m/ss */
87 } Clock;
88 } Sat[CLOCKORBIT_NUMGPS+CLOCKORBIT_NUMGLONASS];
89};
90
91struct Bias
92{
93 int GPSEpochTime; /* 0 .. 604799 s */
94 int GLONASSEpochTime; /* 0 .. 86399 s (86400 for leap second) */
95 int NumberOfGPSSat; /* 0 .. 32 */
96 int NumberOfGLONASSSat; /* 0 .. 24 */
97 int UpdateInterval;
98 struct BiasSat
99 {
100 int ID; /* GPS or GLONASS */
101 int NumberOfCodeBiases;
102 struct CodeBias
103 {
104 enum CodeType Type;
105 float Bias; /* m */
106 } Biases[CLOCKORBIT_NUMBIAS];
107 } Sat[CLOCKORBIT_NUMGPS+CLOCKORBIT_NUMGLONASS];
108};
109
110/* return size of resulting data or 0 in case of an error */
111size_t MakeClockOrbit(const struct ClockOrbit *co, enum ClockOrbitType type,
112 int moremessagesfollow, char *buffer, size_t size);
113size_t MakeBias(const struct Bias *b, enum BiasType type,
114 int moremessagesfollow, char *buffer, size_t size);
115
116enum GCOB_RETURN {
117 /* all well */
118 GCOBR_MESSAGEFOLLOWS = 1,
119 GCOBR_OK = 0,
120 /* unknown data, a warning */
121 GCOBR_UNKNOWNTYPE = -1,
122 GCOBR_UNKNOWNDATA = -2,
123 GCOBR_CRCMISMATCH = -3,
124 GCOBR_SHORTMESSAGE = -4,
125 /* failed to do the work */
126 GCOBR_NOCLOCKORBITPARAMETER = -10,
127 GCOBR_NOBIASPARAMETER = -11,
128 /* data mismatch - data in storage does not match new data */
129 GCOBR_TIMEMISMATCH = -20,
130 GCOBR_DATAMISMATCH = -21,
131 /* not enough data - can decode the block completely */
132 GCOBR_SHORTBUFFER = -30,
133 GCOBR_MESSAGEEXCEEDSBUFFER = -31};
134
135/* NOTE: When an error message has been emitted, the output structures may have been modified. Make a copy of the previous variant before calling the
136function to have a clean state. */
137
138/* buffer should point to a RTCM3 block */
139enum GCOB_RETURN GetClockOrbitBias(struct ClockOrbit *co, struct Bias *b,
140 const char *buffer, size_t size, int *bytesused);
141
142#endif /* RTCM3_CLOCK_ORBIT_RTCM_H */
Note: See TracBrowser for help on using the repository browser.