source: ntrip/trunk/BNC/RTCM3/clock_orbit_rtcm.h@ 1873

Last change on this file since 1873 was 1851, checked in by mervart, 15 years ago

* empty log message *

  • Property svn:executable set to *
File size: 4.7 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 enum ClockOrbitType messageType;
53 int GPSEpochTime; /* 0 .. 604799 s */
54 int GLONASSEpochTime; /* 0 .. 86399 s (86400 for leap second) */
55 int NumberOfGPSSat; /* 0 .. 32 */
56 int NumberOfGLONASSSat; /* 0 .. 24 */
57 int ClockDataSupplied; /* boolean */
58 int HRDataSupplied; /* boolean */
59 int OrbitDataSupplied; /* boolean */
60 int URADataSupplied; /* boolean */
61 int epochGPS[101]; /* Weber, for latency */
62 int epochSize; /* Weber, for latency */
63 int UpdateInterval;
64 enum SatelliteReferencePoint SatRefPoint;
65 enum SatelliteReferenceDatum SatRefDatum;
66 struct SatData {
67 int ID; /* GPS or GLONASS */
68 int IOD; /* GPS or GLONASS */
69 int URA;
70 double hrclock;
71 struct OrbitPart
72 {
73 double DeltaRadial; /* m */
74 double DeltaAlongTrack; /* m */
75 double DeltaCrossTrack; /* m */
76 double DotDeltaRadial; /* m/s */
77 double DotDeltaAlongTrack; /* m/s */
78 double DotDeltaCrossTrack; /* m/s */
79 double DotDotDeltaRadial; /* m/ss */
80 double DotDotDeltaAlongTrack; /* m/ss */
81 double DotDotDeltaCrossTrack; /* m/ss */
82 } Orbit;
83 struct ClockPart
84 {
85 double DeltaA0; /* m */
86 double DeltaA1; /* m/s */
87 double DeltaA2; /* m/ss */
88 } Clock;
89 } Sat[CLOCKORBIT_NUMGPS+CLOCKORBIT_NUMGLONASS];
90};
91
92struct Bias
93{
94 enum BiasType messageType;
95 int GPSEpochTime; /* 0 .. 604799 s */
96 int GLONASSEpochTime; /* 0 .. 86399 s (86400 for leap second) */
97 int NumberOfGPSSat; /* 0 .. 32 */
98 int NumberOfGLONASSSat; /* 0 .. 24 */
99 int UpdateInterval;
100 struct BiasSat
101 {
102 int ID; /* GPS or GLONASS */
103 int NumberOfCodeBiases;
104 struct CodeBias
105 {
106 enum CodeType Type;
107 float Bias; /* m */
108 } Biases[CLOCKORBIT_NUMBIAS];
109 } Sat[CLOCKORBIT_NUMGPS+CLOCKORBIT_NUMGLONASS];
110};
111
112/* return size of resulting data or 0 in case of an error */
113size_t MakeClockOrbit(const struct ClockOrbit *co, enum ClockOrbitType type,
114 int moremessagesfollow, char *buffer, size_t size);
115size_t MakeBias(const struct Bias *b, enum BiasType type,
116 int moremessagesfollow, char *buffer, size_t size);
117
118enum GCOB_RETURN {
119 /* all well */
120 GCOBR_MESSAGEFOLLOWS = 1,
121 GCOBR_OK = 0,
122 /* unknown data, a warning */
123 GCOBR_UNKNOWNTYPE = -1,
124 GCOBR_UNKNOWNDATA = -2,
125 GCOBR_CRCMISMATCH = -3,
126 GCOBR_SHORTMESSAGE = -4,
127 /* failed to do the work */
128 GCOBR_NOCLOCKORBITPARAMETER = -10,
129 GCOBR_NOBIASPARAMETER = -11,
130 /* data mismatch - data in storage does not match new data */
131 GCOBR_TIMEMISMATCH = -20,
132 GCOBR_DATAMISMATCH = -21,
133 /* not enough data - can decode the block completely */
134 GCOBR_SHORTBUFFER = -30,
135 GCOBR_MESSAGEEXCEEDSBUFFER = -31};
136
137/* 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
138function to have a clean state. */
139
140/* buffer should point to a RTCM3 block */
141enum GCOB_RETURN GetClockOrbitBias(struct ClockOrbit *co, struct Bias *b,
142 const char *buffer, size_t size, int *bytesused);
143
144#endif /* RTCM3_CLOCK_ORBIT_RTCM_H */
Note: See TracBrowser for help on using the repository browser.