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