1 | #ifndef RTCM3TORINEX_H
|
---|
2 | #define RTCM3TORINEX_H
|
---|
3 |
|
---|
4 | /*
|
---|
5 | Converter for RTCM3 data to RINEX.
|
---|
6 | $Id: rtcm3torinex.h 6757 2015-04-02 13:41:56Z stoecker $
|
---|
7 | Copyright (C) 2005-2012 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_GIOVE_START 101
|
---|
39 | #define PRN_GIOVE_END 102
|
---|
40 | #define PRN_SBAS_START 120
|
---|
41 | #define PRN_SBAS_END 141
|
---|
42 | #define PRN_BDS_START 161
|
---|
43 | #define PRN_BDS_END 190
|
---|
44 | #define PRN_QZSS_START 193
|
---|
45 | #define PRN_QZSS_END 202
|
---|
46 |
|
---|
47 | #define PRN_GALGIO_START PRN_GALILEO_START
|
---|
48 | #define PRN_GALGIO_END PRN_GIOVE_END
|
---|
49 |
|
---|
50 | #define PRN_GLONASS_NUM (PRN_GLONASS_END-PRN_GLONASS_START+1)
|
---|
51 |
|
---|
52 | #define RTCM3_MSM_NUMSIG 32
|
---|
53 | #define RTCM3_MSM_NUMSAT 64
|
---|
54 | #define RTCM3_MSM_NUMCELLS 96 /* arbitrary limit */
|
---|
55 |
|
---|
56 | /* system identifiers */
|
---|
57 | #define RTCM3_MSM_GPS 0
|
---|
58 | #define RTCM3_MSM_GLONASS 1
|
---|
59 | #define RTCM3_MSM_GALILEO 2
|
---|
60 | #define RTCM3_MSM_SBAS 3
|
---|
61 | #define RTCM3_MSM_QZSS 4
|
---|
62 | #define RTCM3_MSM_BDS 5
|
---|
63 |
|
---|
64 | #define RTCM3_MSM_NUMSYS 6
|
---|
65 |
|
---|
66 | #define GNSSENTRY_CODE 0
|
---|
67 | #define GNSSENTRY_PHASE 1
|
---|
68 | #define GNSSENTRY_DOPPLER 2
|
---|
69 | #define GNSSENTRY_SNR 3
|
---|
70 |
|
---|
71 | #define GNSSENTRY_TYPEC1 (0<<2)
|
---|
72 | #define GNSSENTRY_TYPEC2 (1<<2)
|
---|
73 | #define GNSSENTRY_TYPEP1 (2<<2)
|
---|
74 | #define GNSSENTRY_TYPEP2 (3<<2)
|
---|
75 | #define GNSSENTRY_TYPEC5 (4<<2)
|
---|
76 | #define GNSSENTRY_TYPEC6 (5<<2)
|
---|
77 | #define GNSSENTRY_TYPEC5B (6<<2)
|
---|
78 | #define GNSSENTRY_TYPEC5AB (7<<2)
|
---|
79 | #define GNSSENTRY_TYPECSAIF (8<<2)
|
---|
80 | #define GNSSENTRY_TYPEC1N (9<<2)
|
---|
81 |
|
---|
82 | #define GNSSENTRY_C1DATA (GNSSENTRY_TYPEC1+GNSSENTRY_CODE)
|
---|
83 | #define GNSSENTRY_L1CDATA (GNSSENTRY_TYPEC1+GNSSENTRY_PHASE)
|
---|
84 | #define GNSSENTRY_D1CDATA (GNSSENTRY_TYPEC1+GNSSENTRY_DOPPLER)
|
---|
85 | #define GNSSENTRY_S1CDATA (GNSSENTRY_TYPEC1+GNSSENTRY_SNR)
|
---|
86 |
|
---|
87 | #define GNSSENTRY_C2DATA (GNSSENTRY_TYPEC2+GNSSENTRY_CODE)
|
---|
88 | #define GNSSENTRY_L2CDATA (GNSSENTRY_TYPEC2+GNSSENTRY_PHASE)
|
---|
89 | #define GNSSENTRY_D2CDATA (GNSSENTRY_TYPEC2+GNSSENTRY_DOPPLER)
|
---|
90 | #define GNSSENTRY_S2CDATA (GNSSENTRY_TYPEC2+GNSSENTRY_SNR)
|
---|
91 |
|
---|
92 | #define GNSSENTRY_CB1DATA GNSSENTRY_C1DATA
|
---|
93 | #define GNSSENTRY_LB1DATA GNSSENTRY_L1CDATA
|
---|
94 | #define GNSSENTRY_DB1DATA GNSSENTRY_D1CDATA
|
---|
95 | #define GNSSENTRY_SB1DATA GNSSENTRY_S1CDATA
|
---|
96 |
|
---|
97 | #define GNSSENTRY_P1DATA (GNSSENTRY_TYPEP1+GNSSENTRY_CODE)
|
---|
98 | #define GNSSENTRY_L1PDATA (GNSSENTRY_TYPEP1+GNSSENTRY_PHASE)
|
---|
99 | #define GNSSENTRY_D1PDATA (GNSSENTRY_TYPEP1+GNSSENTRY_DOPPLER)
|
---|
100 | #define GNSSENTRY_S1PDATA (GNSSENTRY_TYPEP1+GNSSENTRY_SNR)
|
---|
101 |
|
---|
102 | #define GNSSENTRY_P2DATA (GNSSENTRY_TYPEP2+GNSSENTRY_CODE)
|
---|
103 | #define GNSSENTRY_L2PDATA (GNSSENTRY_TYPEP2+GNSSENTRY_PHASE)
|
---|
104 | #define GNSSENTRY_D2PDATA (GNSSENTRY_TYPEP2+GNSSENTRY_DOPPLER)
|
---|
105 | #define GNSSENTRY_S2PDATA (GNSSENTRY_TYPEP2+GNSSENTRY_SNR)
|
---|
106 |
|
---|
107 | #define GNSSENTRY_C5DATA (GNSSENTRY_TYPEC5+GNSSENTRY_CODE)
|
---|
108 | #define GNSSENTRY_L5DATA (GNSSENTRY_TYPEC5+GNSSENTRY_PHASE)
|
---|
109 | #define GNSSENTRY_D5DATA (GNSSENTRY_TYPEC5+GNSSENTRY_DOPPLER)
|
---|
110 | #define GNSSENTRY_S5DATA (GNSSENTRY_TYPEC5+GNSSENTRY_SNR)
|
---|
111 |
|
---|
112 | #define GNSSENTRY_C6DATA (GNSSENTRY_TYPEC6+GNSSENTRY_CODE)
|
---|
113 | #define GNSSENTRY_L6DATA (GNSSENTRY_TYPEC6+GNSSENTRY_PHASE)
|
---|
114 | #define GNSSENTRY_D6DATA (GNSSENTRY_TYPEC6+GNSSENTRY_DOPPLER)
|
---|
115 | #define GNSSENTRY_S6DATA (GNSSENTRY_TYPEC6+GNSSENTRY_SNR)
|
---|
116 |
|
---|
117 | #define GNSSENTRY_CB3DATA GNSSENTRY_C6DATA
|
---|
118 | #define GNSSENTRY_LB3DATA GNSSENTRY_L6DATA
|
---|
119 | #define GNSSENTRY_DB3DATA GNSSENTRY_D6DATA
|
---|
120 | #define GNSSENTRY_SB3DATA GNSSENTRY_S6DATA
|
---|
121 |
|
---|
122 | #define GNSSENTRY_CLEXDATA GNSSENTRY_C6DATA
|
---|
123 | #define GNSSENTRY_LLEXDATA GNSSENTRY_L6DATA
|
---|
124 | #define GNSSENTRY_DLEXDATA GNSSENTRY_D6DATA
|
---|
125 | #define GNSSENTRY_SLEXDATA GNSSENTRY_S6DATA
|
---|
126 |
|
---|
127 | #define GNSSENTRY_C5BDATA (GNSSENTRY_TYPEC5B+GNSSENTRY_CODE)
|
---|
128 | #define GNSSENTRY_L5BDATA (GNSSENTRY_TYPEC5B+GNSSENTRY_PHASE)
|
---|
129 | #define GNSSENTRY_D5BDATA (GNSSENTRY_TYPEC5B+GNSSENTRY_DOPPLER)
|
---|
130 | #define GNSSENTRY_S5BDATA (GNSSENTRY_TYPEC5B+GNSSENTRY_SNR)
|
---|
131 |
|
---|
132 | #define GNSSENTRY_CB2DATA GNSSENTRY_C5BDATA
|
---|
133 | #define GNSSENTRY_LB2DATA GNSSENTRY_L5BDATA
|
---|
134 | #define GNSSENTRY_DB2DATA GNSSENTRY_D5BDATA
|
---|
135 | #define GNSSENTRY_SB2DATA GNSSENTRY_S5BDATA
|
---|
136 |
|
---|
137 | #define GNSSENTRY_C5ABDATA (GNSSENTRY_TYPEC5AB+GNSSENTRY_CODE)
|
---|
138 | #define GNSSENTRY_L5ABDATA (GNSSENTRY_TYPEC5AB+GNSSENTRY_PHASE)
|
---|
139 | #define GNSSENTRY_D5ABDATA (GNSSENTRY_TYPEC5AB+GNSSENTRY_DOPPLER)
|
---|
140 | #define GNSSENTRY_S5ABDATA (GNSSENTRY_TYPEC5AB+GNSSENTRY_SNR)
|
---|
141 |
|
---|
142 | #define GNSSENTRY_CSAIFDATA (GNSSENTRY_TYPECSAIF+GNSSENTRY_CODE)
|
---|
143 | #define GNSSENTRY_LSAIFDATA (GNSSENTRY_TYPECSAIF+GNSSENTRY_PHASE)
|
---|
144 | #define GNSSENTRY_DSAIFDATA (GNSSENTRY_TYPECSAIF+GNSSENTRY_DOPPLER)
|
---|
145 | #define GNSSENTRY_SSAIFDATA (GNSSENTRY_TYPECSAIF+GNSSENTRY_SNR)
|
---|
146 |
|
---|
147 | #define GNSSENTRY_C1NDATA (GNSSENTRY_TYPEC1N+GNSSENTRY_CODE)
|
---|
148 | #define GNSSENTRY_L1NDATA (GNSSENTRY_TYPEC1N+GNSSENTRY_PHASE)
|
---|
149 | #define GNSSENTRY_D1NDATA (GNSSENTRY_TYPEC1N+GNSSENTRY_DOPPLER)
|
---|
150 | #define GNSSENTRY_S1NDATA (GNSSENTRY_TYPEC1N+GNSSENTRY_SNR)
|
---|
151 |
|
---|
152 | #define GNSSENTRY_NUMBER 40 /* number of types!!! */
|
---|
153 |
|
---|
154 | /* Data flags. These flags are used in the dataflags field of gpsdata structure
|
---|
155 | and are required to determine, which data fields are filled with valid data. */
|
---|
156 | #define GNSSDF_C1DATA (1<<GNSSENTRY_C1DATA)
|
---|
157 | #define GNSSDF_L1CDATA (1<<GNSSENTRY_L1CDATA)
|
---|
158 | #define GNSSDF_D1CDATA (1<<GNSSENTRY_D1CDATA)
|
---|
159 | #define GNSSDF_S1CDATA (1<<GNSSENTRY_S1CDATA)
|
---|
160 | #define GNSSDF_C2DATA (1<<GNSSENTRY_C2DATA)
|
---|
161 | #define GNSSDF_L2CDATA (1<<GNSSENTRY_L2CDATA)
|
---|
162 | #define GNSSDF_D2CDATA (1<<GNSSENTRY_D2CDATA)
|
---|
163 | #define GNSSDF_S2CDATA (1<<GNSSENTRY_S2CDATA)
|
---|
164 | #define GNSSDF_CB1DATA (1<<GNSSENTRY_CB1DATA)
|
---|
165 | #define GNSSDF_LB1DATA (1<<GNSSENTRY_LB1DATA)
|
---|
166 | #define GNSSDF_DB1DATA (1<<GNSSENTRY_DB1DATA)
|
---|
167 | #define GNSSDF_SB1DATA (1<<GNSSENTRY_SB1DATA)
|
---|
168 | #define GNSSDF_P1DATA (1<<GNSSENTRY_P1DATA)
|
---|
169 | #define GNSSDF_L1PDATA (1<<GNSSENTRY_L1PDATA)
|
---|
170 | #define GNSSDF_D1PDATA (1<<GNSSENTRY_D1PDATA)
|
---|
171 | #define GNSSDF_S1PDATA (1<<GNSSENTRY_S1PDATA)
|
---|
172 | #define GNSSDF_P2DATA (1<<GNSSENTRY_P2DATA)
|
---|
173 | #define GNSSDF_L2PDATA (1<<GNSSENTRY_L2PDATA)
|
---|
174 | #define GNSSDF_D2PDATA (1<<GNSSENTRY_D2PDATA)
|
---|
175 | #define GNSSDF_S2PDATA (1<<GNSSENTRY_S2PDATA)
|
---|
176 |
|
---|
177 | #define GNSSDF_C5DATA (1<<GNSSENTRY_C5DATA)
|
---|
178 | #define GNSSDF_L5DATA (1<<GNSSENTRY_L5DATA)
|
---|
179 | #define GNSSDF_D5DATA (1<<GNSSENTRY_D5DATA)
|
---|
180 | #define GNSSDF_S5DATA (1<<GNSSENTRY_S5DATA)
|
---|
181 | #define GNSSDF_C6DATA (1<<GNSSENTRY_C6DATA)
|
---|
182 | #define GNSSDF_L6DATA (1<<GNSSENTRY_L6DATA)
|
---|
183 | #define GNSSDF_D6DATA (1<<GNSSENTRY_D6DATA)
|
---|
184 | #define GNSSDF_S6DATA (1<<GNSSENTRY_S6DATA)
|
---|
185 | #define GNSSDF_CB3DATA (1<<GNSSENTRY_CB3DATA)
|
---|
186 | #define GNSSDF_LB3DATA (1<<GNSSENTRY_LB3DATA)
|
---|
187 | #define GNSSDF_DB3DATA (1<<GNSSENTRY_DB3DATA)
|
---|
188 | #define GNSSDF_SB3DATA (1<<GNSSENTRY_SB3DATA)
|
---|
189 | #define GNSSDF_C5BDATA (1<<GNSSENTRY_C5BDATA)
|
---|
190 | #define GNSSDF_L5BDATA (1<<GNSSENTRY_L5BDATA)
|
---|
191 | #define GNSSDF_D5BDATA (1<<GNSSENTRY_D5BDATA)
|
---|
192 | #define GNSSDF_S5BDATA (1<<GNSSENTRY_S5BDATA)
|
---|
193 | #define GNSSDF_CB2DATA (1<<GNSSENTRY_CB2DATA)
|
---|
194 | #define GNSSDF_LB2DATA (1<<GNSSENTRY_LB2DATA)
|
---|
195 | #define GNSSDF_DB2DATA (1<<GNSSENTRY_DB2DATA)
|
---|
196 | #define GNSSDF_SB2DATA (1<<GNSSENTRY_SB2DATA)
|
---|
197 | #define GNSSDF_C5ABDATA (1<<GNSSENTRY_C5ABDATA)
|
---|
198 | #define GNSSDF_L5ABDATA (1<<GNSSENTRY_L5ABDATA)
|
---|
199 | #define GNSSDF_D5ABDATA (1<<GNSSENTRY_D5ABDATA)
|
---|
200 | #define GNSSDF_S5ABDATA (1<<GNSSENTRY_S5ABDATA)
|
---|
201 |
|
---|
202 | #define GNSSDF_CSAIFDATA (1LL<<GNSSENTRY_CSAIFDATA)
|
---|
203 | #define GNSSDF_LSAIFDATA (1LL<<GNSSENTRY_LSAIFDATA)
|
---|
204 | #define GNSSDF_DSAIFDATA (1LL<<GNSSENTRY_DSAIFDATA)
|
---|
205 | #define GNSSDF_SSAIFDATA (1LL<<GNSSENTRY_SSAIFDATA)
|
---|
206 |
|
---|
207 | #define GNSSDF_C1NDATA (1LL<<GNSSENTRY_C1NDATA)
|
---|
208 | #define GNSSDF_L1NDATA (1LL<<GNSSENTRY_L1NDATA)
|
---|
209 | #define GNSSDF_D1NDATA (1LL<<GNSSENTRY_D1NDATA)
|
---|
210 | #define GNSSDF_S1NDATA (1LL<<GNSSENTRY_S1NDATA)
|
---|
211 |
|
---|
212 | #define RINEXENTRY_C1DATA 0
|
---|
213 | #define RINEXENTRY_C2DATA 1
|
---|
214 | #define RINEXENTRY_P1DATA 2
|
---|
215 | #define RINEXENTRY_P2DATA 3
|
---|
216 | #define RINEXENTRY_L1DATA 4
|
---|
217 | #define RINEXENTRY_L2DATA 5
|
---|
218 | #define RINEXENTRY_D1DATA 6
|
---|
219 | #define RINEXENTRY_D2DATA 7
|
---|
220 | #define RINEXENTRY_S1DATA 8
|
---|
221 | #define RINEXENTRY_S2DATA 9
|
---|
222 |
|
---|
223 | #define RINEXENTRY_C5DATA 10
|
---|
224 | #define RINEXENTRY_L5DATA 11
|
---|
225 | #define RINEXENTRY_D5DATA 12
|
---|
226 | #define RINEXENTRY_S5DATA 13
|
---|
227 | #define RINEXENTRY_C6DATA 14
|
---|
228 | #define RINEXENTRY_L6DATA 15
|
---|
229 | #define RINEXENTRY_D6DATA 16
|
---|
230 | #define RINEXENTRY_S6DATA 17
|
---|
231 | #define RINEXENTRY_C7DATA 18 /* 5B */
|
---|
232 | #define RINEXENTRY_L7DATA 19
|
---|
233 | #define RINEXENTRY_D7DATA 20
|
---|
234 | #define RINEXENTRY_S7DATA 21
|
---|
235 | #define RINEXENTRY_C8DATA 22 /* 5AB */
|
---|
236 | #define RINEXENTRY_L8DATA 23
|
---|
237 | #define RINEXENTRY_D8DATA 24
|
---|
238 | #define RINEXENTRY_S8DATA 25
|
---|
239 |
|
---|
240 | #define RINEXENTRY_NUMBER 26
|
---|
241 |
|
---|
242 | #define LIGHTSPEED 2.99792458e8 /* m/sec */
|
---|
243 | #define GPS_FREQU_L1 1575420000.0 /* Hz */
|
---|
244 | #define GPS_FREQU_L2 1227600000.0 /* Hz */
|
---|
245 | #define GPS_FREQU_L5 1176450000.0 /* Hz */
|
---|
246 | #define GPS_WAVELENGTH_L1 (LIGHTSPEED / GPS_FREQU_L1) /* m */
|
---|
247 | #define GPS_WAVELENGTH_L2 (LIGHTSPEED / GPS_FREQU_L2) /* m */
|
---|
248 | #define GPS_WAVELENGTH_L5 (LIGHTSPEED / GPS_FREQU_L5) /* m */
|
---|
249 |
|
---|
250 | #define GLO_FREQU_L1_BASE 1602000000.0 /* Hz */
|
---|
251 | #define GLO_FREQU_L2_BASE 1246000000.0 /* Hz */
|
---|
252 | #define GLO_FREQU_L1_STEP 562500.0 /* Hz */
|
---|
253 | #define GLO_FREQU_L2_STEP 437500.0 /* Hz */
|
---|
254 | #define GLO_FREQU_L1(a) (GLO_FREQU_L1_BASE+(a)*GLO_FREQU_L1_STEP)
|
---|
255 | #define GLO_FREQU_L2(a) (GLO_FREQU_L2_BASE+(a)*GLO_FREQU_L2_STEP)
|
---|
256 | #define GLO_WAVELENGTH_L1(a) (LIGHTSPEED / GLO_FREQU_L1(a)) /* m */
|
---|
257 | #define GLO_WAVELENGTH_L2(a) (LIGHTSPEED / GLO_FREQU_L2(a)) /* m */
|
---|
258 |
|
---|
259 | #define GAL_FREQU_E1 1575420000.0 /* Hz */
|
---|
260 | #define GAL_FREQU_E5A 1176450000.0 /* Hz */
|
---|
261 | #define GAL_FREQU_E5AB 1191795000.0 /* Hz */
|
---|
262 | #define GAL_FREQU_E5B 1207140000.0 /* Hz */
|
---|
263 | #define GAL_FREQU_E6 1278750000.0 /* Hz */
|
---|
264 | #define GAL_WAVELENGTH_E1 (LIGHTSPEED / GAL_FREQU_E1) /* m */
|
---|
265 | #define GAL_WAVELENGTH_E5A (LIGHTSPEED / GAL_FREQU_E5A) /* m */
|
---|
266 | #define GAL_WAVELENGTH_E5AB (LIGHTSPEED / GAL_FREQU_E5AB) /* m */
|
---|
267 | #define GAL_WAVELENGTH_E5B (LIGHTSPEED / GAL_FREQU_E5B) /* m */
|
---|
268 | #define GAL_WAVELENGTH_E6 (LIGHTSPEED / GAL_FREQU_E6) /* m */
|
---|
269 |
|
---|
270 | #define QZSS_FREQU_L1 1575420000.0 /* Hz */
|
---|
271 | #define QZSS_FREQU_L2 1227600000.0 /* Hz */
|
---|
272 | #define QZSS_FREQU_L5 1176450000.0 /* Hz */
|
---|
273 | #define QZSS_FREQU_LEX 1278750000.0 /* Hz */
|
---|
274 | #define QZSS_WAVELENGTH_L1 (LIGHTSPEED / QZSS_FREQU_L1) /* m */
|
---|
275 | #define QZSS_WAVELENGTH_L2 (LIGHTSPEED / QZSS_FREQU_L2) /* m */
|
---|
276 | #define QZSS_WAVELENGTH_L5 (LIGHTSPEED / QZSS_FREQU_L5) /* m */
|
---|
277 | #define QZSS_WAVELENGTH_LEX (LIGHTSPEED / QZSS_FREQU_LEX) /* m */
|
---|
278 |
|
---|
279 | #define BDS_FREQU_B1 1561098000.0 /* Hz */
|
---|
280 | #define BDS_FREQU_B2 1207140000.0 /* Hz */
|
---|
281 | #define BDS_FREQU_B3 1268520000.0 /* Hz */
|
---|
282 | #define BDS_WAVELENGTH_B1 (LIGHTSPEED / BDS_FREQU_B1) /* m */
|
---|
283 | #define BDS_WAVELENGTH_B2 (LIGHTSPEED / BDS_FREQU_B2) /* m */
|
---|
284 | #define BDS_WAVELENGTH_B3 (LIGHTSPEED / BDS_FREQU_B3) /* m */
|
---|
285 |
|
---|
286 | #define PRN_GIOVE_OFFSET 51
|
---|
287 |
|
---|
288 | /* Additional flags for the data field, which tell us more. */
|
---|
289 | #define GNSSDF2_XCORRL2 (1<<0) /* cross-correlated L2 */
|
---|
290 | #define GNSSDF2_LOCKLOSSL1 (1<<1) /* lost lock on L1 */
|
---|
291 | #define GNSSDF2_LOCKLOSSL2 (1<<2) /* lost lock on L2 */
|
---|
292 | #define GNSSDF2_LOCKLOSSL5 (1<<3) /* lost lock on L5 */
|
---|
293 | #define GNSSDF2_LOCKLOSSE6 (1<<4) /* lost lock on E6 */
|
---|
294 | #define GNSSDF2_LOCKLOSSE5B (1<<5) /* lost lock on E5B */
|
---|
295 | #define GNSSDF2_LOCKLOSSE5AB (1<<6) /* lost lock on E5AB */
|
---|
296 | #define GNSSDF2_LOCKLOSSB1 GNSSDF2_LOCKLOSSL1
|
---|
297 | #define GNSSDF2_LOCKLOSSB2 GNSSDF2_LOCKLOSSE5B
|
---|
298 | #define GNSSDF2_LOCKLOSSB3 GNSSDF2_LOCKLOSSE6
|
---|
299 | #define GNSSDF2_LOCKLOSSLEX GNSSDF2_LOCKLOSSE6
|
---|
300 | #define GNSSDF2_LOCKLOSSSAIF (1<<9) /* lost lock on SAIF signal */
|
---|
301 |
|
---|
302 | #define UINT64(c) c ## ULL
|
---|
303 |
|
---|
304 | struct converttimeinfo {
|
---|
305 | int second; /* seconds of GPS time [0..59] */
|
---|
306 | int minute; /* minutes of GPS time [0..59] */
|
---|
307 | int hour; /* hour of GPS time [0..24] */
|
---|
308 | int day; /* day of GPS time [1..28..30(31)*/
|
---|
309 | int month; /* month of GPS time [1..12]*/
|
---|
310 | int year; /* year of GPS time [1980..] */
|
---|
311 | };
|
---|
312 |
|
---|
313 | struct gnssdata {
|
---|
314 | int flags; /* GNSSF_xxx */
|
---|
315 | int week; /* week number of GPS date */
|
---|
316 | int numsats;
|
---|
317 | double timeofweek; /* milliseconds in GPS week */
|
---|
318 | double measdata[GNSS_MAXSATS][GNSSENTRY_NUMBER]; /* data fields */
|
---|
319 | unsigned long long dataflags[GNSS_MAXSATS]; /* GNSSDF_xxx */
|
---|
320 | unsigned int dataflags2[GNSS_MAXSATS]; /* GNSSDF2_xxx */
|
---|
321 | int satellites[GNSS_MAXSATS]; /* SV - IDs */
|
---|
322 | int snrL1[GNSS_MAXSATS]; /* Important: all the 6 SV-specific fields must */
|
---|
323 | int snrL2[GNSS_MAXSATS]; /* have the same SV-order */
|
---|
324 | const char * codetype[GNSS_MAXSATS][GNSSENTRY_NUMBER];
|
---|
325 | };
|
---|
326 |
|
---|
327 | #define GPSEPHF_L2PCODEDATA (1<<0) /* set, if NAV data OFF on L2 P-code, s1w4b01 */
|
---|
328 | #define GPSEPHF_L2PCODE (1<<1) /* set, if P-code available, s1w3b12 */
|
---|
329 | #define GPSEPHF_L2CACODE (1<<2) /* set, if CA-code available, s1w3b11 */
|
---|
330 | #define GPSEPHF_VALIDATED (1<<3) /* data is completely valid */
|
---|
331 | #define GPSEPHF_6HOURSFIT (1<<4) /* Bit 17 Word 10 of subframe 2 is set to 1 */
|
---|
332 |
|
---|
333 | #define R2R_PI 3.1415926535898
|
---|
334 |
|
---|
335 | struct gpsephemeris {
|
---|
336 | int flags; /* GPSEPHF_xxx */
|
---|
337 | int satellite; /* SV ID ICD-GPS data position */
|
---|
338 | int IODE; /* [s2w3b01-08] */
|
---|
339 | int URAindex; /* [1..15] [s1w3b13-16] */
|
---|
340 | int SVhealth; /* [s1w3b17-22] */
|
---|
341 | int GPSweek; /* [s1w3b01-10] */
|
---|
342 | int IODC; /* [s1w3b23-32,w8b01-08] */
|
---|
343 | int TOW; /* [s] [s1w2b01-17] */
|
---|
344 | int TOC; /* [s] [s1w8b09-24] */
|
---|
345 | int TOE; /* [s] [s2w10b1-16] */
|
---|
346 | double clock_bias; /* [s] [s1w10b1-22, af0] */
|
---|
347 | double clock_drift; /* [s/s] [s1w9b09-24, af1] */
|
---|
348 | double clock_driftrate; /* [s/s^2] [s1w9b01-08, af2] */
|
---|
349 | double Crs; /* [m] [s2w3b09-24] */
|
---|
350 | double Delta_n; /* [rad/s] [s2w4b01-16 * Pi] */
|
---|
351 | double M0; /* [rad] [s2w4b17-24,w5b01-24 * Pi]*/
|
---|
352 | double Cuc; /* [rad] [s2w6b01-16] */
|
---|
353 | double e; /* [s2w6b17-24,w6b01-24] */
|
---|
354 | double Cus; /* [rad] [s2w8b01-16] */
|
---|
355 | double sqrt_A; /* [m^0.5] [s2w8b16-24,w9b01-24] */
|
---|
356 | double Cic; /* [rad] [s3w3b01-16] */
|
---|
357 | double OMEGA0; /* [rad] [s3w3b17-24,w4b01-24 * Pi]*/
|
---|
358 | double Cis; /* [rad] [s3w5b01-16] */
|
---|
359 | double i0; /* [rad] [s3w5b17-24,w6b01-24 * Pi]*/
|
---|
360 | double Crc; /* [m] [s3w701-16] */
|
---|
361 | double omega; /* [rad] [s3w7b17-24,w8b01-24 * Pi]*/
|
---|
362 | double OMEGADOT; /* [rad/s] [s3w9b01-24 * Pi] */
|
---|
363 | double IDOT; /* [rad/s] [s3w10b9-22 * Pi] */
|
---|
364 | double TGD; /* [s] [s1w7b17-24] */
|
---|
365 | };
|
---|
366 |
|
---|
367 | #define GLOEPHF_UNHEALTHY (1<<0) /* set if unhealty satellite, f2b78 */
|
---|
368 | #define GLOEPHF_ALMANACHEALTHOK (1<<1) /* set if ALM health is available */
|
---|
369 | #define GLOEPHF_ALMANACHEALTHY (1<<2) /* set if Cn word is true */
|
---|
370 | #define GLOEPHF_PAVAILABLE (1<<3) /* set if the 3 P flags are available */
|
---|
371 | #define GLOEPHF_P10TRUE (1<<4)
|
---|
372 | #define GLOEPHF_P11TRUE (1<<5)
|
---|
373 | #define GLOEPHF_P2TRUE (1<<6)
|
---|
374 | #define GLOEPHF_P3TRUE (1<<7)
|
---|
375 |
|
---|
376 | struct glonassephemeris {
|
---|
377 | int GPSWeek;
|
---|
378 | int GPSTOW;
|
---|
379 | int flags; /* GLOEPHF_xxx */
|
---|
380 | int almanac_number;
|
---|
381 | int frequency_number; /* ICD-GLONASS data position */
|
---|
382 | int tb; /* [s] [f2b70-76] */
|
---|
383 | int tk; /* [s] [f1b65-76] */
|
---|
384 | int E; /* [days] [f4b49-53] */
|
---|
385 | double tau; /* [s] [f4b59-80] */
|
---|
386 | double gamma; /* [f3b69-79] */
|
---|
387 | double x_pos; /* [km] [f1b09-35] */
|
---|
388 | double x_velocity; /* [km/s] [f1b41-64] */
|
---|
389 | double x_acceleration; /* [km/s^2][f1b36-40] */
|
---|
390 | double y_pos; /* [km] [f2b09-35] */
|
---|
391 | double y_velocity; /* [km/s] [f2b41-64] */
|
---|
392 | double y_acceleration; /* [km/s^2][f2b36-40] */
|
---|
393 | double z_pos; /* [km] [f3b09-35] */
|
---|
394 | double z_velocity; /* [km/s] [f3b41-64] */
|
---|
395 | double z_acceleration; /* [km/s^2][f3b36-40] */
|
---|
396 | };
|
---|
397 |
|
---|
398 | struct sbasephemeris {
|
---|
399 | int satellite;
|
---|
400 | int IODN; /* [bits 14- 21] */
|
---|
401 | int GPSweek_TOE;
|
---|
402 | int TOW;
|
---|
403 | int TOE; /* [s] [bits 22- 34] */
|
---|
404 | double agf0; /* [s] [bits 206-217] */
|
---|
405 | double agf1; /* [s/s] [bits 218-225] */
|
---|
406 | double x_pos; /* [km] [bits 39- 68] */
|
---|
407 | double x_velocity; /* [km/s] [bits 124-140] */
|
---|
408 | double x_acceleration; /* [km/s^2][bits 176-185] */
|
---|
409 | double y_pos; /* [km] [bits 69- 98] */
|
---|
410 | double y_velocity; /* [km/s] [bits 141-157] */
|
---|
411 | double y_acceleration; /* [km/s^2][bits 186-195] */
|
---|
412 | double z_pos; /* [km] [bits 99-123] */
|
---|
413 | double z_velocity; /* [km/s] [bits 158-175] */
|
---|
414 | double z_acceleration; /* [km/s^2][bits 196-205] */
|
---|
415 | int URA; /* [bits 35- 38] */
|
---|
416 | };
|
---|
417 |
|
---|
418 | #define GALEPHF_E5ADINVALID (1<<0) /* E5aDVS set invalid */
|
---|
419 | #define GALEPHF_E5BDINVALID (1<<1) /* E5bDVS set invalid */
|
---|
420 | #define GALEPHF_INAV (1<<2) /* INAV data */
|
---|
421 | #define GALEPHF_FNAV (1<<3) /* FNAV data */
|
---|
422 | #define GALEPHF_E1DINVALID (1<<4) /* E1DVS set invalid */
|
---|
423 |
|
---|
424 | struct galileoephemeris {
|
---|
425 | int flags; /* GALEPHF_xxx */
|
---|
426 | int satellite; /* SV ID */
|
---|
427 | int IODnav;
|
---|
428 | int TOC; /* [s] */
|
---|
429 | int TOE; /* [s] */
|
---|
430 | double clock_bias; /* [s] */
|
---|
431 | double clock_drift; /* [s/s] */
|
---|
432 | double clock_driftrate; /* [s/s^2] */
|
---|
433 | double Crs; /* [m] */
|
---|
434 | double Delta_n; /* [rad/s] */
|
---|
435 | double M0; /* [rad] */
|
---|
436 | double Cuc; /* [rad] */
|
---|
437 | double e;
|
---|
438 | double Cus; /* [rad] */
|
---|
439 | double sqrt_A; /* [m^0.5] */
|
---|
440 | double Cic; /* [rad] */
|
---|
441 | double OMEGA0; /* [rad] */
|
---|
442 | double Cis; /* [rad] */
|
---|
443 | double i0; /* [rad] */
|
---|
444 | double Crc; /* [m] */
|
---|
445 | double omega; /* [rad] */
|
---|
446 | double OMEGADOT; /* [rad/s] */
|
---|
447 | double IDOT; /* [rad/s] */
|
---|
448 | double BGD_1_5A; /* [s] */
|
---|
449 | double BGD_1_5B; /* [s] */
|
---|
450 | int Week;
|
---|
451 | int SISA;
|
---|
452 | int E5aHS;
|
---|
453 | int E5bHS;
|
---|
454 | int E1_HS;
|
---|
455 | };
|
---|
456 |
|
---|
457 | #define RTCM3ID_BDS 63
|
---|
458 | #define BDSEPHF_SATH1 (1<<0) /* SatH1 is 1 */
|
---|
459 |
|
---|
460 | struct bdsephemeris {
|
---|
461 | int flags; /* BDSEPHF_xxx */
|
---|
462 | int satellite; /* SV ID */
|
---|
463 | int AODE; /* */
|
---|
464 | int URAI; /* [1..15] */
|
---|
465 | int BDSweek; /* */
|
---|
466 | int AODC; /* */
|
---|
467 | int TOW; /* [s] */
|
---|
468 | int TOC; /* [s] */
|
---|
469 | int TOE; /* [s] */
|
---|
470 | double clock_bias; /* [s] */
|
---|
471 | double clock_drift; /* [s/s] */
|
---|
472 | double clock_driftrate; /* [s/s^2] */
|
---|
473 | double Crs; /* [m] */
|
---|
474 | double Delta_n; /* [rad/s] */
|
---|
475 | double M0; /* [rad] */
|
---|
476 | double Cuc; /* [rad] */
|
---|
477 | double e; /* */
|
---|
478 | double Cus; /* [rad] */
|
---|
479 | double sqrt_A; /* [m^0.5] */
|
---|
480 | double Cic; /* [rad] */
|
---|
481 | double OMEGA0; /* [rad] */
|
---|
482 | double Cis; /* [rad] */
|
---|
483 | double i0; /* [rad] */
|
---|
484 | double Crc; /* [m] */
|
---|
485 | double omega; /* [rad] */
|
---|
486 | double OMEGADOT; /* [rad/s] */
|
---|
487 | double IDOT; /* [rad/s] */
|
---|
488 | double TGD_B1_B3; /* [s] */
|
---|
489 | double TGD_B2_B3; /* [s] */
|
---|
490 | };
|
---|
491 |
|
---|
492 | struct DataInfo {
|
---|
493 | long long flags[RINEXENTRY_NUMBER];
|
---|
494 | int pos[RINEXENTRY_NUMBER];
|
---|
495 | int numtypes;
|
---|
496 | char type[GNSSENTRY_NUMBER];
|
---|
497 | };
|
---|
498 |
|
---|
499 | struct RTCM3ParserData {
|
---|
500 | unsigned char Message[2048]; /* input-buffer */
|
---|
501 | int MessageSize; /* current buffer size */
|
---|
502 | int NeedBytes; /* bytes wanted for next run */
|
---|
503 | int SkipBytes; /* bytes to skip in next round */
|
---|
504 | int GPSWeek;
|
---|
505 | int GPSTOW; /* in seconds */
|
---|
506 | struct gnssdata Data;
|
---|
507 | struct gpsephemeris ephemerisGPS;
|
---|
508 | struct galileoephemeris ephemerisGALILEO;
|
---|
509 | struct glonassephemeris ephemerisGLONASS;
|
---|
510 | struct sbasephemeris ephemerisSBAS;
|
---|
511 | struct bdsephemeris ephemerisBDS;
|
---|
512 | struct gnssdata DataNew;
|
---|
513 | int GLOFreq[PRN_GLONASS_NUM]; /* frequency numbers of GLONASS + 100 */
|
---|
514 | int size;
|
---|
515 | int lastlockGPSl1[64];
|
---|
516 | int lastlockGPSl2[64];
|
---|
517 | int lastlockGLOl1[64];
|
---|
518 | int lastlockGLOl2[64];
|
---|
519 | int lastlockmsm[RTCM3_MSM_NUMCELLS][NUMRTCM3PARSERSATS];
|
---|
520 | #ifdef NO_RTCM3_MAIN
|
---|
521 | double antX;
|
---|
522 | double antY;
|
---|
523 | double antZ;
|
---|
524 | double antH;
|
---|
525 | char antenna[256+1];
|
---|
526 | int blocktype;
|
---|
527 | int allflags;
|
---|
528 | int modjulday;
|
---|
529 | int secofday;
|
---|
530 | int leapsec;
|
---|
531 | #endif /* NO_RTCM3_MAIN */
|
---|
532 | int pos[RINEXENTRY_NUMBER];
|
---|
533 | long long flags[RINEXENTRY_NUMBER];
|
---|
534 | /* For RINEX2 only field GPS is used */
|
---|
535 | struct DataInfo info[RTCM3_MSM_NUMSYS];
|
---|
536 | int datafields[RINEXENTRY_NUMBER]; /* for RTCM2 header */
|
---|
537 | char fieldbuffer[6*RINEXENTRY_NUMBER+1];
|
---|
538 | char fieldbufferSBAS[4*RINEXENTRY_NUMBER+1];
|
---|
539 | char fieldbufferGPS[4*RINEXENTRY_NUMBER+1];
|
---|
540 | char fieldbufferGLONASS[4*RINEXENTRY_NUMBER+1];
|
---|
541 | char fieldbufferGALILEO[4*RINEXENTRY_NUMBER+1];
|
---|
542 | char fieldbufferBDS[4*RINEXENTRY_NUMBER+1];
|
---|
543 | char fieldbufferQZSS[4*RINEXENTRY_NUMBER+1];
|
---|
544 | int numdatafields; /* for RTCM2 */
|
---|
545 | int validwarning;
|
---|
546 | int init;
|
---|
547 | int startflags;
|
---|
548 | int rinex3;
|
---|
549 | int changeobs;
|
---|
550 | const char * headerfile;
|
---|
551 | const char * glonassephemeris;
|
---|
552 | const char * gpsephemeris;
|
---|
553 | const char * qzssephemeris;
|
---|
554 | const char * sbasephemeris;
|
---|
555 | const char * bdsephemeris;
|
---|
556 | const char * mixedephemeris;
|
---|
557 | FILE * glonassfile;
|
---|
558 | FILE * gpsfile;
|
---|
559 | FILE * qzssfile;
|
---|
560 | FILE * sbasfile;
|
---|
561 | FILE * bdsfile;
|
---|
562 | FILE * mixedfile;
|
---|
563 | };
|
---|
564 |
|
---|
565 | #ifndef PRINTFARG
|
---|
566 | #ifdef __GNUC__
|
---|
567 | #define PRINTFARG(a,b) __attribute__ ((format(printf, a, b)))
|
---|
568 | #else /* __GNUC__ */
|
---|
569 | #define PRINTFARG(a,b)
|
---|
570 | #endif /* __GNUC__ */
|
---|
571 | #endif /* PRINTFARG */
|
---|
572 |
|
---|
573 | int gnumleap(int year, int month, int day);
|
---|
574 | void updatetime(int *week, int *tow, int tk, int fixnumleap);
|
---|
575 | void converttime(struct converttimeinfo *c, int week, int tow);
|
---|
576 |
|
---|
577 | void HandleHeader(struct RTCM3ParserData *Parser);
|
---|
578 | int RTCM3Parser(struct RTCM3ParserData *handle);
|
---|
579 | void HandleByte(struct RTCM3ParserData *Parser, unsigned int byte);
|
---|
580 | void PRINTFARG(1,2) RTCM3Error(const char *fmt, ...);
|
---|
581 | void PRINTFARG(1,2) RTCM3Text(const char *fmt, ...);
|
---|
582 |
|
---|
583 | #endif /* RTCM3TORINEX_H */
|
---|