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

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

added

  • Property svn:executable set to *
File size: 4.2 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$
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 { COTYPE_GPSORBIT=4050, COTYPE_GPSCLOCK=4051,
18 COTYPE_GLONASSORBIT=4053, COTYPE_GLONASSCLOCK=4054,
19 COTYPE_GPSCOMBINED=4056, COTYPE_GLONASSCOMBINED=4057,
20 COTYPE_AUTO=0 };
21enum BiasType { BTYPE_GPS=4052, BTYPE_GLONASS=4055, BTYPE_AUTO = 0 };
22
23enum COR_CONSTANTS {
24 CLOCKORBIT_BUFFERSIZE=2048,
25 CLOCKORBIT_NUMGPS=32,
26 CLOCKORBIT_NUMGLONASS=24,
27 CLOCKORBIT_NUMBIAS=10
28};
29
30enum CodeType {
31 CODETYPEGPS_L1_CA = 0,
32 CODETYPEGPS_L1_P = 1,
33 CODETYPEGPS_L1_Z = 2,
34 /* ... */
35
36 CODETYPEGLONASS_L1_CA = 0,
37 CODETYPEGLONASS_L1_P = 1,
38 CODETYPEGLONASS_L2_CA = 2,
39 CODETYPEGLONASS_L2_P = 3,
40};
41
42/* GLONASS data is stored with offset CLOCKORBIT_NUMGPS in the data structures.
43So first GLONASS satellite is at xxx->Sat[CLOCKORBIT_NUMGPS], first
44GPS satellite is xxx->Sat[0]. */
45
46struct ClockOrbit
47{
48 int GPSEpochTime; /* 0 .. 604799 s */
49 int GLONASSEpochTime; /* 0 .. 86399 s (86400 for leap second) */
50 int NumberOfGPSSat; /* 0 .. 32 */
51 int NumberOfGLONASSSat; /* 0 .. 24 */
52 int ClockDataSupplied; /* boolean */
53 int OrbitDataSupplied; /* boolean */
54 enum SatelliteReferencePoint SatRefPoint;
55 enum SatelliteReferenceDatum SatRefDatum;
56 struct SatData {
57 int ID; /* GPS or GLONASS */
58 int IOD; /* GPS or GLONASS */
59 struct OrbitPart
60 {
61 double DeltaRadial; /* m */
62 double DeltaAlongTrack; /* m */
63 double DeltaCrossTrack; /* m */
64 double DotDeltaRadial; /* m/s */
65 double DotDeltaAlongTrack; /* m/s */
66 double DotDeltaCrossTrack; /* m/s */
67 double DotDotDeltaRadial; /* m/ss */
68 double DotDotDeltaAlongTrack; /* m/ss */
69 double DotDotDeltaCrossTrack; /* m/ss */
70 } Orbit;
71 struct ClockPart
72 {
73 double DeltaA0; /* m */
74 double DeltaA1; /* m/s */
75 double DeltaA2; /* m/ss */
76 } Clock;
77 } Sat[CLOCKORBIT_NUMGPS+CLOCKORBIT_NUMGLONASS];
78};
79
80struct Bias
81{
82 int GPSEpochTime; /* 0 .. 604799 s */
83 int GLONASSEpochTime; /* 0 .. 86399 s (86400 for leap second) */
84 int NumberOfGPSSat; /* 0 .. 32 */
85 int NumberOfGLONASSSat; /* 0 .. 24 */
86 struct BiasSat
87 {
88 int ID; /* GPS or GLONASS */
89 int NumberOfCodeBiases;
90 struct CodeBias
91 {
92 enum CodeType Type;
93 float Bias; /* m */
94 } Biases[CLOCKORBIT_NUMBIAS];
95 } Sat[CLOCKORBIT_NUMGPS+CLOCKORBIT_NUMGLONASS];
96};
97
98/* return size of resulting data or 0 in case of an error */
99size_t MakeClockOrbit(const struct ClockOrbit *co, enum ClockOrbitType type,
100 int moremessagesfollow, char *buffer, size_t size);
101size_t MakeBias(const struct Bias *b, enum BiasType type,
102 int moremessagesfollow, char *buffer, size_t size);
103
104enum GCOB_RETURN {
105 /* all well */
106 GCOBR_MESSAGEFOLLOWS = 1,
107 GCOBR_OK = 0,
108 /* unknown data, a warning */
109 GCOBR_UNKNOWNTYPE = -1,
110 GCOBR_UNKNOWNDATA = -2,
111 GCOBR_CRCMISMATCH = -3,
112 /* failed to do the work */
113 GCOBR_NOCLOCKORBITPARAMETER = -10,
114 GCOBR_NOBIASPARAMETER = -11,
115 /* data mismatch - data in storage does not match new data */
116 GCOBR_TIMEMISMATCH = -20,
117 GCOBR_DATAMISMATCH = -21,
118 /* not enough data - can decode the block completely */
119 GCOBR_SHORTBUFFER = -30,
120 GCOBR_MISSINGBITS = -31,
121 GCOBR_MESSAGEEXCEEDSBUFFER = -32
122};
123
124/* 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
125function to have a clean state. */
126
127/* buffer should point to a RTCM3 block */
128enum GCOB_RETURN GetClockOrbitBias(struct ClockOrbit *co, struct Bias *b,
129 const char *buffer, size_t size, int *bytesused);
130
131#endif /* RTCM3_CLOCK_ORBIT_RTCM_H */
Note: See TracBrowser for help on using the repository browser.