source: ntrip/trunk/BNC/bncgetthread.cpp@ 1555

Last change on this file since 1555 was 1555, checked in by mervart, 14 years ago

* empty log message *

File size: 24.2 KB
Line 
1// Part of BNC, a utility for retrieving decoding and
2// converting GNSS data streams from NTRIP broadcasters.
3//
4// Copyright (C) 2007
5// German Federal Agency for Cartography and Geodesy (BKG)
6// http://www.bkg.bund.de
7// Czech Technical University Prague, Department of Geodesy
8// http://www.fsv.cvut.cz
9//
10// Email: euref-ip@bkg.bund.de
11//
12// This program is free software; you can redistribute it and/or
13// modify it under the terms of the GNU General Public License
14// as published by the Free Software Foundation, version 2.
15//
16// This program is distributed in the hope that it will be useful,
17// but WITHOUT ANY WARRANTY; without even the implied warranty of
18// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19// GNU General Public License for more details.
20//
21// You should have received a copy of the GNU General Public License
22// along with this program; if not, write to the Free Software
23// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24
25/* -------------------------------------------------------------------------
26 * BKG NTRIP Client
27 * -------------------------------------------------------------------------
28 *
29 * Class: bncGetThread
30 *
31 * Purpose: Thread that retrieves data from NTRIP caster
32 *
33 * Author: L. Mervart
34 *
35 * Created: 24-Dec-2005
36 *
37 * Changes:
38 *
39 * -----------------------------------------------------------------------*/
40
41#include <stdlib.h>
42#include <iomanip>
43#include <sstream>
44
45#include <QFile>
46#include <QTextStream>
47#include <QtNetwork>
48#include <QTime>
49
50#include "bncgetthread.h"
51#include "bnctabledlg.h"
52#include "bncapp.h"
53#include "bncutils.h"
54#include "bncrinex.h"
55#include "bnczerodecoder.h"
56#include "bncnetqueryv1.h"
57#include "bncnetqueryv2.h"
58#include "bncnetqueryrtp.h"
59#include "bncsettings.h"
60
61#include "RTCM/RTCM2Decoder.h"
62#include "RTCM3/RTCM3Decoder.h"
63#include "RTIGS/RTIGSDecoder.h"
64#include "GPSS/gpssDecoder.h"
65#include "serial/qextserialport.h"
66
67using namespace std;
68
69// Constructor 1
70////////////////////////////////////////////////////////////////////////////
71bncGetThread::bncGetThread(const QByteArray& rawInpFileName,
72 const QByteArray& format) {
73
74 _rawInpFile = new QFile(rawInpFileName);
75 _rawInpFile->open(QIODevice::ReadOnly);
76 _format = format;
77 _staID = rawInpFileName.mid(
78 rawInpFileName.lastIndexOf(QDir::separator())+1,4);
79
80 initialize();
81}
82
83// Constructor 2
84////////////////////////////////////////////////////////////////////////////
85bncGetThread::bncGetThread(const QUrl& mountPoint,
86 const QByteArray& format,
87 const QByteArray& latitude,
88 const QByteArray& longitude,
89 const QByteArray& nmea,
90 const QByteArray& ntripVersion, int iMount) {
91 _rawInpFile = 0;
92 _mountPoint = mountPoint;
93 _staID = mountPoint.path().mid(1).toAscii();
94 _format = format;
95 _latitude = latitude;
96 _longitude = longitude;
97 _nmea = nmea;
98 _ntripVersion = ntripVersion;
99 _iMount = iMount; // index in mountpoints array
100
101 initialize();
102}
103
104// Initialization (common part of the constructor)
105////////////////////////////////////////////////////////////////////////////
106void bncGetThread::initialize() {
107
108 setTerminationEnabled(true);
109
110 bncApp* app = (bncApp*) qApp;
111
112 connect(this, SIGNAL(newMessage(QByteArray,bool)),
113 app, SLOT(slotMessage(const QByteArray,bool)));
114
115 _isToBeDeleted = false;
116 _decoder = 0;
117 _query = 0;
118 _nextSleep = 0;
119 _rawOutFile = 0;
120 _staID_orig = _staID;
121
122 // Check name conflict
123 // -------------------
124 bncSettings settings;
125 QListIterator<QString> it(settings.value("mountPoints").toStringList());
126 int num = 0;
127 int ind = -1;
128 while (it.hasNext()) {
129 ++ind;
130 QStringList hlp = it.next().split(" ");
131 if (hlp.size() <= 1) continue;
132 QUrl url(hlp[0]);
133 if (_mountPoint.path() == url.path()) {
134 if (_iMount > ind || _iMount < 0) {
135 ++num;
136 }
137 }
138 }
139
140 if (num > 0) {
141 _staID = _staID.left(_staID.length()-1) + QString("%1").arg(num).toAscii();
142 }
143
144 // RINEX writer
145 // ------------
146 _samplingRate = settings.value("rnxSampl").toInt();
147 if ( settings.value("rnxPath").toString().isEmpty() ) {
148 _rnx = 0;
149 if (_rawInpFile) {
150 cerr << "no RINEX path specified" << endl;
151 ::exit(1);
152 }
153 }
154 else {
155 _rnx = new bncRinex(_staID, _mountPoint, _format, _latitude,
156 _longitude, _nmea);
157 }
158
159 // Serial Port
160 // -----------
161 if (settings.value("serialMountPoint").toString() == _staID) {
162 _serialPort = new QextSerialPort(
163 settings.value("serialPortName").toString() );
164 QString hlp = settings.value("serialBaudRate").toString();
165 if (hlp == "110") {
166 _serialPort->setBaudRate(BAUD110);
167 }
168 else if (hlp == "300") {
169 _serialPort->setBaudRate(BAUD300);
170 }
171 else if (hlp == "600") {
172 _serialPort->setBaudRate(BAUD600);
173 }
174 else if (hlp == "1200") {
175 _serialPort->setBaudRate(BAUD1200);
176 }
177 else if (hlp == "2400") {
178 _serialPort->setBaudRate(BAUD2400);
179 }
180 else if (hlp == "4800") {
181 _serialPort->setBaudRate(BAUD4800);
182 }
183 else if (hlp == "9600") {
184 _serialPort->setBaudRate(BAUD9600);
185 }
186 else if (hlp == "19200") {
187 _serialPort->setBaudRate(BAUD19200);
188 }
189 else if (hlp == "38400") {
190 _serialPort->setBaudRate(BAUD38400);
191 }
192 else if (hlp == "57600") {
193 _serialPort->setBaudRate(BAUD57600);
194 }
195 else if (hlp == "115200") {
196 _serialPort->setBaudRate(BAUD115200);
197 }
198 hlp = settings.value("serialParity").toString();
199 if (hlp == "NONE") {
200 _serialPort->setParity(PAR_NONE);
201 }
202 else if (hlp == "ODD") {
203 _serialPort->setParity(PAR_ODD);
204 }
205 else if (hlp == "EVEN") {
206 _serialPort->setParity(PAR_EVEN);
207 }
208 else if (hlp == "SPACE") {
209 _serialPort->setParity(PAR_SPACE);
210 }
211 hlp = settings.value("serialDataBits").toString();
212 if (hlp == "5") {
213 _serialPort->setDataBits(DATA_5);
214 }
215 else if (hlp == "6") {
216 _serialPort->setDataBits(DATA_6);
217 }
218 else if (hlp == "7") {
219 _serialPort->setDataBits(DATA_7);
220 }
221 else if (hlp == "8") {
222 _serialPort->setDataBits(DATA_8);
223 }
224 hlp = settings.value("serialStopBits").toString();
225 if (hlp == "1") {
226 _serialPort->setStopBits(STOP_1);
227 }
228 else if (hlp == "2") {
229 _serialPort->setStopBits(STOP_2);
230 }
231 _serialPort->open(QIODevice::ReadWrite|QIODevice::Unbuffered);
232 if (!_serialPort->isOpen()) {
233 delete _serialPort;
234 _serialPort = 0;
235 emit(newMessage((_staID + ": Cannot open serial port\n"), true));
236 }
237 }
238 else {
239 _serialPort = 0;
240 }
241
242 // Raw Output
243 // ----------
244 // QByteArray rawOutFileName = "./" + _staID + ".raw";
245 // _rawOutFile = new QFile(rawOutFileName);
246 // _rawOutFile->open(QIODevice::WriteOnly);
247
248
249 // Instantiate the decoder
250 // -----------------------
251 if (_format.indexOf("RTCM_2") != -1) {
252 emit(newMessage(_staID + ": Get data in RTCM 2.x format", true));
253 _decoder = new RTCM2Decoder(_staID.data());
254 }
255 else if (_format.indexOf("RTCM_3") != -1) {
256 emit(newMessage(_staID + ": Get data in RTCM 3.x format", true));
257 _decoder = new RTCM3Decoder(_staID);
258 connect((RTCM3Decoder*) _decoder, SIGNAL(newMessage(QByteArray,bool)),
259 this, SIGNAL(newMessage(QByteArray,bool)));
260 }
261 else if (_format.indexOf("RTIGS") != -1) {
262 emit(newMessage(_staID + ": Get data in RTIGS format", true));
263 _decoder = new RTIGSDecoder();
264 }
265 else if (_format.indexOf("GPSS") != -1 || _format.indexOf("BNC") != -1) {
266 emit(newMessage(_staID + ": Get Data in GPSS format", true));
267 _decoder = new gpssDecoder();
268 }
269 else if (_format.indexOf("ZERO") != -1) {
270 emit(newMessage(_staID + ": Get data in original format", true));
271 _decoder = new bncZeroDecoder(_staID);
272 }
273 else {
274 emit(newMessage(_staID + ": Unknown data format " + _format, true));
275 _isToBeDeleted = true;
276 delete this;
277 }
278
279 msleep(100); //sleep 0.1 sec
280}
281
282// Destructor
283////////////////////////////////////////////////////////////////////////////
284bncGetThread::~bncGetThread() {
285 if (_query) {
286 _query->stop();
287 delete _query;
288 }
289 delete _decoder;
290 delete _rnx;
291 delete _rawInpFile;
292 delete _rawOutFile;
293 delete _serialPort;
294}
295
296//
297////////////////////////////////////////////////////////////////////////////
298void bncGetThread::terminate() {
299 _isToBeDeleted = true;
300}
301
302// Run
303////////////////////////////////////////////////////////////////////////////
304void bncGetThread::run() {
305
306 while (true) {
307 try {
308 if (_isToBeDeleted) {
309 QThread::exit(0);
310 this->deleteLater();
311 return;
312 }
313
314 if (tryReconnect() != success) {
315 continue;
316 }
317
318 // Delete old observations
319 // -----------------------
320 QListIterator<p_obs> itOld(_decoder->_obsList);
321 while (itOld.hasNext()) {
322 delete itOld.next();
323 }
324 _decoder->_obsList.clear();
325
326 // Read Data
327 // ---------
328 QByteArray data;
329 if (_query) {
330 _query->waitForReadyRead(data);
331 }
332 else if (_rawInpFile) {
333 const qint64 maxBytes = 1024;
334 data = _rawInpFile->read(maxBytes);
335 if (data.isEmpty()) {
336 cout << "no more data" << endl;
337 ::exit(0);
338 }
339 }
340 qint64 nBytes = data.size();
341
342 // Timeout, reconnect
343 // ------------------
344 if (nBytes == 0) {
345 emit(newMessage(_staID + ": Data timeout, reconnecting", true));
346 continue;
347 }
348 else {
349 emit newBytes(_staID, nBytes);
350 }
351
352 // Output Data
353 // -----------
354 if (_rawOutFile) {
355 _rawOutFile->write(data);
356 _rawOutFile->flush();
357 }
358 if (_serialPort) {
359 _serialPort->write(data);
360 }
361
362 // Decode Data
363 // -----------
364 vector<string> errmsg;
365 _decoder->Decode(data.data(), data.size(), errmsg);
366
367 // Perform various scans and checks
368 // --------------------------------
369 scanRTCM();
370 checkLatency();
371
372 // Loop over all observations (observations output)
373 // ------------------------------------------------
374 QListIterator<p_obs> it(_decoder->_obsList);
375 while (it.hasNext()) {
376 p_obs obs = it.next();
377
378 // Check observation epoch
379 // -----------------------
380 if (!_rawInpFile && !dynamic_cast<gpssDecoder*>(_decoder)) {
381 int week;
382 double sec;
383 currentGPSWeeks(week, sec);
384 const double secPerWeek = 7.0 * 24.0 * 3600.0;
385
386 if (week < obs->_o.GPSWeek) {
387 week += 1;
388 sec -= secPerWeek;
389 }
390 if (week > obs->_o.GPSWeek) {
391 week -= 1;
392 sec += secPerWeek;
393 }
394 double dt = fabs(sec - obs->_o.GPSWeeks);
395 const double maxDt = 600.0;
396 if (week != obs->_o.GPSWeek || dt > maxDt) {
397 emit( newMessage(_staID + ": Wrong observation epoch(s)", true) );
398 delete obs;
399 continue;
400 }
401 }
402
403 // RINEX Output
404 // ------------
405 if (_rnx) {
406 long iSec = long(floor(obs->_o.GPSWeeks+0.5));
407 long newTime = obs->_o.GPSWeek * 7*24*3600 + iSec;
408 if (_samplingRate == 0 || iSec % _samplingRate == 0) {
409 _rnx->deepCopy(obs);
410 }
411 _rnx->dumpEpoch(newTime);
412 }
413
414 // Emit new observation signal
415 // ---------------------------
416 bool firstObs = (obs == _decoder->_obsList.first());
417 obs->_status = t_obs::posted;
418 emit newObs(_staID, firstObs, obs);
419 }
420 _decoder->_obsList.clear();
421 }
422 catch (const char* msg) {
423 emit(newMessage(_staID + msg, true));
424 tryReconnect();
425 }
426 catch (...) {
427 emit(newMessage(_staID + "unknown exception", true));
428 tryReconnect();
429 }
430 }
431}
432
433// Try Re-Connect
434////////////////////////////////////////////////////////////////////////////
435t_irc bncGetThread::tryReconnect() {
436
437 // Easy Return
438 // -----------
439 if (_query && _query->status() == bncNetQuery::running) {
440 _nextSleep = 0;
441 return success;
442 }
443
444 // Start a new query
445 // -----------------
446 if (!_rawInpFile) {
447
448 sleep(_nextSleep);
449 if (_nextSleep == 0) {
450 _nextSleep = 1;
451 }
452 else {
453 _nextSleep = 2 * _nextSleep;
454 if (_nextSleep > 256) {
455 _nextSleep = 256;
456 }
457 }
458
459 delete _query;
460 if (_ntripVersion == "R") {
461 _query = new bncNetQueryRtp();
462 }
463 else if (_ntripVersion == "2") {
464 _query = new bncNetQueryV2();
465 }
466 else {
467 _query = new bncNetQueryV1();
468 }
469 if (_nmea == "yes") {
470 QByteArray gga = ggaString(_latitude, _longitude);
471 _query->startRequest(_mountPoint, gga);
472 }
473 else {
474 _query->startRequest(_mountPoint, "");
475 }
476 if (_query->status() != bncNetQuery::running) {
477 return failure;
478 }
479 }
480
481 if (_rnx) {
482 _rnx->setReconnectFlag(true);
483 }
484
485 return success;
486}
487
488// RTCM scan output
489//////////////////////////////////////////////////////////////////////////////
490void bncGetThread::scanRTCM() {
491
492 bncSettings settings;
493 if ( Qt::CheckState(settings.value("scanRTCM").toInt()) == Qt::Checked) {
494
495 // RTCMv3 message types
496 // --------------------
497 for (int ii = 0; ii <_decoder->_typeList.size(); ii++) {
498 QString type = QString("%1 ").arg(_decoder->_typeList[ii]);
499 emit(newMessage(_staID + ": Received message type " + type.toAscii(), true));
500 }
501
502 // RTCMv3 antenna descriptor
503 // -------------------------
504 for (int ii=0;ii<_decoder->_antType.size();ii++) {
505 QString ant1 = QString("%1 ").arg(_decoder->_antType[ii]);
506 emit(newMessage(_staID + ": Antenna descriptor " + ant1.toAscii(), true));
507 }
508
509 // Antenna Coordinates
510 // -------------------
511 for (int ii=0; ii <_decoder->_antList.size(); ii++) {
512 QByteArray antT;
513 if (_decoder->_antList[ii].type == GPSDecoder::t_antInfo::ARP) {
514 antT = "ARP";
515 }
516 else if (_decoder->_antList[ii].type == GPSDecoder::t_antInfo::APC) {
517 antT = "APC";
518 }
519 emit(newAntCrd(_staID, _decoder->_antList[ii].xx,
520 _decoder->_antList[ii].yy, _decoder->_antList[ii].zz,
521 antT));
522 }
523 }
524
525 _decoder->_typeList.clear();
526 _decoder->_antType.clear();
527 _decoder->_antList.clear();
528}
529
530//
531//////////////////////////////////////////////////////////////////////////////
532void bncGetThread::checkLatency() {
533//// // Notice threshold
534//// // ----------------
535//// _inspSegm = 50;
536//// if ( settings.value("obsRate").toString().isEmpty() ) { _inspSegm = 0; }
537//// if ( settings.value("obsRate").toString().indexOf("5 Hz") != -1 ) { _inspSegm = 2; }
538//// if ( settings.value("obsRate").toString().indexOf("1 Hz") != -1 ) { _inspSegm = 10; }
539//// if ( settings.value("obsRate").toString().indexOf("0.5 Hz") != -1 ) { _inspSegm = 20; }
540//// if ( settings.value("obsRate").toString().indexOf("0.2 Hz") != -1 ) { _inspSegm = 40; }
541//// if ( settings.value("obsRate").toString().indexOf("0.1 Hz") != -1 ) { _inspSegm = 50; }
542//// _adviseFail = settings.value("adviseFail").toInt();
543//// _adviseReco = settings.value("adviseReco").toInt();
544//// _makePause = false;
545//// if ( Qt::CheckState(settings.value("makePause").toInt()) == Qt::Checked) {_makePause = true; }
546//// _adviseScript = settings.value("adviseScript").toString();
547//// expandEnvVar(_adviseScript);
548////
549//// // Latency interval/average
550//// // ------------------------
551//// _perfIntr = 86400;
552//// if ( settings.value("perfIntr").toString().isEmpty() ) { _perfIntr = 0; }
553//// if ( settings.value("perfIntr").toString().indexOf("2 sec") != -1 ) { _perfIntr = 2; }
554//// if ( settings.value("perfIntr").toString().indexOf("10 sec") != -1 ) { _perfIntr = 10; }
555//// if ( settings.value("perfIntr").toString().indexOf("1 min") != -1 ) { _perfIntr = 60; }
556//// if ( settings.value("perfIntr").toString().indexOf("5 min") != -1 ) { _perfIntr = 300; }
557//// if ( settings.value("perfIntr").toString().indexOf("15 min") != -1 ) { _perfIntr = 900; }
558//// if ( settings.value("perfIntr").toString().indexOf("1 hour") != -1 ) { _perfIntr = 3600; }
559//// if ( settings.value("perfIntr").toString().indexOf("6 hours") != -1 ) { _perfIntr = 21600; }
560//// if ( settings.value("perfIntr").toString().indexOf("1 day") != -1 ) { _perfIntr = 86400; }
561////
562//// // RTCM message types
563//// // ------------------
564//// _checkMountPoint = settings.value("miscMount").toString();
565////
566////
567//// const double maxDt = 600.0; // Check observation epoch
568//// bool wrongEpoch = false;
569//// bool decode = true;
570//// int numSucc = 0;
571//// int secSucc = 0;
572//// int secFail = 0;
573//// int initPause = 30; // Initial pause for corrupted streams
574//// int currPause = 0;
575//// bool begCorrupt = false;
576//// bool endCorrupt = false;
577//// bool followSec = false;
578//// int oldSecGPS= 0;
579//// int newSecGPS = 0;
580//// int numGaps = 0;
581//// int diffSecGPS = 0;
582//// int numLat = 0;
583//// double sumLat = 0.;
584//// double sumLatQ = 0.;
585//// double meanDiff = 0.;
586//// double minLat = maxDt;
587//// double maxLat = -maxDt;
588//// double curLat = 0.;
589////
590////
591//// _decodeTime = QDateTime::currentDateTime();
592//// _decodeSucc = QDateTime::currentDateTime();
593////
594//// // Check - once per inspect segment
595//// // --------------------------------
596//// if (!decode) {
597//// _decodeTime = QDateTime::currentDateTime();
598//// if (numSucc>0) {
599//// secSucc += _inspSegm;
600//// _decodeSucc = QDateTime::currentDateTime();
601//// if (secSucc > _adviseReco * 60) {
602//// secSucc = _adviseReco * 60 + 1;
603//// }
604//// numSucc = 0;
605//// currPause = initPause;
606//// _decodePause.setDate(QDate());
607//// _decodePause.setTime(QTime());
608//// }
609//// else {
610//// secFail += _inspSegm;
611//// secSucc = 0;
612//// if (secFail > _adviseFail * 60) {
613//// secFail = _adviseFail * 60 + 1;
614//// }
615//// if (!_decodePause.isValid() || !_makePause) {
616//// _decodePause = QDateTime::currentDateTime();
617//// }
618//// else {
619//// _decodePause.setDate(QDate());
620//// _decodePause.setTime(QTime());
621//// secFail = secFail + currPause - _inspSegm;
622//// currPause = currPause * 2;
623//// if (currPause > 960) {
624//// currPause = 960;
625//// }
626//// }
627//// }
628////
629//// // End corrupt threshold
630//// // ---------------------
631//// if ( begCorrupt && !endCorrupt && secSucc > _adviseReco * 60 ) {
632//// _endDateCor = QDateTime::currentDateTime().addSecs(- _adviseReco * 60).toUTC().date().toString("yy-MM-dd");
633//// _endTimeCor = QDateTime::currentDateTime().addSecs(- _adviseReco * 60).toUTC().time().toString("hh:mm:ss");
634//// emit(newMessage((_staID + ": Recovery threshold exceeded, corruption ended "
635//// + _endDateCor + " " + _endTimeCor).toAscii(), true));
636//// callScript(("End_Corrupted " + _endDateCor + " " + _endTimeCor + " Begin was " + _begDateCor + " " + _begTimeCor).toAscii());
637//// endCorrupt = true;
638//// begCorrupt = false;
639//// secFail = 0;
640//// }
641//// else {
642////
643//// // Begin corrupt threshold
644//// // -----------------------
645//// if ( !begCorrupt && secFail > _adviseFail * 60 ) {
646//// _begDateCor = _decodeSucc.toUTC().date().toString("yy-MM-dd");
647//// _begTimeCor = _decodeSucc.toUTC().time().toString("hh:mm:ss");
648//// emit(newMessage((_staID + ": Failure threshold exceeded, corrupted since "
649//// + _begDateCor + " " + _begTimeCor).toAscii(), true));
650//// callScript(("Begin_Corrupted " + _begDateCor + " " + _begTimeCor).toAscii());
651//// begCorrupt = true;
652//// endCorrupt = false;
653//// secSucc = 0;
654//// numSucc = 0;
655//// }
656//// }
657//// decode = true;
658//// }
659//// }
660//// }
661////
662//// // End outage threshold
663//// // --------------------
664//// if ( _decodeStart.isValid() && _decodeStart.secsTo(QDateTime::currentDateTime()) > _adviseReco * 60 ) {
665//// _decodeStart.setDate(QDate());
666//// _decodeStart.setTime(QTime());
667//// if (_inspSegm>0) {
668//// _endDateOut = QDateTime::currentDateTime().addSecs(- _adviseReco * 60).toUTC().date().toString("yy-MM-dd");
669//// _endTimeOut = QDateTime::currentDateTime().addSecs(- _adviseReco * 60).toUTC().time().toString("hh:mm:ss");
670//// emit(newMessage((_staID + ": Recovery threshold exceeded, outage ended "
671//// + _endDateOut + " " + _endTimeOut).toAscii(), true));
672//// callScript(("End_Outage " + _endDateOut + " " + _endTimeOut + " Begin was " + _begDateOut + " " + _begTimeOut).toAscii());
673//// }
674//// }
675////
676//// else {
677//// wrongEpoch = false;
678////
679//// // Latency and completeness
680//// // ------------------------
681//// if (_perfIntr>0) {
682//// if ( _checkMountPoint == _staID || _checkMountPoint == "ALL" ) {
683//// newSecGPS = static_cast<int>(obs->_o.GPSWeeks);
684//// if (newSecGPS != oldSecGPS) {
685//// if (newSecGPS % _perfIntr < oldSecGPS % _perfIntr) {
686//// if (numLat>0) {
687//// if (meanDiff>0.) {
688//// emit( newMessage(QString("%1: Mean latency %2 sec, min %3, max %4, rms %5, %6 epochs, %7 gaps")
689//// .arg(_staID.data())
690//// .arg(int(sumLat/numLat*100)/100.)
691//// .arg(int(minLat*100)/100.)
692//// .arg(int(maxLat*100)/100.)
693//// .arg(int((sqrt((sumLatQ - sumLat * sumLat / numLat)/numLat))*100)/100.)
694//// .arg(numLat)
695//// .arg(numGaps)
696//// .toAscii(), true) );
697//// } else {
698//// emit( newMessage(QString("%1: Mean latency %2 sec, min %3, max %4, rms %5, %6 epochs")
699//// .arg(_staID.data())
700//// .arg(int(sumLat/numLat*100)/100.)
701//// .arg(int(minLat*100)/100.)
702//// .arg(int(maxLat*100)/100.)
703//// .arg(int((sqrt((sumLatQ - sumLat * sumLat / numLat)/numLat))*100)/100.)
704//// .arg(numLat)
705//// .toAscii(), true) );
706//// }
707//// }
708//// meanDiff = diffSecGPS/numLat;
709//// diffSecGPS = 0;
710//// numGaps = 0;
711//// sumLat = 0.;
712//// sumLatQ = 0.;
713//// numLat = 0;
714//// minLat = maxDt;
715//// maxLat = -maxDt;
716//// }
717//// if (followSec) {
718//// diffSecGPS += newSecGPS - oldSecGPS;
719//// if (meanDiff>0.) {
720//// if (newSecGPS - oldSecGPS > 1.5 * meanDiff) {
721//// numGaps += 1;
722//// }
723//// }
724//// }
725//// curLat = sec - obs->_o.GPSWeeks;
726//// sumLat += curLat;
727//// sumLatQ += curLat * curLat;
728//// if (curLat < minLat) minLat = curLat;
729//// if (curLat >= maxLat) maxLat = curLat;
730//// numLat += 1;
731//// oldSecGPS = newSecGPS;
732//// followSec = true;
733//// }
734//// }
735//// }
736////
737}
Note: See TracBrowser for help on using the repository browser.