1 | #ifndef RTCM3TORINEX_H
|
---|
2 | #define RTCM3TORINEX_H
|
---|
3 |
|
---|
4 | /*
|
---|
5 | Converter for RTCM3 data to RINEX.
|
---|
6 | $Id: rtcm3torinex.h 4374 2012-07-04 09:45:16Z stoecker $
|
---|
7 | Copyright (C) 2005-2006 by Dirk Stöcker <stoecker@alberding.eu>
|
---|
8 |
|
---|
9 | This program is free software; you can redistribute it and/or modify
|
---|
10 | it under the terms of the GNU General Public License as published by
|
---|
11 | the Free Software Foundation; either version 2 of the License, or
|
---|
12 | (at your option) any later version.
|
---|
13 |
|
---|
14 | This program is distributed in the hope that it will be useful,
|
---|
15 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
17 | GNU General Public License for more details.
|
---|
18 |
|
---|
19 | You should have received a copy of the GNU General Public License
|
---|
20 | along with this program; if not, write to the Free Software
|
---|
21 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
---|
22 | or read http://www.gnu.org/licenses/gpl.txt
|
---|
23 | */
|
---|
24 |
|
---|
25 | #define RTCM3TORINEX_VERSION "2"
|
---|
26 |
|
---|
27 | #include <stdio.h>
|
---|
28 |
|
---|
29 | #define NUMRTCM3PARSERSATS 144
|
---|
30 | #define GNSS_MAXSATS 64
|
---|
31 |
|
---|
32 | #define PRN_GPS_START 1
|
---|
33 | #define PRN_GPS_END 32
|
---|
34 | #define PRN_GLONASS_START 38
|
---|
35 | #define PRN_GLONASS_END 61
|
---|
36 | #define PRN_GALILEO_START 71
|
---|
37 | #define PRN_GALILEO_END 100
|
---|
38 | #define PRN_SBAS_START 120
|
---|
39 | #define PRN_SBAS_END 138
|
---|
40 | #define PRN_GIOVE_START 139
|
---|
41 | #define PRN_GIOVE_END 140
|
---|
42 | #define PRN_COMPASS_START 141
|
---|
43 | #define PRN_COMPASS_END 170
|
---|
44 | #define PRN_QZSS_START 193
|
---|
45 | #define PRN_QZSS_END 202
|
---|
46 |
|
---|
47 | #define PRN_GLONASS_NUM (PRN_GLONASS_END-PRN_GLONASS_START+1)
|
---|
48 |
|
---|
49 | #define RTCM3_MSM_NUMSIG 32
|
---|
50 | #define RTCM3_MSM_NUMSAT 64
|
---|
51 | #define RTCM3_MSM_NUMCELLS 64
|
---|
52 |
|
---|
53 | /* system identifiers */
|
---|
54 | #define RTCM3_MSM_GPS 0
|
---|
55 | #define RTCM3_MSM_GLONASS 1
|
---|
56 | #define RTCM3_MSM_GALILEO 2
|
---|
57 | #define RTCM3_MSM_SBAS 3
|
---|
58 | #define RTCM3_MSM_QZSS 4
|
---|
59 | #define RTCM3_MSM_COMPASS 5
|
---|
60 |
|
---|
61 | #define RTCM3_MSM_NUMSYS 6
|
---|
62 |
|
---|
63 | #define GNSSENTRY_CODE 0
|
---|
64 | #define GNSSENTRY_PHASE 1
|
---|
65 | #define GNSSENTRY_DOPPLER 2
|
---|
66 | #define GNSSENTRY_SNR 3
|
---|
67 |
|
---|
68 | #define GNSSENTRY_C1DATA ((0<<2)+GNSSENTRY_CODE)
|
---|
69 | #define GNSSENTRY_L1CDATA ((0<<2)+GNSSENTRY_PHASE)
|
---|
70 | #define GNSSENTRY_D1CDATA ((0<<2)+GNSSENTRY_DOPPLER)
|
---|
71 | #define GNSSENTRY_S1CDATA ((0<<2)+GNSSENTRY_SNR)
|
---|
72 |
|
---|
73 | #define GNSSENTRY_C2DATA ((1<<2)+GNSSENTRY_CODE)
|
---|
74 | #define GNSSENTRY_L2CDATA ((1<<2)+GNSSENTRY_PHASE)
|
---|
75 | #define GNSSENTRY_D2CDATA ((1<<2)+GNSSENTRY_DOPPLER)
|
---|
76 | #define GNSSENTRY_S2CDATA ((1<<2)+GNSSENTRY_SNR)
|
---|
77 |
|
---|
78 | #define GNSSENTRY_CB1DATA GNSSENTRY_C2DATA
|
---|
79 | #define GNSSENTRY_LB1DATA GNSSENTRY_L2CDATA
|
---|
80 | #define GNSSENTRY_DB1DATA GNSSENTRY_D2CDATA
|
---|
81 | #define GNSSENTRY_SB1DATA GNSSENTRY_S2CDATA
|
---|
82 |
|
---|
83 | #define GNSSENTRY_P1DATA ((2<<2)+GNSSENTRY_CODE)
|
---|
84 | #define GNSSENTRY_L1PDATA ((2<<2)+GNSSENTRY_PHASE)
|
---|
85 | #define GNSSENTRY_D1PDATA ((2<<2)+GNSSENTRY_DOPPLER)
|
---|
86 | #define GNSSENTRY_S1PDATA ((2<<2)+GNSSENTRY_SNR)
|
---|
87 |
|
---|
88 | #define GNSSENTRY_P2DATA ((3<<2)+GNSSENTRY_CODE)
|
---|
89 | #define GNSSENTRY_L2PDATA ((3<<2)+GNSSENTRY_PHASE)
|
---|
90 | #define GNSSENTRY_D2PDATA ((3<<2)+GNSSENTRY_DOPPLER)
|
---|
91 | #define GNSSENTRY_S2PDATA ((3<<2)+GNSSENTRY_SNR)
|
---|
92 |
|
---|
93 | #define GNSSENTRY_C5DATA ((4<<2)+GNSSENTRY_CODE)
|
---|
94 | #define GNSSENTRY_L5DATA ((4<<2)+GNSSENTRY_PHASE)
|
---|
95 | #define GNSSENTRY_D5DATA ((4<<2)+GNSSENTRY_DOPPLER)
|
---|
96 | #define GNSSENTRY_S5DATA ((4<<2)+GNSSENTRY_SNR)
|
---|
97 |
|
---|
98 | #define GNSSENTRY_C6DATA ((5<<2)+GNSSENTRY_CODE)
|
---|
99 | #define GNSSENTRY_L6DATA ((5<<2)+GNSSENTRY_PHASE)
|
---|
100 | #define GNSSENTRY_D6DATA ((5<<2)+GNSSENTRY_DOPPLER)
|
---|
101 | #define GNSSENTRY_S6DATA ((5<<2)+GNSSENTRY_SNR)
|
---|
102 |
|
---|
103 | #define GNSSENTRY_CB3DATA GNSSENTRY_C6DATA
|
---|
104 | #define GNSSENTRY_LB3DATA GNSSENTRY_L6DATA
|
---|
105 | #define GNSSENTRY_DB3DATA GNSSENTRY_D6DATA
|
---|
106 | #define GNSSENTRY_SB3DATA GNSSENTRY_S6DATA
|
---|
107 |
|
---|
108 | #define GNSSENTRY_CLEXDATA GNSSENTRY_C6DATA
|
---|
109 | #define GNSSENTRY_LLEXDATA GNSSENTRY_L6DATA
|
---|
110 | #define GNSSENTRY_DLEXDATA GNSSENTRY_D6DATA
|
---|
111 | #define GNSSENTRY_SLEXDATA GNSSENTRY_S6DATA
|
---|
112 |
|
---|
113 | #define GNSSENTRY_C5BDATA ((6<<2)+GNSSENTRY_CODE)
|
---|
114 | #define GNSSENTRY_L5BDATA ((6<<2)+GNSSENTRY_PHASE)
|
---|
115 | #define GNSSENTRY_D5BDATA ((6<<2)+GNSSENTRY_DOPPLER)
|
---|
116 | #define GNSSENTRY_S5BDATA ((6<<2)+GNSSENTRY_SNR)
|
---|
117 |
|
---|
118 | #define GNSSENTRY_CB2DATA GNSSENTRY_C5BDATA
|
---|
119 | #define GNSSENTRY_LB2DATA GNSSENTRY_L5BDATA
|
---|
120 | #define GNSSENTRY_DB2DATA GNSSENTRY_D5BDATA
|
---|
121 | #define GNSSENTRY_SB2DATA GNSSENTRY_S5BDATA
|
---|
122 |
|
---|
123 | #define GNSSENTRY_C5ABDATA ((7<<2)+GNSSENTRY_CODE)
|
---|
124 | #define GNSSENTRY_L5ABDATA ((7<<2)+GNSSENTRY_PHASE)
|
---|
125 | #define GNSSENTRY_D5ABDATA ((7<<2)+GNSSENTRY_DOPPLER)
|
---|
126 | #define GNSSENTRY_S5ABDATA ((7<<2)+GNSSENTRY_SNR)
|
---|
127 |
|
---|
128 | #define GNSSENTRY_CSAIFDATA ((8<<2)+GNSSENTRY_CODE)
|
---|
129 | #define GNSSENTRY_LSAIFDATA ((8<<2)+GNSSENTRY_PHASE)
|
---|
130 | #define GNSSENTRY_DSAIFDATA ((8<<2)+GNSSENTRY_DOPPLER)
|
---|
131 | #define GNSSENTRY_SSAIFDATA ((8<<2)+GNSSENTRY_SNR)
|
---|
132 |
|
---|
133 | #define GNSSENTRY_C1NDATA ((9<<2)+GNSSENTRY_CODE)
|
---|
134 | #define GNSSENTRY_L1NDATA ((9<<2)+GNSSENTRY_PHASE)
|
---|
135 | #define GNSSENTRY_D1NDATA ((9<<2)+GNSSENTRY_DOPPLER)
|
---|
136 | #define GNSSENTRY_S1NDATA ((9<<2)+GNSSENTRY_SNR)
|
---|
137 |
|
---|
138 | #define GNSSENTRY_NUMBER 40 /* number of types!!! */
|
---|
139 |
|
---|
140 | /* Data flags. These flags are used in the dataflags field of gpsdata structure
|
---|
141 | and are required to determine, which data fields are filled with valid data. */
|
---|
142 | #define GNSSDF_C1DATA (1<<GNSSENTRY_C1DATA)
|
---|
143 | #define GNSSDF_L1CDATA (1<<GNSSENTRY_L1CDATA)
|
---|
144 | #define GNSSDF_D1CDATA (1<<GNSSENTRY_D1CDATA)
|
---|
145 | #define GNSSDF_S1CDATA (1<<GNSSENTRY_S1CDATA)
|
---|
146 | #define GNSSDF_C2DATA (1<<GNSSENTRY_C2DATA)
|
---|
147 | #define GNSSDF_L2CDATA (1<<GNSSENTRY_L2CDATA)
|
---|
148 | #define GNSSDF_D2CDATA (1<<GNSSENTRY_D2CDATA)
|
---|
149 | #define GNSSDF_S2CDATA (1<<GNSSENTRY_S2CDATA)
|
---|
150 | #define GNSSDF_CB1DATA (1<<GNSSENTRY_CB1DATA)
|
---|
151 | #define GNSSDF_LB1DATA (1<<GNSSENTRY_LB1DATA)
|
---|
152 | #define GNSSDF_DB1DATA (1<<GNSSENTRY_DB1DATA)
|
---|
153 | #define GNSSDF_SB1DATA (1<<GNSSENTRY_SB1DATA)
|
---|
154 | #define GNSSDF_P1DATA (1<<GNSSENTRY_P1DATA)
|
---|
155 | #define GNSSDF_L1PDATA (1<<GNSSENTRY_L1PDATA)
|
---|
156 | #define GNSSDF_D1PDATA (1<<GNSSENTRY_D1PDATA)
|
---|
157 | #define GNSSDF_S1PDATA (1<<GNSSENTRY_S1PDATA)
|
---|
158 | #define GNSSDF_P2DATA (1<<GNSSENTRY_P2DATA)
|
---|
159 | #define GNSSDF_L2PDATA (1<<GNSSENTRY_L2PDATA)
|
---|
160 | #define GNSSDF_D2PDATA (1<<GNSSENTRY_D2PDATA)
|
---|
161 | #define GNSSDF_S2PDATA (1<<GNSSENTRY_S2PDATA)
|
---|
162 |
|
---|
163 | #define GNSSDF_C5DATA (1<<GNSSENTRY_C5DATA)
|
---|
164 | #define GNSSDF_L5DATA (1<<GNSSENTRY_L5DATA)
|
---|
165 | #define GNSSDF_D5DATA (1<<GNSSENTRY_D5DATA)
|
---|
166 | #define GNSSDF_S5DATA (1<<GNSSENTRY_S5DATA)
|
---|
167 | #define GNSSDF_C6DATA (1<<GNSSENTRY_C6DATA)
|
---|
168 | #define GNSSDF_L6DATA (1<<GNSSENTRY_L6DATA)
|
---|
169 | #define GNSSDF_D6DATA (1<<GNSSENTRY_D6DATA)
|
---|
170 | #define GNSSDF_S6DATA (1<<GNSSENTRY_S6DATA)
|
---|
171 | #define GNSSDF_CB3DATA (1<<GNSSENTRY_CB3DATA)
|
---|
172 | #define GNSSDF_LB3DATA (1<<GNSSENTRY_LB3DATA)
|
---|
173 | #define GNSSDF_DB3DATA (1<<GNSSENTRY_DB3DATA)
|
---|
174 | #define GNSSDF_SB3DATA (1<<GNSSENTRY_SB3DATA)
|
---|
175 | #define GNSSDF_C5BDATA (1<<GNSSENTRY_C5BDATA)
|
---|
176 | #define GNSSDF_L5BDATA (1<<GNSSENTRY_L5BDATA)
|
---|
177 | #define GNSSDF_D5BDATA (1<<GNSSENTRY_D5BDATA)
|
---|
178 | #define GNSSDF_S5BDATA (1<<GNSSENTRY_S5BDATA)
|
---|
179 | #define GNSSDF_CB2DATA (1<<GNSSENTRY_CB2DATA)
|
---|
180 | #define GNSSDF_LB2DATA (1<<GNSSENTRY_LB2DATA)
|
---|
181 | #define GNSSDF_DB2DATA (1<<GNSSENTRY_DB2DATA)
|
---|
182 | #define GNSSDF_SB2DATA (1<<GNSSENTRY_SB2DATA)
|
---|
183 | #define GNSSDF_C5ABDATA (1<<GNSSENTRY_C5ABDATA)
|
---|
184 | #define GNSSDF_L5ABDATA (1<<GNSSENTRY_L5ABDATA)
|
---|
185 | #define GNSSDF_D5ABDATA (1<<GNSSENTRY_D5ABDATA)
|
---|
186 | #define GNSSDF_S5ABDATA (1<<GNSSENTRY_S5ABDATA)
|
---|
187 |
|
---|
188 | #define GNSSDF_CSAIFDATA (1LL<<GNSSENTRY_CSAIFDATA)
|
---|
189 | #define GNSSDF_LSAIFDATA (1LL<<GNSSENTRY_LSAIFDATA)
|
---|
190 | #define GNSSDF_DSAIFDATA (1LL<<GNSSENTRY_DSAIFDATA)
|
---|
191 | #define GNSSDF_SSAIFDATA (1LL<<GNSSENTRY_SSAIFDATA)
|
---|
192 |
|
---|
193 | #define GNSSDF_C1NDATA (1LL<<GNSSENTRY_C1NDATA)
|
---|
194 | #define GNSSDF_L1NDATA (1LL<<GNSSENTRY_L1NDATA)
|
---|
195 | #define GNSSDF_D1NDATA (1LL<<GNSSENTRY_D1NDATA)
|
---|
196 | #define GNSSDF_S1NDATA (1LL<<GNSSENTRY_S1NDATA)
|
---|
197 |
|
---|
198 | #define RINEXENTRY_C1DATA 0
|
---|
199 | #define RINEXENTRY_C2DATA 1
|
---|
200 | #define RINEXENTRY_P1DATA 2
|
---|
201 | #define RINEXENTRY_P2DATA 3
|
---|
202 | #define RINEXENTRY_L1DATA 4
|
---|
203 | #define RINEXENTRY_L2DATA 5
|
---|
204 | #define RINEXENTRY_D1DATA 6
|
---|
205 | #define RINEXENTRY_D2DATA 7
|
---|
206 | #define RINEXENTRY_S1DATA 8
|
---|
207 | #define RINEXENTRY_S2DATA 9
|
---|
208 |
|
---|
209 | #define RINEXENTRY_C5DATA 10
|
---|
210 | #define RINEXENTRY_L5DATA 11
|
---|
211 | #define RINEXENTRY_D5DATA 12
|
---|
212 | #define RINEXENTRY_S5DATA 13
|
---|
213 | #define RINEXENTRY_C6DATA 14
|
---|
214 | #define RINEXENTRY_L6DATA 15
|
---|
215 | #define RINEXENTRY_D6DATA 16
|
---|
216 | #define RINEXENTRY_S6DATA 17
|
---|
217 | #define RINEXENTRY_C7DATA 18 /* 5B */
|
---|
218 | #define RINEXENTRY_L7DATA 19
|
---|
219 | #define RINEXENTRY_D7DATA 20
|
---|
220 | #define RINEXENTRY_S7DATA 21
|
---|
221 | #define RINEXENTRY_C8DATA 22 /* 5AB */
|
---|
222 | #define RINEXENTRY_L8DATA 23
|
---|
223 | #define RINEXENTRY_D8DATA 24
|
---|
224 | #define RINEXENTRY_S8DATA 25
|
---|
225 |
|
---|
226 | #define RINEXENTRY_NUMBER 26
|
---|
227 |
|
---|
228 | #define LIGHTSPEED 2.99792458e8 /* m/sec */
|
---|
229 | #define GPS_FREQU_L1 1575420000.0 /* Hz */
|
---|
230 | #define GPS_FREQU_L2 1227600000.0 /* Hz */
|
---|
231 | #define GPS_FREQU_L5 1176450000.0 /* Hz */
|
---|
232 | #define GPS_WAVELENGTH_L1 (LIGHTSPEED / GPS_FREQU_L1) /* m */
|
---|
233 | #define GPS_WAVELENGTH_L2 (LIGHTSPEED / GPS_FREQU_L2) /* m */
|
---|
234 | #define GPS_WAVELENGTH_L5 (LIGHTSPEED / GPS_FREQU_L5) /* m */
|
---|
235 |
|
---|
236 | #define GLO_FREQU_L1_BASE 1602000000.0 /* Hz */
|
---|
237 | #define GLO_FREQU_L2_BASE 1246000000.0 /* Hz */
|
---|
238 | #define GLO_FREQU_L1_STEP 562500.0 /* Hz */
|
---|
239 | #define GLO_FREQU_L2_STEP 437500.0 /* Hz */
|
---|
240 | #define GLO_FREQU_L1(a) (GLO_FREQU_L1_BASE+(a)*GLO_FREQU_L1_STEP)
|
---|
241 | #define GLO_FREQU_L2(a) (GLO_FREQU_L2_BASE+(a)*GLO_FREQU_L2_STEP)
|
---|
242 | #define GLO_WAVELENGTH_L1(a) (LIGHTSPEED / GLO_FREQU_L1(a)) /* m */
|
---|
243 | #define GLO_WAVELENGTH_L2(a) (LIGHTSPEED / GLO_FREQU_L2(a)) /* m */
|
---|
244 |
|
---|
245 | #define GAL_FREQU_E1 1575420000.0 /* Hz */
|
---|
246 | #define GAL_FREQU_E5A 1176450000.0 /* Hz */
|
---|
247 | #define GAL_FREQU_E5AB 1197950000.0 /* Hz */
|
---|
248 | #define GAL_FREQU_E5B 1207140000.0 /* Hz */
|
---|
249 | #define GAL_FREQU_E6 1278750000.0 /* Hz */
|
---|
250 | #define GAL_WAVELENGTH_E1 (LIGHTSPEED / GAL_FREQU_E1) /* m */
|
---|
251 | #define GAL_WAVELENGTH_E5A (LIGHTSPEED / GAL_FREQU_E5A) /* m */
|
---|
252 | #define GAL_WAVELENGTH_E5AB (LIGHTSPEED / GAL_FREQU_E5AB) /* m */
|
---|
253 | #define GAL_WAVELENGTH_E5B (LIGHTSPEED / GAL_FREQU_E5B) /* m */
|
---|
254 | #define GAL_WAVELENGTH_E6 (LIGHTSPEED / GAL_FREQU_E6) /* m */
|
---|
255 |
|
---|
256 | #define QZSS_FREQU_L1 1575420000.0 /* Hz */
|
---|
257 | #define QZSS_FREQU_L2 1227600000.0 /* Hz */
|
---|
258 | #define QZSS_FREQU_L5 1176450000.0 /* Hz */
|
---|
259 | #define QZSS_FREQU_LEX 1278750000.0 /* Hz */
|
---|
260 | #define QZSS_WAVELENGTH_L1 (LIGHTSPEED / QZSS_FREQU_L1) /* m */
|
---|
261 | #define QZSS_WAVELENGTH_L2 (LIGHTSPEED / QZSS_FREQU_L2) /* m */
|
---|
262 | #define QZSS_WAVELENGTH_L5 (LIGHTSPEED / QZSS_FREQU_L5) /* m */
|
---|
263 | #define QZSS_WAVELENGTH_LEX (LIGHTSPEED / QZSS_FREQU_LEX) /* m */
|
---|
264 |
|
---|
265 | #define COMPASS_FREQU_B1 1561098000.0 /* Hz */
|
---|
266 | #define COMPASS_FREQU_B2 1207140000.0 /* Hz */
|
---|
267 | #define COMPASS_FREQU_B3 1268520000.0 /* Hz */
|
---|
268 | #define COMPASS_WAVELENGTH_B1 (LIGHTSPEED / COMPASS_FREQU_B1) /* m */
|
---|
269 | #define COMPASS_WAVELENGTH_B2 (LIGHTSPEED / COMPASS_FREQU_B2) /* m */
|
---|
270 | #define COMPASS_WAVELENGTH_B3 (LIGHTSPEED / COMPASS_FREQU_B3) /* m */
|
---|
271 |
|
---|
272 | #define PRN_GIOVE_OFFSET 51
|
---|
273 |
|
---|
274 | /* Additional flags for the data field, which tell us more. */
|
---|
275 | #define GNSSDF2_XCORRL2 (1<<0) /* cross-correlated L2 */
|
---|
276 | #define GNSSDF2_LOCKLOSSL1 (1<<1) /* lost lock on L1 */
|
---|
277 | #define GNSSDF2_LOCKLOSSL2 (1<<2) /* lost lock on L2 */
|
---|
278 | #define GNSSDF2_LOCKLOSSL5 (1<<3) /* lost lock on L5 */
|
---|
279 | #define GNSSDF2_LOCKLOSSE6 (1<<4) /* lost lock on E6 */
|
---|
280 | #define GNSSDF2_LOCKLOSSE5B (1<<5) /* lost lock on E5B */
|
---|
281 | #define GNSSDF2_LOCKLOSSE5AB (1<<6) /* lost lock on E5AB */
|
---|
282 | #define GNSSDF2_LOCKLOSSB1 GNSSDF2_LOCKLOSSL2
|
---|
283 | #define GNSSDF2_LOCKLOSSB2 GNSSDF2_LOCKLOSSE5B
|
---|
284 | #define GNSSDF2_LOCKLOSSB3 GNSSDF2_LOCKLOSSE6
|
---|
285 | #define GNSSDF2_LOCKLOSSLEX GNSSDF2_LOCKLOSSE6
|
---|
286 | #define GNSSDF2_LOCKLOSSSAIF (1<<9) /* lost lock on SAIF signal */
|
---|
287 |
|
---|
288 | #define UINT64(c) c ## ULL
|
---|
289 |
|
---|
290 | struct converttimeinfo {
|
---|
291 | int second; /* seconds of GPS time [0..59] */
|
---|
292 | int minute; /* minutes of GPS time [0..59] */
|
---|
293 | int hour; /* hour of GPS time [0..24] */
|
---|
294 | int day; /* day of GPS time [1..28..30(31)*/
|
---|
295 | int month; /* month of GPS time [1..12]*/
|
---|
296 | int year; /* year of GPS time [1980..] */
|
---|
297 | };
|
---|
298 |
|
---|
299 | struct gnssdata {
|
---|
300 | int flags; /* GNSSF_xxx */
|
---|
301 | int week; /* week number of GPS date */
|
---|
302 | int numsats;
|
---|
303 | double timeofweek; /* milliseconds in GPS week */
|
---|
304 | double measdata[GNSS_MAXSATS][GNSSENTRY_NUMBER]; /* data fields */
|
---|
305 | unsigned long long dataflags[GNSS_MAXSATS]; /* GNSSDF_xxx */
|
---|
306 | unsigned int dataflags2[GNSS_MAXSATS]; /* GNSSDF2_xxx */
|
---|
307 | int satellites[GNSS_MAXSATS]; /* SV - IDs */
|
---|
308 | int snrL1[GNSS_MAXSATS]; /* Important: all the 6 SV-specific fields must */
|
---|
309 | int snrL2[GNSS_MAXSATS]; /* have the same SV-order */
|
---|
310 | const char * codetype[GNSS_MAXSATS][GNSSENTRY_NUMBER];
|
---|
311 | };
|
---|
312 |
|
---|
313 | #define GPSEPHF_L2PCODEDATA (1<<0) /* set, if NAV data OFF on L2 P-code, s1w4b01 */
|
---|
314 | #define GPSEPHF_L2PCODE (1<<1) /* set, if P-code available, s1w3b12 */
|
---|
315 | #define GPSEPHF_L2CACODE (1<<2) /* set, if CA-code available, s1w3b11 */
|
---|
316 | #define GPSEPHF_VALIDATED (1<<3) /* data is completely valid */
|
---|
317 |
|
---|
318 | #define R2R_PI 3.1415926535898
|
---|
319 |
|
---|
320 | struct gpsephemeris {
|
---|
321 | int flags; /* GPSEPHF_xxx */
|
---|
322 | int satellite; /* SV ID ICD-GPS data position */
|
---|
323 | int IODE; /* [s2w3b01-08] */
|
---|
324 | int URAindex; /* [1..15] [s1w3b13-16] */
|
---|
325 | int SVhealth; /* [s1w3b17-22] */
|
---|
326 | int GPSweek; /* [s1w3b01-10] */
|
---|
327 | int IODC; /* [s1w3b23-32,w8b01-08] */
|
---|
328 | int TOW; /* [s] [s1w2b01-17] */
|
---|
329 | int TOC; /* [s] [s1w8b09-24] */
|
---|
330 | int TOE; /* [s] [s2w10b1-16] */
|
---|
331 | double clock_bias; /* [s] [s1w10b1-22, af0] */
|
---|
332 | double clock_drift; /* [s/s] [s1w9b09-24, af1] */
|
---|
333 | double clock_driftrate; /* [s/s^2] [s1w9b01-08, af2] */
|
---|
334 | double Crs; /* [m] [s2w3b09-24] */
|
---|
335 | double Delta_n; /* [rad/s] [s2w4b01-16 * Pi] */
|
---|
336 | double M0; /* [rad] [s2w4b17-24,w5b01-24 * Pi]*/
|
---|
337 | double Cuc; /* [rad] [s2w6b01-16] */
|
---|
338 | double e; /* [s2w6b17-24,w6b01-24] */
|
---|
339 | double Cus; /* [rad] [s2w8b01-16] */
|
---|
340 | double sqrt_A; /* [m^0.5] [s2w8b16-24,w9b01-24] */
|
---|
341 | double Cic; /* [rad] [s3w3b01-16] */
|
---|
342 | double OMEGA0; /* [rad] [s3w3b17-24,w4b01-24 * Pi]*/
|
---|
343 | double Cis; /* [rad] [s3w5b01-16] */
|
---|
344 | double i0; /* [rad] [s3w5b17-24,w6b01-24 * Pi]*/
|
---|
345 | double Crc; /* [m] [s3w701-16] */
|
---|
346 | double omega; /* [rad] [s3w7b17-24,w8b01-24 * Pi]*/
|
---|
347 | double OMEGADOT; /* [rad/s] [s3w9b01-24 * Pi] */
|
---|
348 | double IDOT; /* [rad/s] [s3w10b9-22 * Pi] */
|
---|
349 | double TGD; /* [s] [s1w7b17-24] */
|
---|
350 | };
|
---|
351 |
|
---|
352 | #define GALEPHF_E5ADINVALID (1<<0) /* E5aDVS set invalid */
|
---|
353 |
|
---|
354 | #define GLOEPHF_UNHEALTHY (1<<0) /* set if unhealty satellite, f2b78 */
|
---|
355 | #define GLOEPHF_ALMANACHEALTHOK (1<<1) /* set if ALM health is available */
|
---|
356 | #define GLOEPHF_ALMANACHEALTHY (1<<2) /* set if Cn word is true */
|
---|
357 | #define GLOEPHF_PAVAILABLE (1<<3) /* set if the 3 P flags are available */
|
---|
358 | #define GLOEPHF_P10TRUE (1<<4)
|
---|
359 | #define GLOEPHF_P11TRUE (1<<5)
|
---|
360 | #define GLOEPHF_P2TRUE (1<<6)
|
---|
361 | #define GLOEPHF_P3TRUE (1<<7)
|
---|
362 |
|
---|
363 | struct glonassephemeris {
|
---|
364 | int GPSWeek;
|
---|
365 | int GPSTOW;
|
---|
366 | int flags; /* GLOEPHF_xxx */
|
---|
367 | int almanac_number;
|
---|
368 | int frequency_number; /* ICD-GLONASS data position */
|
---|
369 | int tb; /* [s] [f2b70-76] */
|
---|
370 | int tk; /* [s] [f1b65-76] */
|
---|
371 | int E; /* [days] [f4b49-53] */
|
---|
372 | double tau; /* [s] [f4b59-80] */
|
---|
373 | double gamma; /* [f3b69-79] */
|
---|
374 | double x_pos; /* [km] [f1b09-35] */
|
---|
375 | double x_velocity; /* [km/s] [f1b41-64] */
|
---|
376 | double x_acceleration; /* [km/s^2][f1b36-40] */
|
---|
377 | double y_pos; /* [km] [f2b09-35] */
|
---|
378 | double y_velocity; /* [km/s] [f2b41-64] */
|
---|
379 | double y_acceleration; /* [km/s^2][f2b36-40] */
|
---|
380 | double z_pos; /* [km] [f3b09-35] */
|
---|
381 | double z_velocity; /* [km/s] [f3b41-64] */
|
---|
382 | double z_acceleration; /* [km/s^2][f3b36-40] */
|
---|
383 | };
|
---|
384 |
|
---|
385 | struct galileoephemeris {
|
---|
386 | int flags; /* GALEPHF_xxx */
|
---|
387 | int satellite; /* SV ID */
|
---|
388 | int IODnav;
|
---|
389 | int TOC; /* [s] */
|
---|
390 | int TOE; /* [s] */
|
---|
391 | double clock_bias; /* [s] */
|
---|
392 | double clock_drift; /* [s/s] */
|
---|
393 | double clock_driftrate; /* [s/s^2] */
|
---|
394 | double Crs; /* [m] */
|
---|
395 | double Delta_n; /* [rad/s] */
|
---|
396 | double M0; /* [rad] */
|
---|
397 | double Cuc; /* [rad] */
|
---|
398 | double e;
|
---|
399 | double Cus; /* [rad] */
|
---|
400 | double sqrt_A; /* [m^0.5] */
|
---|
401 | double Cic; /* [rad] */
|
---|
402 | double OMEGA0; /* [rad] */
|
---|
403 | double Cis; /* [rad] */
|
---|
404 | double i0; /* [rad] */
|
---|
405 | double Crc; /* [m] */
|
---|
406 | double omega; /* [rad] */
|
---|
407 | double OMEGADOT; /* [rad/s] */
|
---|
408 | double IDOT; /* [rad/s] */
|
---|
409 | double BGD_1_5A; /* [s] */
|
---|
410 | double BGD_1_5B; /* [s] */
|
---|
411 | int Week;
|
---|
412 | int SISA;
|
---|
413 | int E5aHS;
|
---|
414 | };
|
---|
415 |
|
---|
416 | struct DataInfo {
|
---|
417 | long long flags[RINEXENTRY_NUMBER];
|
---|
418 | int pos[RINEXENTRY_NUMBER];
|
---|
419 | int numtypes;
|
---|
420 | char type[GNSSENTRY_NUMBER];
|
---|
421 | };
|
---|
422 |
|
---|
423 | struct RTCM3ParserData {
|
---|
424 | unsigned char Message[2048]; /* input-buffer */
|
---|
425 | int MessageSize; /* current buffer size */
|
---|
426 | int NeedBytes; /* bytes wanted for next run */
|
---|
427 | int SkipBytes; /* bytes to skip in next round */
|
---|
428 | int GPSWeek;
|
---|
429 | int GPSTOW; /* in seconds */
|
---|
430 | struct gnssdata Data;
|
---|
431 | struct gpsephemeris ephemerisGPS;
|
---|
432 | struct galileoephemeris ephemerisGALILEO;
|
---|
433 | struct glonassephemeris ephemerisGLONASS;
|
---|
434 | struct gnssdata DataNew;
|
---|
435 | int GLOFreq[PRN_GLONASS_NUM]; /* frequency numbers of GLONASS + 100 */
|
---|
436 | int size;
|
---|
437 | int lastlockGPSl1[64];
|
---|
438 | int lastlockGPSl2[64];
|
---|
439 | int lastlockGLOl1[64];
|
---|
440 | int lastlockGLOl2[64];
|
---|
441 | int lastlockmsm[RTCM3_MSM_NUMCELLS][NUMRTCM3PARSERSATS];
|
---|
442 | #ifdef NO_RTCM3_MAIN
|
---|
443 | double antX;
|
---|
444 | double antY;
|
---|
445 | double antZ;
|
---|
446 | double antH;
|
---|
447 | char antenna[256+1];
|
---|
448 | int blocktype;
|
---|
449 | int allflags;
|
---|
450 | int modjulday;
|
---|
451 | int secofday;
|
---|
452 | int leapsec;
|
---|
453 | #endif /* NO_RTCM3_MAIN */
|
---|
454 | int pos[RINEXENTRY_NUMBER];
|
---|
455 | long long flags[RINEXENTRY_NUMBER];
|
---|
456 | /* For RINEX2 only field GPS is used */
|
---|
457 | struct DataInfo info[RTCM3_MSM_NUMSYS];
|
---|
458 | int validwarning;
|
---|
459 | int init;
|
---|
460 | int startflags;
|
---|
461 | int rinex3;
|
---|
462 | const char * headerfile;
|
---|
463 | const char * glonassephemeris;
|
---|
464 | const char * gpsephemeris;
|
---|
465 | FILE * glonassfile;
|
---|
466 | FILE * gpsfile;
|
---|
467 | };
|
---|
468 |
|
---|
469 | #ifndef PRINTFARG
|
---|
470 | #ifdef __GNUC__
|
---|
471 | #define PRINTFARG(a,b) __attribute__ ((format(printf, a, b)))
|
---|
472 | #else /* __GNUC__ */
|
---|
473 | #define PRINTFARG(a,b)
|
---|
474 | #endif /* __GNUC__ */
|
---|
475 | #endif /* PRINTFARG */
|
---|
476 |
|
---|
477 | int gnumleap(int year, int month, int day);
|
---|
478 | void updatetime(int *week, int *tow, int tk, int fixnumleap);
|
---|
479 | void converttime(struct converttimeinfo *c, int week, int tow);
|
---|
480 |
|
---|
481 | void HandleHeader(struct RTCM3ParserData *Parser);
|
---|
482 | int RTCM3Parser(struct RTCM3ParserData *handle);
|
---|
483 | void HandleByte(struct RTCM3ParserData *Parser, unsigned int byte);
|
---|
484 | void PRINTFARG(1,2) RTCM3Error(const char *fmt, ...);
|
---|
485 | void PRINTFARG(1,2) RTCM3Text(const char *fmt, ...);
|
---|
486 |
|
---|
487 | #endif /* RTCM3TORINEX_H */
|
---|