Changeset 6454 in ntrip for trunk/BNC/src/RTCM3
- Timestamp:
- Dec 27, 2014, 3:07:19 PM (10 years ago)
- Location:
- trunk/BNC/src/RTCM3
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/src/RTCM3/RTCM3coDecoder.cpp
r6215 r6454 87 87 BNC_CORE, SLOT(slotMessage(const QByteArray,bool))); 88 88 89 memset(&_co, 0, sizeof(_co)); 90 memset(&_bias, 0, sizeof(_bias)); 89 memset(&_clkOrb, 0, sizeof(_clkOrb)); 90 memset(&_codeBias, 0, sizeof(_codeBias)); 91 memset(&_phaseBias, 0, sizeof(_phaseBias)); 92 memset(&_vTEC, 0, sizeof(_vTEC)); 91 93 92 94 _providerID[0] = -1; … … 147 149 while(_buffer.size()) { 148 150 151 struct ClockOrbit clkOrbSav; 152 struct CodeBias codeBiasSav; 153 struct PhaseBias phaseBiasSav; 154 struct VTEC vTECSav; 155 memcpy(&clkOrbSav, &_clkOrb, sizeof(clkOrbSav)); // save state 156 memcpy(&codeBiasSav, &_codeBias, sizeof(codeBiasSav)); 157 memcpy(&phaseBiasSav, &_phaseBias, sizeof(phaseBiasSav)); 158 memcpy(&vTECSav, &_vTEC, sizeof(vTECSav)); 159 149 160 int bytesused = 0; 150 struct ClockOrbit co_sav; 151 memcpy(&co_sav, &_co, sizeof(co_sav)); // save state 152 153 GCOB_RETURN irc = GetSSR(&_co, &_bias, 0, 0, _buffer.data(), 154 _buffer.size(), &bytesused); 161 GCOB_RETURN irc = GetSSR(&_clkOrb, &_codeBias, &_vTEC, &_phaseBias, 162 _buffer.data(), _buffer.size(), &bytesused); 155 163 156 164 if (irc <= -30) { // not enough data - restore state and exit loop 157 memcpy(&_co, &co_sav, sizeof(co_sav)); 165 memcpy(&_clkOrb, &clkOrbSav, sizeof(clkOrbSav)); 166 memcpy(&_codeBias, &codeBiasSav, sizeof(codeBiasSav)); 167 memcpy(&_phaseBias, &phaseBiasSav, sizeof(phaseBiasSav)); 168 memcpy(&_vTEC, &vTECSav, sizeof(vTECSav)); 158 169 break; 159 170 } 160 171 161 172 else if (irc < 0) { // error - skip 1 byte and retry 162 memset(&_co, 0, sizeof(_co)); 163 memset(&_bias, 0, sizeof(_bias)); 173 memset(&_clkOrb, 0, sizeof(_clkOrb)); 174 memset(&_codeBias, 0, sizeof(_codeBias)); 175 memset(&_phaseBias, 0, sizeof(_phaseBias)); 176 memset(&_vTEC, 0, sizeof(_vTEC)); 164 177 _buffer = _buffer.mid(bytesused ? bytesused : 1); 165 178 } … … 168 181 _buffer = _buffer.mid(bytesused); 169 182 170 if ( (irc == GCOBR_OK 171 (_c o.NumberOfSat[CLOCKORBIT_SATGPS] > 0 || _co.NumberOfSat[CLOCKORBIT_SATGLONASS] > 0 ||172 _ bias.NumberOfSat[CLOCKORBIT_SATGPS] > 0 || _bias.NumberOfSat[CLOCKORBIT_SATGLONASS] > 0) ) {183 if ( (irc == GCOBR_OK || irc == GCOBR_MESSAGEFOLLOWS ) && 184 (_clkOrb.NumberOfSat[CLOCKORBIT_SATGPS] > 0 || _clkOrb.NumberOfSat[CLOCKORBIT_SATGLONASS] > 0 || 185 _codeBias.NumberOfSat[CLOCKORBIT_SATGPS] > 0 || _codeBias.NumberOfSat[CLOCKORBIT_SATGLONASS] > 0) ) { 173 186 174 187 reopen(); … … 182 195 // Correction Epoch from GPSEpochTime 183 196 // ---------------------------------- 184 if (_c o.NumberOfSat[CLOCKORBIT_SATGPS] > 0 || _bias.NumberOfSat[CLOCKORBIT_SATGPS] > 0) {185 int GPSEpochTime = (_c o.NumberOfSat[CLOCKORBIT_SATGPS] > 0) ?186 _c o.EpochTime[CLOCKORBIT_SATGPS] : _bias.EpochTime[CLOCKORBIT_SATGPS];197 if (_clkOrb.NumberOfSat[CLOCKORBIT_SATGPS] > 0 || _codeBias.NumberOfSat[CLOCKORBIT_SATGPS] > 0) { 198 int GPSEpochTime = (_clkOrb.NumberOfSat[CLOCKORBIT_SATGPS] > 0) ? 199 _clkOrb.EpochTime[CLOCKORBIT_SATGPS] : _codeBias.EpochTime[CLOCKORBIT_SATGPS]; 187 200 if (GPSweeksHlp > GPSEpochTime + 86400.0) { 188 201 GPSweek += 1; … … 196 209 // Correction Epoch from Glonass Epoch 197 210 // ----------------------------------- 198 else if (_c o.NumberOfSat[CLOCKORBIT_SATGLONASS] > 0 || _bias.NumberOfSat[CLOCKORBIT_SATGLONASS] > 0){199 int GLONASSEpochTime = (_c o.NumberOfSat[CLOCKORBIT_SATGLONASS] > 0) ?200 _c o.EpochTime[CLOCKORBIT_SATGLONASS] : _bias.EpochTime[CLOCKORBIT_SATGLONASS];211 else if (_clkOrb.NumberOfSat[CLOCKORBIT_SATGLONASS] > 0 || _codeBias.NumberOfSat[CLOCKORBIT_SATGLONASS] > 0){ 212 int GLONASSEpochTime = (_clkOrb.NumberOfSat[CLOCKORBIT_SATGLONASS] > 0) ? 213 _clkOrb.EpochTime[CLOCKORBIT_SATGLONASS] : _codeBias.EpochTime[CLOCKORBIT_SATGLONASS]; 201 214 202 215 // Second of day (GPS time) from Glonass Epoch … … 234 247 retCode = success; 235 248 236 memset(&_co, 0, sizeof(_co)); 237 memset(&_bias, 0, sizeof(_bias)); 249 memset(&_clkOrb, 0, sizeof(_clkOrb)); 250 memset(&_codeBias, 0, sizeof(_codeBias)); 251 memset(&_phaseBias, 0, sizeof(_phaseBias)); 252 memset(&_vTEC, 0, sizeof(_vTEC)); 238 253 } 239 254 } … … 252 267 // Loop over all satellites (GPS and Glonass) 253 268 // ------------------------------------------ 254 for (unsigned ii = 0; ii < CLOCKORBIT_NUMGPS + _c o.NumberOfSat[CLOCKORBIT_SATGLONASS]; ii++) {269 for (unsigned ii = 0; ii < CLOCKORBIT_NUMGPS + _clkOrb.NumberOfSat[CLOCKORBIT_SATGLONASS]; ii++) { 255 270 char sysCh = ' '; 256 if (ii < _c o.NumberOfSat[CLOCKORBIT_SATGPS]) {271 if (ii < _clkOrb.NumberOfSat[CLOCKORBIT_SATGPS]) { 257 272 sysCh = 'G'; 258 273 } … … 266 281 // Orbit correction 267 282 // ---------------- 268 if ( _c o.messageType == COTYPE_GPSCOMBINED ||269 _c o.messageType == COTYPE_GLONASSCOMBINED ||270 _c o.messageType == COTYPE_GPSORBIT ||271 _c o.messageType == COTYPE_GLONASSORBIT ) {283 if ( _clkOrb.messageType == COTYPE_GPSCOMBINED || 284 _clkOrb.messageType == COTYPE_GLONASSCOMBINED || 285 _clkOrb.messageType == COTYPE_GPSORBIT || 286 _clkOrb.messageType == COTYPE_GLONASSORBIT ) { 272 287 273 288 t_orbCorr orbCorr; 274 orbCorr._prn.set(sysCh, _c o.Sat[ii].ID);289 orbCorr._prn.set(sysCh, _clkOrb.Sat[ii].ID); 275 290 orbCorr._staID = _staID.toAscii().data(); 276 orbCorr._iod = _c o.Sat[ii].IOD;291 orbCorr._iod = _clkOrb.Sat[ii].IOD; 277 292 orbCorr._time = _lastTime; 278 293 orbCorr._system = 'R'; 279 orbCorr._xr[0] = _c o.Sat[ii].Orbit.DeltaRadial;280 orbCorr._xr[1] = _c o.Sat[ii].Orbit.DeltaAlongTrack;281 orbCorr._xr[2] = _c o.Sat[ii].Orbit.DeltaCrossTrack;282 orbCorr._dotXr[0] = _c o.Sat[ii].Orbit.DotDeltaRadial;283 orbCorr._dotXr[1] = _c o.Sat[ii].Orbit.DotDeltaAlongTrack;284 orbCorr._dotXr[2] = _c o.Sat[ii].Orbit.DotDeltaCrossTrack;294 orbCorr._xr[0] = _clkOrb.Sat[ii].Orbit.DeltaRadial; 295 orbCorr._xr[1] = _clkOrb.Sat[ii].Orbit.DeltaAlongTrack; 296 orbCorr._xr[2] = _clkOrb.Sat[ii].Orbit.DeltaCrossTrack; 297 orbCorr._dotXr[0] = _clkOrb.Sat[ii].Orbit.DotDeltaRadial; 298 orbCorr._dotXr[1] = _clkOrb.Sat[ii].Orbit.DotDeltaAlongTrack; 299 orbCorr._dotXr[2] = _clkOrb.Sat[ii].Orbit.DotDeltaCrossTrack; 285 300 286 301 orbCorrections.push_back(orbCorr); 287 302 288 _IODs[orbCorr._prn.toString()] = _c o.Sat[ii].IOD;289 } 290 291 if ( _c o.messageType == COTYPE_GPSCOMBINED ||292 _c o.messageType == COTYPE_GLONASSCOMBINED ||293 _c o.messageType == COTYPE_GPSCLOCK ||294 _c o.messageType == COTYPE_GLONASSCLOCK ) {303 _IODs[orbCorr._prn.toString()] = _clkOrb.Sat[ii].IOD; 304 } 305 306 if ( _clkOrb.messageType == COTYPE_GPSCOMBINED || 307 _clkOrb.messageType == COTYPE_GLONASSCOMBINED || 308 _clkOrb.messageType == COTYPE_GPSCLOCK || 309 _clkOrb.messageType == COTYPE_GLONASSCLOCK ) { 295 310 296 311 t_clkCorr clkCorr; 297 clkCorr._prn.set(sysCh, _c o.Sat[ii].ID);312 clkCorr._prn.set(sysCh, _clkOrb.Sat[ii].ID); 298 313 clkCorr._staID = _staID.toAscii().data(); 299 314 clkCorr._time = _lastTime; 300 clkCorr._dClk = _c o.Sat[ii].Clock.DeltaA0 / t_CST::c;301 clkCorr._dotDClk = _c o.Sat[ii].Clock.DeltaA1 / t_CST::c;302 clkCorr._dotDotDClk = _c o.Sat[ii].Clock.DeltaA2 / t_CST::c;315 clkCorr._dClk = _clkOrb.Sat[ii].Clock.DeltaA0 / t_CST::c; 316 clkCorr._dotDClk = _clkOrb.Sat[ii].Clock.DeltaA1 / t_CST::c; 317 clkCorr._dotDotDClk = _clkOrb.Sat[ii].Clock.DeltaA2 / t_CST::c; 303 318 clkCorr._clkPartial = 0.0; 304 319 … … 311 326 // High-Resolution Clocks 312 327 // ---------------------- 313 if ( _c o.messageType == COTYPE_GPSHR ||314 _c o.messageType == COTYPE_GLONASSHR ) {328 if ( _clkOrb.messageType == COTYPE_GPSHR || 329 _clkOrb.messageType == COTYPE_GLONASSHR ) { 315 330 } 316 331 } … … 319 334 // ------------------------------------------ 320 335 QList<t_satBias> satBiases; 321 for (unsigned ii = 0; ii < CLOCKORBIT_NUMGPS + _ bias.NumberOfSat[CLOCKORBIT_SATGLONASS]; ii++) {336 for (unsigned ii = 0; ii < CLOCKORBIT_NUMGPS + _codeBias.NumberOfSat[CLOCKORBIT_SATGLONASS]; ii++) { 322 337 char sysCh = ' '; 323 if (ii < _ bias.NumberOfSat[CLOCKORBIT_SATGPS]) {338 if (ii < _codeBias.NumberOfSat[CLOCKORBIT_SATGPS]) { 324 339 sysCh = 'G'; 325 340 } … … 331 346 } 332 347 t_satBias satBias; 333 satBias._prn.set(sysCh, _ bias.Sat[ii].ID);348 satBias._prn.set(sysCh, _codeBias.Sat[ii].ID); 334 349 satBias._time = _lastTime; 335 350 satBias._nx = 0; 336 351 satBias._jumpCount = 0; 337 for (unsigned jj = 0; jj < _ bias.Sat[ii].NumberOfCodeBiases; jj++) {352 for (unsigned jj = 0; jj < _codeBias.Sat[ii].NumberOfCodeBiases; jj++) { 338 353 } 339 354 } … … 364 379 void RTCM3coDecoder::checkProviderID() { 365 380 366 if (_c o.SSRProviderID == 0 && _co.SSRSolutionID == 0 && _co.SSRIOD == 0) {381 if (_clkOrb.SSRProviderID == 0 && _clkOrb.SSRSolutionID == 0 && _clkOrb.SSRIOD == 0) { 367 382 return; 368 383 } 369 384 370 385 int newProviderID[3]; 371 newProviderID[0] = _c o.SSRProviderID;372 newProviderID[1] = _c o.SSRSolutionID;373 newProviderID[2] = _c o.SSRIOD;386 newProviderID[0] = _clkOrb.SSRProviderID; 387 newProviderID[1] = _clkOrb.SSRSolutionID; 388 newProviderID[2] = _clkOrb.SSRIOD; 374 389 375 390 bool alreadySet = false; -
trunk/BNC/src/RTCM3/RTCM3coDecoder.h
r6141 r6454 59 59 QString _fileName; 60 60 QByteArray _buffer; 61 ClockOrbit _co; 62 CodeBias _bias; 61 ClockOrbit _clkOrb; 62 CodeBias _codeBias; 63 PhaseBias _phaseBias; 64 VTEC _vTEC; 63 65 int _providerID[3]; 64 66 bncTime _lastTime;
Note:
See TracChangeset
for help on using the changeset viewer.