Changeset 7943 in ntrip for trunk/BNC/src/pppRun.cpp
- Timestamp:
- Jun 2, 2016, 10:47:19 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/src/pppRun.cpp
r7926 r7943 301 301 } 302 302 303 // Make sure the buffer does not grow beyond any limit 304 // --------------------------------------------------- 305 const unsigned MAX_EPODATA_SIZE = 120; 306 if (_epoData.size() > MAX_EPODATA_SIZE) { 307 delete _epoData.front(); 308 _epoData.pop_front(); 309 } 310 303 311 // Process the oldest epochs 304 312 // ------------------------ 305 while (_epoData.size() && !waitForCorr(_epoData.front()->_time)) {313 while (_epoData.size()) { 306 314 307 315 const vector<t_satObs*>& satObs = _epoData.front()->_satObs; 308 316 309 t_output output; 310 _pppClient->processEpoch(satObs, &output); 311 312 if (!output._error) { 313 QVector<double> xx(6); 314 xx.data()[0] = output._xyzRover[0]; 315 xx.data()[1] = output._xyzRover[1]; 316 xx.data()[2] = output._xyzRover[2]; 317 xx.data()[3] = output._neu[0]; 318 xx.data()[4] = output._neu[1]; 319 xx.data()[5] = output._neu[2]; 320 emit newPosition(staID, output._epoTime, xx); 321 } 322 323 delete _epoData.front(); _epoData.pop_front(); 324 325 ostringstream log; 326 if (output._error) { 327 log << output._log; 317 // No corrections yet, skip the epoch 318 // ---------------------------------- 319 if (_opt->_corrWaitTime && !_lastClkCorrTime.valid()) { 320 return; 321 } 322 323 // Process the front epoch 324 // ----------------------- 325 if (_opt->_corrWaitTime == 0 || 326 _epoData.front()->_time - _lastClkCorrTime < _opt->_corrWaitTime) { 327 328 t_output output; 329 _pppClient->processEpoch(satObs, &output); 330 331 if (!output._error) { 332 QVector<double> xx(6); 333 xx.data()[0] = output._xyzRover[0]; 334 xx.data()[1] = output._xyzRover[1]; 335 xx.data()[2] = output._xyzRover[2]; 336 xx.data()[3] = output._neu[0]; 337 xx.data()[4] = output._neu[1]; 338 xx.data()[5] = output._neu[2]; 339 emit newPosition(staID, output._epoTime, xx); 340 } 341 342 delete _epoData.front(); 343 _epoData.pop_front(); 344 345 ostringstream log; 346 if (output._error) { 347 log << output._log; 348 } 349 else { 350 log.setf(ios::fixed); 351 log << string(output._epoTime) << ' ' << staID.data() 352 << " X = " << setprecision(4) << output._xyzRover[0] 353 << " Y = " << setprecision(4) << output._xyzRover[1] 354 << " Z = " << setprecision(4) << output._xyzRover[2] 355 << " NEU: " << showpos << setw(8) << setprecision(4) << output._neu[0] 356 << " " << showpos << setw(8) << setprecision(4) << output._neu[1] 357 << " " << showpos << setw(8) << setprecision(4) << output._neu[2] 358 << " TRP: " << showpos << setw(8) << setprecision(4) << output._trp0 359 << " " << showpos << setw(8) << setprecision(4) << output._trp; 360 } 361 362 if (_logFile && output._epoTime.valid()) { 363 _logFile->write(output._epoTime.gpsw(), output._epoTime.gpssec(), 364 QString(output._log.c_str())); 365 } 366 367 if (!output._error) { 368 QString rmcStr = nmeaString('R', output); 369 QString ggaStr = nmeaString('G', output); 370 if (_nmeaFile) { 371 _nmeaFile->write(output._epoTime.gpsw(), output._epoTime.gpssec(), rmcStr); 372 _nmeaFile->write(output._epoTime.gpsw(), output._epoTime.gpssec(), ggaStr); 373 } 374 emit newNMEAstr(staID, rmcStr.toAscii()); 375 emit newNMEAstr(staID, ggaStr.toAscii()); 376 if (_snxtroFile && output._epoTime.valid()) { 377 _snxtroFile->write(staID, int(output._epoTime.gpsw()), output._epoTime.gpssec(), 378 output._trp0 + output._trp, output._trpStdev); 379 } 380 } 381 emit newMessage(QByteArray(log.str().c_str()), true); 328 382 } 329 383 else { 330 log.setf(ios::fixed); 331 log << string(output._epoTime) << ' ' << staID.data() 332 << " X = " << setprecision(4) << output._xyzRover[0] 333 << " Y = " << setprecision(4) << output._xyzRover[1] 334 << " Z = " << setprecision(4) << output._xyzRover[2] 335 << " NEU: " << showpos << setw(8) << setprecision(4) << output._neu[0] 336 << " " << showpos << setw(8) << setprecision(4) << output._neu[1] 337 << " " << showpos << setw(8) << setprecision(4) << output._neu[2] 338 << " TRP: " << showpos << setw(8) << setprecision(4) << output._trp0 339 << " " << showpos << setw(8) << setprecision(4) << output._trp; 340 } 341 342 if (_logFile && output._epoTime.valid()) { 343 _logFile->write(output._epoTime.gpsw(), output._epoTime.gpssec(), 344 QString(output._log.c_str())); 345 } 346 347 if (!output._error) { 348 QString rmcStr = nmeaString('R', output); 349 QString ggaStr = nmeaString('G', output); 350 if (_nmeaFile) { 351 _nmeaFile->write(output._epoTime.gpsw(), output._epoTime.gpssec(), rmcStr); 352 _nmeaFile->write(output._epoTime.gpsw(), output._epoTime.gpssec(), ggaStr); 353 } 354 emit newNMEAstr(staID, rmcStr.toAscii()); 355 emit newNMEAstr(staID, ggaStr.toAscii()); 356 if (_snxtroFile && output._epoTime.valid()) { 357 _snxtroFile->write(staID, int(output._epoTime.gpsw()), output._epoTime.gpssec(), 358 output._trp0 + output._trp, output._trpStdev); 359 } 360 } 361 362 emit newMessage(QByteArray(log.str().c_str()), true); 384 return; 385 } 363 386 } 364 387 } … … 655 678 return '$' + nmStr + QString("*%1\n").arg(int(XOR), 0, 16).toUpper(); 656 679 } 657 658 //659 ////////////////////////////////////////////////////////////////////////////660 bool t_pppRun::waitForCorr(const bncTime& epoTime) const {661 662 if (!_opt->_realTime || _opt->_corrMount.empty()) {663 return false;664 }665 else if (!_lastClkCorrTime.valid()) {666 return true;667 }668 else {669 double dt = epoTime - _lastClkCorrTime;670 if (dt > 1.0 && dt < _opt->_corrWaitTime) {671 return true;672 }673 else {674 return false;675 }676 }677 return false;678 }
Note:
See TracChangeset
for help on using the changeset viewer.