source: ntrip/trunk/BNC/src/pppRun.cpp@ 7448

Last change on this file since 7448 was 7301, checked in by stuerze, 10 years ago

minor changes

File size: 18.5 KB
RevLine 
[5860]1
2// Part of BNC, a utility for retrieving decoding and
3// converting GNSS data streams from NTRIP broadcasters.
4//
5// Copyright (C) 2007
6// German Federal Agency for Cartography and Geodesy (BKG)
7// http://www.bkg.bund.de
8// Czech Technical University Prague, Department of Geodesy
9// http://www.fsv.cvut.cz
10//
11// Email: euref-ip@bkg.bund.de
12//
13// This program is free software; you can redistribute it and/or
14// modify it under the terms of the GNU General Public License
15// as published by the Free Software Foundation, version 2.
16//
17// This program is distributed in the hope that it will be useful,
18// but WITHOUT ANY WARRANTY; without even the implied warranty of
19// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20// GNU General Public License for more details.
21//
22// You should have received a copy of the GNU General Public License
23// along with this program; if not, write to the Free Software
24// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
25
26/* -------------------------------------------------------------------------
27 * BKG NTRIP Client
28 * -------------------------------------------------------------------------
29 *
[5883]30 * Class: t_pppRun
[5860]31 *
32 * Purpose: Single Real-Time PPP Client
33 *
34 * Author: L. Mervart
35 *
36 * Created: 29-Jul-2014
37 *
[7278]38 * Changes:
[5860]39 *
40 * -----------------------------------------------------------------------*/
41
42
43#include <iostream>
44#include <iomanip>
[5980]45#include <sstream>
[5860]46#include <string.h>
47#include <map>
48
[5883]49#include "pppRun.h"
[5891]50#include "pppThread.h"
[5860]51#include "bnccore.h"
52#include "bncephuser.h"
[5953]53#include "bncsettings.h"
[5984]54#include "bncoutf.h"
[6653]55#include "bncsinextro.h"
[5883]56#include "rinex/rnxobsfile.h"
57#include "rinex/rnxnavfile.h"
58#include "rinex/corrfile.h"
[7299]59#include "combination/bnccomb.h"
[5860]60
61using namespace BNC_PPP;
62using namespace std;
63
64// Constructor
65////////////////////////////////////////////////////////////////////////////
[5883]66t_pppRun::t_pppRun(const t_pppOptions* opt) {
67
[5860]68 _opt = opt;
[5883]69
[7278]70 connect(this, SIGNAL(newMessage(QByteArray,bool)),
[5860]71 BNC_CORE, SLOT(slotMessage(const QByteArray,bool)));
[5883]72
[5991]73 connect(this, SIGNAL(newPosition(QByteArray, bncTime, QVector<double>)),
[5954]74 BNC_CORE, SIGNAL(newPosition(QByteArray, bncTime, QVector<double>)));
[5949]75
[5991]76 connect(this, SIGNAL(newNMEAstr(QByteArray, QByteArray)),
77 BNC_CORE, SIGNAL(newNMEAstr(QByteArray, QByteArray)));
78
[5883]79 _pppClient = new t_pppClient(_opt);
80
[5984]81 bncSettings settings;
82
[5860]83 if (_opt->_realTime) {
[5945]84 Qt::ConnectionType conType = Qt::AutoConnection;
85 if (BNC_CORE->mode() == t_bncCore::batchPostProcessing) {
86 conType = Qt::BlockingQueuedConnection;
87 }
88
[6137]89 connect(BNC_CORE->caster(), SIGNAL(newObs(QByteArray, QList<t_satObs>)),
90 this, SLOT(slotNewObs(QByteArray, QList<t_satObs>)),conType);
[5860]91
[6433]92 connect(BNC_CORE, SIGNAL(newGPSEph(t_ephGPS)),
93 this, SLOT(slotNewGPSEph(t_ephGPS)),conType);
[7278]94
[6433]95 connect(BNC_CORE, SIGNAL(newGlonassEph(t_ephGlo)),
96 this, SLOT(slotNewGlonassEph(t_ephGlo)),conType);
[7278]97
[6433]98 connect(BNC_CORE, SIGNAL(newGalileoEph(t_ephGal)),
99 this, SLOT(slotNewGalileoEph(t_ephGal)),conType);
[5860]100
[6966]101 connect(BNC_CORE, SIGNAL(newBDSEph(t_ephBDS)),
102 this, SLOT(slotNewBDSEph(t_ephBDS)),conType);
103
[7231]104 connect(BNC_CORE, SIGNAL(newTec(t_vTec)),
105 this, SLOT(slotNewTec(t_vTec)),conType);
106
[6141]107 connect(BNC_CORE, SIGNAL(newOrbCorrections(QList<t_orbCorr>)),
108 this, SLOT(slotNewOrbCorrections(QList<t_orbCorr>)),conType);
109
110 connect(BNC_CORE, SIGNAL(newClkCorrections(QList<t_clkCorr>)),
111 this, SLOT(slotNewClkCorrections(QList<t_clkCorr>)),conType);
[6478]112
113 connect(BNC_CORE, SIGNAL(newCodeBiases(QList<t_satCodeBias>)),
114 this, SLOT(slotNewCodeBiases(QList<t_satCodeBias>)),conType);
[7288]115
116 connect(BNC_CORE, SIGNAL(newPhaseBiases(QList<t_satPhaseBias>)),
117 this, SLOT(slotNewPhaseBiases(QList<t_satPhaseBias>)),conType);
[7299]118
119 connect(BNC_CMB, SIGNAL(newOrbCorrections(QList<t_orbCorr>)),
120 this, SLOT(slotNewOrbCorrections(QList<t_orbCorr>)),conType);
121
122 connect(BNC_CMB, SIGNAL(newClkCorrections(QList<t_clkCorr>)),
123 this, SLOT(slotNewClkCorrections(QList<t_clkCorr>)),conType);
[5860]124 }
125 else {
[5889]126 _rnxObsFile = 0;
127 _rnxNavFile = 0;
128 _corrFile = 0;
[5953]129 _speed = settings.value("PPP/mapSpeedSlider").toInt();
[5941]130 connect(this, SIGNAL(progressRnxPPP(int)), BNC_CORE, SIGNAL(progressRnxPPP(int)));
131 connect(this, SIGNAL(finishedRnxPPP()), BNC_CORE, SIGNAL(finishedRnxPPP()));
[7278]132 connect(BNC_CORE, SIGNAL(mapSpeedSliderChanged(int)),
[5950]133 this, SLOT(slotSetSpeed(int)));
[5973]134 connect(BNC_CORE, SIGNAL(stopRinexPPP()), this, SLOT(slotSetStopFlag()));
[5860]135 }
[7278]136
[5973]137 _stopFlag = false;
[5984]138
[5988]139 QString roverName(_opt->_roverName.c_str());
140
[6825]141 QString logFileSkl = settings.value("PPP/logFilePPP").toString();
[5988]142 if (logFileSkl.isEmpty()) {
143 _logFile = 0;
[5987]144 }
145 else {
[5988]146 if (logFileSkl.indexOf("${STATION}") == -1) {
[6568]147 logFileSkl = logFileSkl + "_" + roverName;
[5988]148 }
149 else {
150 logFileSkl.replace("${STATION}", roverName);
151 }
152 _logFile = new bncoutf(logFileSkl, "1 day", 0);
[5987]153 }
[5988]154
155 QString nmeaFileSkl = settings.value("PPP/nmeaFile").toString();
156 if (nmeaFileSkl.isEmpty()) {
157 _nmeaFile = 0;
158 }
159 else {
160 if (nmeaFileSkl.indexOf("${STATION}") == -1) {
161 nmeaFileSkl = roverName + "_" + nmeaFileSkl;
162 }
163 else {
164 nmeaFileSkl.replace("${STATION}", roverName);
165 }
166 _nmeaFile = new bncoutf(nmeaFileSkl, "1 day", 0);
167 }
[6608]168
169 QString snxtroFileSkl = settings.value("PPP/snxtroFile").toString();
170 if (snxtroFileSkl.isEmpty()) {
171 _snxtroFile = 0;
172 }
173 else {
174 if (snxtroFileSkl.indexOf("${STATION}") == -1) {
175 snxtroFileSkl = snxtroFileSkl + "_" + roverName;
176 }
177 else {
[6653]178 snxtroFileSkl.replace("${STATION}", roverName.left(4));
[6608]179 }
[6653]180 int samplSnxTro = settings.value("PPP/snxtroSampl").toInt();
181 _snxtroFile = new bncSinexTro(_opt, snxtroFileSkl, "1 day", samplSnxTro);
[6608]182 }
[5860]183}
184
[6608]185
186
[5860]187// Destructor
188////////////////////////////////////////////////////////////////////////////
[5883]189t_pppRun::~t_pppRun() {
[5984]190 delete _logFile;
[5988]191 delete _nmeaFile;
[6608]192 delete _snxtroFile;
[5860]193}
194
[7278]195//
[5860]196////////////////////////////////////////////////////////////////////////////
[6433]197void t_pppRun::slotNewGPSEph(t_ephGPS eph) {
[5860]198 QMutexLocker locker(&_mutex);
199 _pppClient->putEphemeris(&eph);
200}
201
[7278]202//
[5860]203////////////////////////////////////////////////////////////////////////////
[6433]204void t_pppRun::slotNewGlonassEph(t_ephGlo eph) {
[5860]205 QMutexLocker locker(&_mutex);
206 _pppClient->putEphemeris(&eph);
207}
[7278]208
209//
[5860]210////////////////////////////////////////////////////////////////////////////
[6433]211void t_pppRun::slotNewGalileoEph(t_ephGal eph) {
[5860]212 QMutexLocker locker(&_mutex);
213 _pppClient->putEphemeris(&eph);
214}
215
216//
217////////////////////////////////////////////////////////////////////////////
[6966]218void t_pppRun::slotNewBDSEph(t_ephBDS eph) {
219 QMutexLocker locker(&_mutex);
220 _pppClient->putEphemeris(&eph);
221}
222
223//
224////////////////////////////////////////////////////////////////////////////
[6137]225void t_pppRun::slotNewObs(QByteArray staID, QList<t_satObs> obsList) {
[5860]226 QMutexLocker locker(&_mutex);
227
228 if (string(staID.data()) != _opt->_roverName) {
229 return;
230 }
231
[7278]232 // Loop over all observations (possible different epochs)
[5860]233 // -----------------------------------------------------
[6137]234 QListIterator<t_satObs> it(obsList);
[5860]235 while (it.hasNext()) {
[6137]236 const t_satObs& oldObs = it.next();
237 t_satObs* newObs = new t_satObs(oldObs);
[5860]238
239 // Find the corresponding data epoch or create a new one
240 // -----------------------------------------------------
241 t_epoData* epoch = 0;
242 deque<t_epoData*>::const_iterator it;
243 for (it = _epoData.begin(); it != _epoData.end(); it++) {
244 if (newObs->_time == (*it)->_time) {
245 epoch = *it;
246 break;
247 }
248 }
249 if (epoch == 0) {
250 if (_epoData.empty() || newObs->_time > _epoData.back()->_time) {
251 epoch = new t_epoData;
252 epoch->_time = newObs->_time;
253 _epoData.push_back(epoch);
254 }
255 }
256
[6137]257 // Put data into the epoch
258 // -----------------------
[5860]259 if (epoch != 0) {
260 epoch->_satObs.push_back(newObs);
261 }
[6137]262 else {
263 delete newObs;
264 }
[5860]265 }
266
267 // Process the oldest epochs
268 // ------------------------
[5999]269 while (_epoData.size() && !waitForCorr(_epoData.front()->_time)) {
[5860]270
271 const vector<t_satObs*>& satObs = _epoData.front()->_satObs;
272
273 t_output output;
274 _pppClient->processEpoch(satObs, &output);
275
[5953]276 if (!output._error) {
[5879]277 QVector<double> xx(6);
278 xx.data()[0] = output._xyzRover[0];
279 xx.data()[1] = output._xyzRover[1];
280 xx.data()[2] = output._xyzRover[2];
281 xx.data()[3] = output._neu[0];
282 xx.data()[4] = output._neu[1];
283 xx.data()[5] = output._neu[2];
[5954]284 emit newPosition(staID, output._epoTime, xx);
[5873]285 }
286
[5860]287 delete _epoData.front(); _epoData.pop_front();
[7278]288
[5980]289 ostringstream log;
290 if (output._error) {
291 log << output._log;
292 }
293 else {
294 log.setf(ios::fixed);
[5982]295 log << string(output._epoTime) << ' ' << staID.data()
296 << " X = " << setprecision(4) << output._xyzRover[0]
297 << " Y = " << setprecision(4) << output._xyzRover[1]
298 << " Z = " << setprecision(4) << output._xyzRover[2]
[6653]299 << " NEU: " << showpos << setw(8) << setprecision(4) << output._neu[0]
300 << " " << showpos << setw(8) << setprecision(4) << output._neu[1]
301 << " " << showpos << setw(8) << setprecision(4) << output._neu[2]
302 << " TRP: " << showpos << setw(8) << setprecision(4) << output._trp0
303 << " " << showpos << setw(8) << setprecision(4) << output._trp;
[5980]304 }
305
[5988]306 if (_logFile && output._epoTime.valid()) {
[7278]307 _logFile->write(output._epoTime.gpsw(), output._epoTime.gpssec(),
308 QString(output._log.c_str()));
[5986]309 }
[5984]310
[5989]311 if (!output._error) {
[5990]312 QString rmcStr = nmeaString('R', output);
313 QString ggaStr = nmeaString('G', output);
[5989]314 if (_nmeaFile) {
315 _nmeaFile->write(output._epoTime.gpsw(), output._epoTime.gpssec(), rmcStr);
316 _nmeaFile->write(output._epoTime.gpsw(), output._epoTime.gpssec(), ggaStr);
317 }
318 emit newNMEAstr(staID, rmcStr.toAscii());
319 emit newNMEAstr(staID, ggaStr.toAscii());
320 }
321
[6608]322 if (_snxtroFile && output._epoTime.valid()) {
[6653]323 _snxtroFile->write(staID, int(output._epoTime.gpsw()), output._epoTime.gpssec(),
324 output._trp0 + output._trp, output._trpStdev);
[6608]325 }
326
[5980]327 emit newMessage(QByteArray(log.str().c_str()), true);
[5860]328 }
329}
[7231]330
331//
332////////////////////////////////////////////////////////////////////////////
333void t_pppRun::slotNewTec(t_vTec vTec) {
334 if (vTec._layers.size() == 0) {
335 return;
336 }
337
338 if (_opt->_realTime) {
339 if (_opt->_corrMount.empty() || _opt->_corrMount != vTec._staID) {
340 return;
341 }
342 }
343
344 _pppClient->putTec(&vTec);
345}
346
[7278]347//
[5860]348////////////////////////////////////////////////////////////////////////////
[6141]349void t_pppRun::slotNewOrbCorrections(QList<t_orbCorr> orbCorr) {
350 if (orbCorr.size() == 0) {
351 return;
352 }
[5860]353
[5937]354 if (_opt->_realTime) {
[6141]355 if (_opt->_corrMount.empty() || _opt->_corrMount != orbCorr[0]._staID) {
[5937]356 return;
357 }
[5860]358 }
[6141]359 vector<t_orbCorr*> corrections;
360 for (int ii = 0; ii < orbCorr.size(); ii++) {
361 corrections.push_back(new t_orbCorr(orbCorr[ii]));
362 }
[5860]363
[7278]364 _pppClient->putOrbCorrections(corrections);
365
366 for (unsigned ii = 0; ii < corrections.size(); ii++) {
367 delete corrections[ii];
368 }
[6141]369}
370
[7278]371//
[6141]372////////////////////////////////////////////////////////////////////////////
373void t_pppRun::slotNewClkCorrections(QList<t_clkCorr> clkCorr) {
374 if (clkCorr.size() == 0) {
[5860]375 return;
376 }
377
[7301]378 if (_opt->_realTime) {
[6141]379 if (_opt->_corrMount.empty() || _opt->_corrMount != clkCorr[0]._staID) {
380 return;
[5860]381 }
382 }
[6141]383 vector<t_clkCorr*> corrections;
384 for (int ii = 0; ii < clkCorr.size(); ii++) {
385 corrections.push_back(new t_clkCorr(clkCorr[ii]));
[6991]386 _lastClkCorrTime = clkCorr[ii]._time;
[6141]387 }
[7278]388 _pppClient->putClkCorrections(corrections);
389
390 for (unsigned ii = 0; ii < corrections.size(); ii++) {
391 delete corrections[ii];
392 }
[5860]393}
[5883]394
[7278]395//
[5883]396////////////////////////////////////////////////////////////////////////////
[6478]397void t_pppRun::slotNewCodeBiases(QList<t_satCodeBias> codeBiases) {
398 if (codeBiases.size() == 0) {
399 return;
400 }
401
402 if (_opt->_realTime) {
403 if (_opt->_corrMount.empty() || _opt->_corrMount != codeBiases[0]._staID) {
404 return;
405 }
406 }
407 vector<t_satCodeBias*> biases;
408 for (int ii = 0; ii < codeBiases.size(); ii++) {
409 biases.push_back(new t_satCodeBias(codeBiases[ii]));
410 }
411
[7278]412 _pppClient->putCodeBiases(biases);
413
414 for (unsigned ii = 0; ii < biases.size(); ii++) {
415 delete biases[ii];
416 }
[6478]417}
418
[7278]419//
[6478]420////////////////////////////////////////////////////////////////////////////
[7288]421void t_pppRun::slotNewPhaseBiases(QList<t_satPhaseBias> phaseBiases) {
422 if (phaseBiases.size() == 0) {
423 return;
424 }
425
426 if (_opt->_realTime) {
427 if (_opt->_corrMount.empty() || _opt->_corrMount != phaseBiases[0]._staID) {
428 return;
429 }
430 }
431 vector<t_satPhaseBias*> biases;
432 for (int ii = 0; ii < phaseBiases.size(); ii++) {
433 biases.push_back(new t_satPhaseBias(phaseBiases[ii]));
434 }
435
436 _pppClient->putPhaseBiases(biases);
437
438 for (unsigned ii = 0; ii < biases.size(); ii++) {
439 delete biases[ii];
440 }
441}
442
443//
444////////////////////////////////////////////////////////////////////////////
[5883]445void t_pppRun::processFiles() {
446
447 try {
[5889]448 _rnxObsFile = new t_rnxObsFile(QString(_opt->_rinexObs.c_str()), t_rnxObsFile::input);
[5883]449 }
450 catch (...) {
451 delete _rnxObsFile; _rnxObsFile = 0;
[5940]452 emit finishedRnxPPP();
[5883]453 return;
454 }
455
[5889]456 _rnxNavFile = new t_rnxNavFile(QString(_opt->_rinexNav.c_str()), t_rnxNavFile::input);
[5883]457
[5889]458 if (!_opt->_corrFile.empty()) {
459 _corrFile = new t_corrFile(QString(_opt->_corrFile.c_str()));
[7231]460 connect(_corrFile, SIGNAL(newTec(t_vTec)),
461 this, SLOT(slotNewTec(t_vTec)));
[6145]462 connect(_corrFile, SIGNAL(newOrbCorrections(QList<t_orbCorr>)),
463 this, SLOT(slotNewOrbCorrections(QList<t_orbCorr>)));
[6185]464 connect(_corrFile, SIGNAL(newClkCorrections(QList<t_clkCorr>)),
465 this, SLOT(slotNewClkCorrections(QList<t_clkCorr>)));
[6478]466 connect(_corrFile, SIGNAL(newCodeBiases(QList<t_satCodeBias>)),
467 this, SLOT(slotNewCodeBiases(QList<t_satCodeBias>)));
[7288]468 connect(_corrFile, SIGNAL(newPhaseBiases(QList<t_satPhaseBias>)),
469 this, SLOT(slotNewPhaseBiases(QList<t_satPhaseBias>)));
[5883]470 }
471
472 // Read/Process Observations
473 // -------------------------
474 int nEpo = 0;
475 const t_rnxObsFile::t_rnxEpo* epo = 0;
[5973]476 while ( !_stopFlag && (epo = _rnxObsFile->nextEpoch()) != 0 ) {
[5883]477 ++nEpo;
478
[5951]479 if (_speed < 100) {
480 double sleepTime = 2.0 / _speed;
[6537]481 t_pppThread::msleep(int(sleepTime*1.e3));
[5883]482 }
483
484 // Get Corrections
485 // ---------------
486 if (_corrFile) {
[6510]487 try {
488 _corrFile->syncRead(epo->tt);
489 }
490 catch (const char* msg) {
491 emit newMessage(QByteArray(msg), true);
492 break;
493 }
494 catch (const string& msg) {
495 emit newMessage(QByteArray(msg.c_str()), true);
496 break;
497 }
498 catch (...) {
499 emit newMessage("unknown exceptions in corrFile", true);
500 break;
501 }
[5883]502 }
503
504 // Get Ephemerides
505 // ----------------
506 t_eph* eph = 0;
[7169]507 const QMap<QString, unsigned int>* corrIODs = _corrFile ? &_corrFile->corrIODs() : 0;
[5883]508 while ( (eph = _rnxNavFile->getNextEph(epo->tt, corrIODs)) != 0 ) {
[5889]509 _pppClient->putEphemeris(eph);
510 delete eph; eph = 0;
[5883]511 }
512
[5890]513 // Create list of observations and start epoch processing
514 // ------------------------------------------------------
[6137]515 QList<t_satObs> obsList;
[5883]516 for (unsigned iObs = 0; iObs < epo->rnxSat.size(); iObs++) {
517 const t_rnxObsFile::t_rnxSat& rnxSat = epo->rnxSat[iObs];
[7278]518
[6137]519 t_satObs obs;
[5883]520 t_rnxObsFile::setObsFromRnx(_rnxObsFile, epo, rnxSat, obs);
[5890]521 obsList << obs;
522 }
523 slotNewObs(QByteArray(_opt->_roverName.c_str()), obsList);
[5883]524
[5890]525
[5883]526 if (nEpo % 10 == 0) {
[5940]527 emit progressRnxPPP(nEpo);
[5883]528 }
[7278]529
[5950]530 QCoreApplication::processEvents();
[5883]531 }
532
[5940]533 emit finishedRnxPPP();
[5927]534
[5883]535 if (BNC_CORE->mode() != t_bncCore::interactive) {
536 qApp->exit(0);
537 }
[5944]538 else {
539 BNC_CORE->stopPPP();
540 }
[5883]541}
542
[7278]543//
[5883]544////////////////////////////////////////////////////////////////////////////
545void t_pppRun::slotSetSpeed(int speed) {
546 QMutexLocker locker(&_mutex);
547 _speed = speed;
548}
[5973]549
[7278]550//
[5973]551////////////////////////////////////////////////////////////////////////////
552void t_pppRun::slotSetStopFlag() {
553 QMutexLocker locker(&_mutex);
554 _stopFlag = true;
555}
[5989]556
[7278]557//
[5989]558////////////////////////////////////////////////////////////////////////////
[5990]559QString t_pppRun::nmeaString(char strType, const t_output& output) {
[5989]560
[7278]561 double ell[3];
[5989]562 xyz2ell(output._xyzRover, ell);
563 double phiDeg = ell[0] * 180 / M_PI;
564 double lamDeg = ell[1] * 180 / M_PI;
565
566 char phiCh = 'N';
567 if (phiDeg < 0) {
568 phiDeg = -phiDeg;
569 phiCh = 'S';
[7278]570 }
[5989]571 char lamCh = 'E';
572 if (lamDeg < 0) {
573 lamDeg = -lamDeg;
574 lamCh = 'W';
[7278]575 }
[5989]576
[5990]577 ostringstream out;
578 out.setf(ios::fixed);
[5989]579
[5990]580 if (strType == 'R') {
581 string datestr = output._epoTime.datestr(0); // yyyymmdd
[7278]582 out << "GPRMC,"
[5990]583 << output._epoTime.timestr(0,0) << ",A,"
[7278]584 << setw(2) << setfill('0') << int(phiDeg)
585 << setw(6) << setprecision(3) << setfill('0')
[5990]586 << fmod(60*phiDeg,60) << ',' << phiCh << ','
[7278]587 << setw(3) << setfill('0') << int(lamDeg)
588 << setw(6) << setprecision(3) << setfill('0')
[5990]589 << fmod(60*lamDeg,60) << ',' << lamCh << ",,,"
590 << datestr[6] << datestr[7] << datestr[4] << datestr[5]
591 << datestr[2] << datestr[3] << ",,";
592 }
593 else if (strType == 'G') {
[7278]594 out << "GPGGA,"
[5990]595 << output._epoTime.timestr(0,0) << ','
[7278]596 << setw(2) << setfill('0') << int(phiDeg)
597 << setw(10) << setprecision(7) << setfill('0')
[5990]598 << fmod(60*phiDeg,60) << ',' << phiCh << ','
[7278]599 << setw(3) << setfill('0') << int(lamDeg)
600 << setw(10) << setprecision(7) << setfill('0')
601 << fmod(60*lamDeg,60) << ',' << lamCh
[5990]602 << ",1," << setw(2) << setfill('0') << output._numSat << ','
603 << setw(3) << setprecision(1) << output._pDop << ','
604 << setprecision(3) << ell[2] << ",M,0.0,M,,";
605 }
606 else {
607 return "";
608 }
[5989]609
[5990]610 QString nmStr(out.str().c_str());
[5989]611 unsigned char XOR = 0;
612 for (int ii = 0; ii < nmStr.length(); ii++) {
613 XOR ^= (unsigned char) nmStr[ii].toAscii();
614 }
615
616 return '$' + nmStr + QString("*%1\n").arg(int(XOR), 0, 16).toUpper();
617}
618
[7278]619//
[5999]620////////////////////////////////////////////////////////////////////////////
621bool t_pppRun::waitForCorr(const bncTime& epoTime) const {
622
[6001]623 if (!_opt->_realTime || _opt->_corrMount.empty()) {
[5999]624 return false;
625 }
[6001]626 else if (!_lastClkCorrTime.valid()) {
627 return true;
628 }
629 else {
630 double dt = epoTime - _lastClkCorrTime;
631 if (dt > 1.0 && dt < _opt->_corrWaitTime) {
632 return true;
633 }
634 else {
635 return false;
636 }
637 }
[5999]638 return false;
639}
Note: See TracBrowser for help on using the repository browser.