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

Last change on this file since 2427 was 2427, checked in by mervart, 12 years ago

* empty log message *

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