[862] | 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
|
---|
[2363] | 8 | Version: $Id: clock_orbit_rtcm.h,v 1.12 2010/02/17 10:49:27 mervart Exp $
|
---|
[862] | 9 | Authors: Dirk Stöcker
|
---|
| 10 | Description: state space approach for RTCM3
|
---|
| 11 | */
|
---|
| 12 |
|
---|
| 13 | #include <string.h>
|
---|
| 14 |
|
---|
| 15 | enum SatelliteReferenceDatum { DATUM_ITRF=0, DATUM_LOCAL=1 };
|
---|
| 16 | enum SatelliteReferencePoint { POINT_IONOFREE=0, POINT_CENTER=1 };
|
---|
[1697] | 17 | enum ClockOrbitType {
|
---|
[1841] | 18 | COTYPE_GPSORBIT=1057, COTYPE_GPSCLOCK=1058,
|
---|
| 19 | COTYPE_GPSCOMBINED=1060, COTYPE_GPSURA=1061, COTYPE_GPSHR=1062,
|
---|
[1697] | 20 |
|
---|
[1841] | 21 | COTYPE_GLONASSORBIT=1063, COTYPE_GLONASSCLOCK=1064,
|
---|
| 22 | COTYPE_GLONASSCOMBINED=1066, COTYPE_GLONASSURA=1067, COTYPE_GLONASSHR=1068,
|
---|
[1697] | 23 |
|
---|
[862] | 24 | COTYPE_AUTO=0 };
|
---|
[1841] | 25 | enum BiasType { BTYPE_GPS=1059, BTYPE_GLONASS=1065, BTYPE_AUTO = 0 };
|
---|
[862] | 26 |
|
---|
| 27 | enum COR_CONSTANTS {
|
---|
| 28 | CLOCKORBIT_BUFFERSIZE=2048,
|
---|
| 29 | CLOCKORBIT_NUMGPS=32,
|
---|
| 30 | CLOCKORBIT_NUMGLONASS=24,
|
---|
| 31 | CLOCKORBIT_NUMBIAS=10
|
---|
| 32 | };
|
---|
| 33 |
|
---|
| 34 | enum CodeType {
|
---|
| 35 | CODETYPEGPS_L1_CA = 0,
|
---|
| 36 | CODETYPEGPS_L1_P = 1,
|
---|
| 37 | CODETYPEGPS_L1_Z = 2,
|
---|
| 38 | /* ... */
|
---|
[2297] | 39 | CODETYPEGPS_L2_P = 10,
|
---|
[2363] | 40 | CODETYPEGPS_L2_Z = 11,
|
---|
[2297] | 41 | /* ... */
|
---|
[862] | 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.
|
---|
| 49 | So first GLONASS satellite is at xxx->Sat[CLOCKORBIT_NUMGPS], first
|
---|
| 50 | GPS satellite is xxx->Sat[0]. */
|
---|
| 51 |
|
---|
| 52 | struct ClockOrbit
|
---|
| 53 | {
|
---|
[1864] | 54 | enum ClockOrbitType messageType;
|
---|
[862] | 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 */
|
---|
[1697] | 60 | int HRDataSupplied; /* boolean */
|
---|
[862] | 61 | int OrbitDataSupplied; /* boolean */
|
---|
[1697] | 62 | int URADataSupplied; /* boolean */
|
---|
[1205] | 63 | int epochGPS[101]; /* Weber, for latency */
|
---|
| 64 | int epochSize; /* Weber, for latency */
|
---|
[1697] | 65 | int UpdateInterval;
|
---|
[862] | 66 | enum SatelliteReferencePoint SatRefPoint;
|
---|
| 67 | enum SatelliteReferenceDatum SatRefDatum;
|
---|
| 68 | struct SatData {
|
---|
| 69 | int ID; /* GPS or GLONASS */
|
---|
| 70 | int IOD; /* GPS or GLONASS */
|
---|
[1697] | 71 | int URA;
|
---|
| 72 | double hrclock;
|
---|
[862] | 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 |
|
---|
| 94 | struct Bias
|
---|
| 95 | {
|
---|
[1864] | 96 | enum BiasType messageType;
|
---|
[862] | 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 */
|
---|
[1697] | 101 | int UpdateInterval;
|
---|
[862] | 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 */
|
---|
| 115 | size_t MakeClockOrbit(const struct ClockOrbit *co, enum ClockOrbitType type,
|
---|
| 116 | int moremessagesfollow, char *buffer, size_t size);
|
---|
| 117 | size_t MakeBias(const struct Bias *b, enum BiasType type,
|
---|
| 118 | int moremessagesfollow, char *buffer, size_t size);
|
---|
| 119 |
|
---|
[878] | 120 | enum 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,
|
---|
[1843] | 128 | GCOBR_SHORTMESSAGE = -4,
|
---|
[878] | 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,
|
---|
[1843] | 137 | GCOBR_MESSAGEEXCEEDSBUFFER = -31};
|
---|
[862] | 138 |
|
---|
[878] | 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
|
---|
| 140 | function to have a clean state. */
|
---|
| 141 |
|
---|
| 142 | /* buffer should point to a RTCM3 block */
|
---|
| 143 | enum GCOB_RETURN GetClockOrbitBias(struct ClockOrbit *co, struct Bias *b,
|
---|
| 144 | const char *buffer, size_t size, int *bytesused);
|
---|
| 145 |
|
---|
[862] | 146 | #endif /* RTCM3_CLOCK_ORBIT_RTCM_H */
|
---|