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

Last change on this file since 3527 was 3527, checked in by mervart, 12 years ago
File size: 21.8 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 "bncnetqueryv0.h"
57#include "bncnetqueryv1.h"
58#include "bncnetqueryv2.h"
59#include "bncnetqueryrtp.h"
60#include "bncnetqueryudp.h"
61#include "bncnetqueryudp0.h"
62#include "bncnetquerys.h"
63#include "bncsettings.h"
64#include "latencychecker.h"
65#include "bncpppclient.h"
66#include "upload/bncrtnetdecoder.h"
67#include "RTCM/RTCM2Decoder.h"
68#include "RTCM3/RTCM3Decoder.h"
69#include "GPSS/gpssDecoder.h"
70#include "GPSS/hassDecoder.h"
71#include "serial/qextserialport.h"
72
73using namespace std;
74
75// Constructor 1
76////////////////////////////////////////////////////////////////////////////
77bncGetThread::bncGetThread(bncRawFile* rawFile) {
78
79 _rawFile = rawFile;
80 _format = rawFile->format();
81 _staID = rawFile->staID();
82 _rawOutput = false;
83 _ntripVersion = "N";
84
85 initialize();
86}
87
88// Constructor 2
89////////////////////////////////////////////////////////////////////////////
90bncGetThread::bncGetThread(const QUrl& mountPoint,
91 const QByteArray& format,
92 const QByteArray& latitude,
93 const QByteArray& longitude,
94 const QByteArray& nmea,
95 const QByteArray& ntripVersion) {
96 _rawFile = 0;
97 _mountPoint = mountPoint;
98 _staID = mountPoint.path().mid(1).toAscii();
99 _format = format;
100 _latitude = latitude;
101 _longitude = longitude;
102 _nmea = nmea;
103 _ntripVersion = ntripVersion;
104
105 bncSettings settings;
106 if (!settings.value("rawOutFile").toString().isEmpty()) {
107 _rawOutput = true;
108 }
109
110 initialize();
111 initDecoder();
112}
113
114// Initialization (common part of the constructor)
115////////////////////////////////////////////////////////////////////////////
116void bncGetThread::initialize() {
117
118 setTerminationEnabled(true);
119
120 bncApp* app = (bncApp*) qApp;
121
122 connect(this, SIGNAL(newMessage(QByteArray,bool)),
123 app, SLOT(slotMessage(const QByteArray,bool)));
124
125 _isToBeDeleted = false;
126 _query = 0;
127 _nextSleep = 0;
128 _PPPclient = 0;
129
130 bncSettings settings;
131
132 _miscMount = settings.value("miscMount").toString();
133
134 // RINEX writer
135 // ------------
136 _samplingRate = settings.value("rnxSampl").toInt();
137 if ( settings.value("rnxPath").toString().isEmpty() ) {
138 _rnx = 0;
139 }
140 else {
141 _rnx = new bncRinex(_staID, _mountPoint, _latitude, _longitude,
142 _nmea, _ntripVersion);
143 }
144
145 // Serial Port
146 // -----------
147 _serialNMEA = NO_NMEA;
148 _serialOutFile = 0;
149 _serialPort = 0;
150
151 if (settings.value("serialMountPoint").toString() == _staID) {
152 _serialPort = new QextSerialPort(settings.value("serialPortName").toString() );
153 _serialPort->setTimeout(0,100);
154
155 // Baud Rate
156 // ---------
157 QString hlp = settings.value("serialBaudRate").toString();
158 if (hlp == "110") {
159 _serialPort->setBaudRate(BAUD110);
160 }
161 else if (hlp == "300") {
162 _serialPort->setBaudRate(BAUD300);
163 }
164 else if (hlp == "600") {
165 _serialPort->setBaudRate(BAUD600);
166 }
167 else if (hlp == "1200") {
168 _serialPort->setBaudRate(BAUD1200);
169 }
170 else if (hlp == "2400") {
171 _serialPort->setBaudRate(BAUD2400);
172 }
173 else if (hlp == "4800") {
174 _serialPort->setBaudRate(BAUD4800);
175 }
176 else if (hlp == "9600") {
177 _serialPort->setBaudRate(BAUD9600);
178 }
179 else if (hlp == "19200") {
180 _serialPort->setBaudRate(BAUD19200);
181 }
182 else if (hlp == "38400") {
183 _serialPort->setBaudRate(BAUD38400);
184 }
185 else if (hlp == "57600") {
186 _serialPort->setBaudRate(BAUD57600);
187 }
188 else if (hlp == "115200") {
189 _serialPort->setBaudRate(BAUD115200);
190 }
191
192 // Parity
193 // ------
194 hlp = settings.value("serialParity").toString();
195 if (hlp == "NONE") {
196 _serialPort->setParity(PAR_NONE);
197 }
198 else if (hlp == "ODD") {
199 _serialPort->setParity(PAR_ODD);
200 }
201 else if (hlp == "EVEN") {
202 _serialPort->setParity(PAR_EVEN);
203 }
204 else if (hlp == "SPACE") {
205 _serialPort->setParity(PAR_SPACE);
206 }
207
208 // Data Bits
209 // ---------
210 hlp = settings.value("serialDataBits").toString();
211 if (hlp == "5") {
212 _serialPort->setDataBits(DATA_5);
213 }
214 else if (hlp == "6") {
215 _serialPort->setDataBits(DATA_6);
216 }
217 else if (hlp == "7") {
218 _serialPort->setDataBits(DATA_7);
219 }
220 else if (hlp == "8") {
221 _serialPort->setDataBits(DATA_8);
222 }
223 hlp = settings.value("serialStopBits").toString();
224 if (hlp == "1") {
225 _serialPort->setStopBits(STOP_1);
226 }
227 else if (hlp == "2") {
228 _serialPort->setStopBits(STOP_2);
229 }
230
231 // Flow Control
232 // ------------
233 hlp = settings.value("serialFlowControl").toString();
234 if (hlp == "XONXOFF") {
235 _serialPort->setFlowControl(FLOW_XONXOFF);
236 }
237 else if (hlp == "HARDWARE") {
238 _serialPort->setFlowControl(FLOW_HARDWARE);
239 }
240 else {
241 _serialPort->setFlowControl(FLOW_OFF);
242 }
243
244 // Open Serial Port
245 // ----------------
246 _serialPort->open(QIODevice::ReadWrite|QIODevice::Unbuffered);
247 if (!_serialPort->isOpen()) {
248 delete _serialPort;
249 _serialPort = 0;
250 emit(newMessage((_staID + ": Cannot open serial port\n"), true));
251 }
252 connect(_serialPort, SIGNAL(readyRead()),
253 this, SLOT(slotSerialReadyRead()));
254
255 // Automatic NMEA
256 // --------------
257 if (settings.value("serialAutoNMEA").toString() == "Auto") {
258 _serialNMEA = AUTO_NMEA;
259
260 QString fName = settings.value("serialFileNMEA").toString();
261 if (!fName.isEmpty()) {
262 _serialOutFile = new QFile(fName);
263 if ( Qt::CheckState(settings.value("rnxAppend").toInt()) == Qt::Checked) {
264 _serialOutFile->open(QIODevice::WriteOnly | QIODevice::Append);
265 }
266 else {
267 _serialOutFile->open(QIODevice::WriteOnly);
268 }
269 }
270 }
271
272 // Manual NMEA
273 // -----------
274 else {
275 _serialNMEA = MANUAL_NMEA;
276 }
277 }
278
279 // Initialize PPP Client?
280 // ----------------------
281#ifndef MLS_SOFTWARE
282 if (settings.value("pppMount").toString() == _staID) {
283 _PPPclient = new bncPPPclient(_staID);
284 app->_bncPPPclient = _PPPclient;
285 qRegisterMetaType<bncTime>("bncTime");
286 connect(_PPPclient, SIGNAL(newPosition(bncTime, double, double, double)),
287 this, SIGNAL(newPosition(bncTime, double, double, double)));
288 connect(_PPPclient, SIGNAL(newNMEAstr(QByteArray)),
289 this, SIGNAL(newNMEAstr(QByteArray)));
290 }
291#endif
292
293 _latencyChecker = new latencyChecker(_staID);
294}
295
296// Instantiate the decoder
297//////////////////////////////////////////////////////////////////////////////
298t_irc bncGetThread::initDecoder() {
299
300 if (_format.indexOf("RTCM_2") != -1 || _format.indexOf("RTCM2") != -1 ||
301 _format.indexOf("RTCM 2") != -1 ) {
302 emit(newMessage(_staID + ": Get data in RTCM 2.x format", true));
303 _decoders[_staID] = new RTCM2Decoder(_staID.data());
304 }
305 else if (_format.indexOf("RTCM_3") != -1 || _format.indexOf("RTCM3") != -1 ||
306 _format.indexOf("RTCM 3") != -1 ) {
307 emit(newMessage(_staID + ": Get data in RTCM 3.x format", true));
308 _decoders[_staID] = new RTCM3Decoder(_staID, _rawFile);
309 connect((RTCM3Decoder*) decoder(), SIGNAL(newMessage(QByteArray,bool)),
310 this, SIGNAL(newMessage(QByteArray,bool)));
311 }
312 else if (_format.indexOf("GPSS") != -1 || _format.indexOf("BNC") != -1) {
313 emit(newMessage(_staID + ": Get Data in GPSS format", true));
314 _decoders[_staID] = new gpssDecoder();
315 }
316 else if (_format.indexOf("ZERO") != -1) {
317 emit(newMessage(_staID + ": Get data in original format", true));
318 _decoders[_staID] = new bncZeroDecoder(_staID);
319 }
320 else if (_format.indexOf("RTNET") != -1) {
321 emit(newMessage(_staID + ": Get data in RTNet format", true));
322 _decoders[_staID] = new bncRtnetDecoder();
323 }
324 else if (_format.indexOf("HASS2ASCII") != -1) {
325 emit(newMessage(_staID + ": Get data in HASS2ASCII format", true));
326 _decoders[_staID] = new hassDecoder(_staID);
327 }
328 else {
329 emit(newMessage(_staID + ": Unknown data format " + _format, true));
330 _isToBeDeleted = true;
331 return failure;
332 }
333
334 msleep(100); //sleep 0.1 sec
335
336 return success;
337}
338
339// Current decoder in use
340////////////////////////////////////////////////////////////////////////////
341GPSDecoder* bncGetThread::decoder() {
342 if (_decoders.contains(_staID) || initDecoder() == success) {
343 return _decoders.value(_staID);
344 }
345 else {
346 return 0;
347 }
348}
349
350// Destructor
351////////////////////////////////////////////////////////////////////////////
352bncGetThread::~bncGetThread() {
353 if (isRunning()) {
354 wait();
355 }
356 if (_query) {
357 _query->stop();
358 _query->deleteLater();
359 }
360 delete _PPPclient;
361 QMapIterator<QString, GPSDecoder*> it(_decoders);
362 while (it.hasNext()) {
363 it.next();
364 delete it.value();
365 }
366 delete _rnx;
367 delete _rawFile;
368 delete _serialOutFile;
369 delete _serialPort;
370 delete _latencyChecker;
371 emit getThreadFinished(_staID);
372}
373
374//
375////////////////////////////////////////////////////////////////////////////
376void bncGetThread::terminate() {
377 _isToBeDeleted = true;
378 if (!isRunning()) {
379 delete this;
380 }
381}
382
383// Run
384////////////////////////////////////////////////////////////////////////////
385void bncGetThread::run() {
386
387 while (true) {
388 try {
389 if (_isToBeDeleted) {
390 QThread::exit(0);
391 this->deleteLater();
392 return;
393 }
394
395 if (tryReconnect() != success) {
396 _latencyChecker->checkReconnect();
397 continue;
398 }
399
400 // Delete old observations
401 // -----------------------
402 QMapIterator<QString, GPSDecoder*> itDec(_decoders);
403 while (itDec.hasNext()) {
404 itDec.next();
405 GPSDecoder* decoder = itDec.value();
406 decoder->_obsList.clear();
407 }
408
409 // Read Data
410 // ---------
411 QByteArray data;
412 if (_query) {
413 _query->waitForReadyRead(data);
414 }
415 else if (_rawFile) {
416 data = _rawFile->readChunk();
417 _format = _rawFile->format();
418 _staID = _rawFile->staID();
419
420 if (data.isEmpty()) {
421 cout << "no more data" << endl;
422 QThread::exit(0);
423 this->deleteLater();
424 return;
425 }
426 }
427 qint64 nBytes = data.size();
428
429 // Timeout, reconnect
430 // ------------------
431 if (nBytes == 0) {
432 _latencyChecker->checkReconnect();
433 emit(newMessage(_staID + ": Data timeout, reconnecting", true));
434 msleep(10000); //sleep 10 sec, G. Weber
435 continue;
436 }
437 else {
438 emit newBytes(_staID, nBytes);
439 }
440
441 // Output Data
442 // -----------
443 if (_rawOutput) {
444 bncApp* app = (bncApp*) qApp;
445 app->writeRawData(data, _staID, _format);
446 }
447
448 if (_serialPort) {
449 slotSerialReadyRead();
450 _serialPort->write(data);
451 }
452
453 // Decode Data
454 // -----------
455 vector<string> errmsg;
456 if (!decoder()) {
457 _isToBeDeleted = true;
458 continue;
459 }
460 decoder()->_obsList.clear();
461 t_irc irc = decoder()->Decode(data.data(), data.size(), errmsg);
462
463 // Perform various scans and checks
464 // --------------------------------
465 _latencyChecker->checkOutage(irc == success);
466 _latencyChecker->checkObsLatency(decoder()->_obsList);
467 _latencyChecker->checkCorrLatency(decoder()->corrGPSEpochTime());
468
469 emit newLatency(_staID, _latencyChecker->currentLatency());
470
471 scanRTCM();
472
473 // Loop over all observations (observations output)
474 // ------------------------------------------------
475 QListIterator<t_obs> it(decoder()->_obsList);
476 bool firstObs = true;
477 while (it.hasNext()) {
478 const t_obs& obs = it.next();
479
480 QString prn = QString("%1%2").arg(obs.satSys)
481 .arg(obs.satNum, 2, 10, QChar('0'));
482 long iSec = long(floor(obs.GPSWeeks+0.5));
483 long obsTime = obs.GPSWeek * 7*24*3600 + iSec;
484
485 // Check observation epoch
486 // -----------------------
487 if (!_rawFile && !dynamic_cast<gpssDecoder*>(decoder())) {
488 int week;
489 double sec;
490 currentGPSWeeks(week, sec);
491 long currTime = week * 7*24*3600 + long(sec);
492 const double maxDt = 600.0;
493 if (fabs(currTime - obsTime) > maxDt) {
494 emit( newMessage(_staID + ": Wrong observation epoch(s)", false) );
495 continue;
496 }
497 }
498
499 // Check observations coming twice (e.g. KOUR0 Problem)
500 // ----------------------------------------------------
501 QMap<QString, long>::const_iterator it = _prnLastEpo.find(prn);
502 if (it != _prnLastEpo.end()) {
503 long oldTime = it.value();
504 if (obsTime < oldTime) {
505 emit( newMessage(_staID +
506 ": old observation " + prn.toAscii(), false));
507 continue;
508 }
509 else if (obsTime == oldTime) {
510 emit( newMessage(_staID +
511 ": observation coming more than once " + prn.toAscii(), false));
512 continue;
513 }
514 }
515 _prnLastEpo[prn] = obsTime;
516
517 // RINEX Output
518 // ------------
519 if (_rnx) {
520 if (_samplingRate == 0 || iSec % _samplingRate == 0) {
521 _rnx->deepCopy(obs);
522 }
523 _rnx->dumpEpoch(_format, obsTime);
524 }
525
526 // PPP Client
527 // ----------
528#ifndef MLS_SOFTWARE
529 if (_PPPclient) {
530 _PPPclient->putNewObs(obs);
531 }
532#endif
533
534 // Emit new observation signal
535 // ---------------------------
536 if (!_isToBeDeleted) {
537 emit newObs(_staID, firstObs, obs);
538 }
539 firstObs = false;
540 }
541 decoder()->_obsList.clear();
542 }
543 catch (Exception& exc) {
544 emit(newMessage(_staID + " " + exc.what(), true));
545 _isToBeDeleted = true;
546 }
547 catch (...) {
548 emit(newMessage(_staID + " bncGetThread exception", true));
549 _isToBeDeleted = true;
550 }
551 }
552}
553
554// Try Re-Connect
555////////////////////////////////////////////////////////////////////////////
556t_irc bncGetThread::tryReconnect() {
557
558 // Easy Return
559 // -----------
560 if (_query && _query->status() == bncNetQuery::running) {
561 _nextSleep = 0;
562 if (_rnx) {
563 _rnx->setReconnectFlag(false);
564 }
565 return success;
566 }
567
568 // Start a new query
569 // -----------------
570 if (!_rawFile) {
571
572 sleep(_nextSleep);
573 if (_nextSleep == 0) {
574 _nextSleep = 1;
575 }
576 else {
577 _nextSleep = 2 * _nextSleep;
578 if (_nextSleep > 256) {
579 _nextSleep = 256;
580 }
581#ifdef MLS_SOFTWARE
582 if (_nextSleep > 4) {
583 _nextSleep = 4;
584 }
585#endif
586 }
587
588 delete _query;
589 if (_ntripVersion == "U") {
590 _query = new bncNetQueryUdp();
591 }
592 else if (_ntripVersion == "R") {
593 _query = new bncNetQueryRtp();
594 }
595 else if (_ntripVersion == "S") {
596 _query = new bncNetQueryS();
597 }
598 else if (_ntripVersion == "N") {
599 _query = new bncNetQueryV0();
600 }
601 else if (_ntripVersion == "UN") {
602 _query = new bncNetQueryUdp0();
603 }
604 else if (_ntripVersion == "2") {
605 _query = new bncNetQueryV2(false);
606 }
607 else if (_ntripVersion == "2s") {
608 _query = new bncNetQueryV2(true);
609 }
610 else {
611 _query = new bncNetQueryV1();
612 }
613 if (_nmea == "yes" && _serialNMEA != AUTO_NMEA) {
614 QByteArray gga = ggaString(_latitude, _longitude, "100.0");
615 _query->startRequest(_mountPoint, gga);
616 }
617 else {
618 _query->startRequest(_mountPoint, "");
619 }
620 if (_query->status() != bncNetQuery::running) {
621 return failure;
622 }
623 }
624
625 if (_rnx) {
626 _rnx->setReconnectFlag(true);
627 }
628
629 return success;
630}
631
632// RTCM scan output
633//////////////////////////////////////////////////////////////////////////////
634void bncGetThread::scanRTCM() {
635
636 bncSettings settings;
637 if ( Qt::CheckState(settings.value("scanRTCM").toInt()) == Qt::Checked ) {
638
639 if ( _miscMount == _staID || _miscMount == "ALL" ) {
640
641 // RTCM message types
642 // ------------------
643 for (int ii = 0; ii <decoder()->_typeList.size(); ii++) {
644 QString type = QString("%1 ").arg(decoder()->_typeList[ii]);
645 emit(newMessage(_staID + ": Received message type " + type.toAscii(), true));
646 }
647
648 // RTCMv3 antenna descriptor
649 // -------------------------
650 for (int ii=0;ii<decoder()->_antType.size();ii++) {
651 QString ant1 = QString("%1 ").arg(decoder()->_antType[ii]);
652 emit(newMessage(_staID + ": Antenna descriptor " + ant1.toAscii(), true));
653 }
654
655 // RTCM Antenna Coordinates
656 // ------------------------
657 for (int ii=0; ii <decoder()->_antList.size(); ii++) {
658 QByteArray antT;
659 if (decoder()->_antList[ii].type == GPSDecoder::t_antInfo::ARP) {
660 antT = "ARP";
661 }
662 else if (decoder()->_antList[ii].type == GPSDecoder::t_antInfo::APC) {
663 antT = "APC";
664 }
665 QByteArray ant1, ant2, ant3;
666 ant1 = QString("%1 ").arg(decoder()->_antList[ii].xx,0,'f',4).toAscii();
667 ant2 = QString("%1 ").arg(decoder()->_antList[ii].yy,0,'f',4).toAscii();
668 ant3 = QString("%1 ").arg(decoder()->_antList[ii].zz,0,'f',4).toAscii();
669 emit(newMessage(_staID + ": " + antT + " (ITRF) X " + ant1 + "m", true));
670 emit(newMessage(_staID + ": " + antT + " (ITRF) Y " + ant2 + "m", true));
671 emit(newMessage(_staID + ": " + antT + " (ITRF) Z " + ant3 + "m", true));
672 if (decoder()->_antList[ii].height_f) {
673 QByteArray ant4 = QString("%1 ").arg(decoder()->_antList[ii].height,0,'f',4).toAscii();
674 emit(newMessage(_staID + ": Antenna height above marker " + ant4 + "m", true));
675 }
676 emit(newAntCrd(_staID, decoder()->_antList[ii].xx,
677 decoder()->_antList[ii].yy, decoder()->_antList[ii].zz,
678 antT));
679 }
680 }
681 }
682
683#ifdef MLS_SOFTWARE
684 for (int ii=0; ii <decoder()->_antList.size(); ii++) {
685 QByteArray antT;
686 if (decoder()->_antList[ii].type == GPSDecoder::t_antInfo::ARP) {
687 antT = "ARP";
688 }
689 else if (decoder()->_antList[ii].type == GPSDecoder::t_antInfo::APC) {
690 antT = "APC";
691 }
692 emit(newAntCrd(_staID, decoder()->_antList[ii].xx,
693 decoder()->_antList[ii].yy, decoder()->_antList[ii].zz,
694 antT));
695 }
696
697 for (int ii = 0; ii <decoder()->_typeList.size(); ii++) {
698 emit(newRTCMMessage(_staID, decoder()->_typeList[ii]));
699 }
700#endif
701
702
703
704
705 decoder()->_typeList.clear();
706 decoder()->_antType.clear();
707 decoder()->_antList.clear();
708}
709
710// Handle Data from Serial Port
711////////////////////////////////////////////////////////////////////////////
712void bncGetThread::slotSerialReadyRead() {
713 if (_serialPort) {
714 int nb = _serialPort->bytesAvailable();
715 if (nb > 0) {
716 QByteArray data = _serialPort->read(nb);
717
718 if (_serialNMEA == AUTO_NMEA) {
719 int i1 = data.indexOf("$GPGGA");
720 if (i1 != -1) {
721 int i2 = data.indexOf("*", i1);
722 if (i2 != -1 && data.size() > i2 + 1) {
723 QByteArray gga = data.mid(i1,i2-i1+3);
724 _query->sendNMEA(gga);
725 }
726 }
727 }
728
729 if (_serialOutFile) {
730 _serialOutFile->write(data);
731 _serialOutFile->flush();
732 }
733 }
734 }
735}
736
737//
738//////////////////////////////////////////////////////////////////////////////
739void bncGetThread::slotNewEphGPS(gpsephemeris gpseph) {
740 RTCM2Decoder* decoder2 = dynamic_cast<RTCM2Decoder*>(decoder());
741 RTCM3Decoder* decoder3 = dynamic_cast<RTCM3Decoder*>(decoder());
742
743 if ( decoder2 ) {
744 QMutexLocker locker(&_mutex);
745
746 string storedPRN;
747 vector<int> IODs;
748
749 if ( decoder2->storeEph(gpseph, storedPRN, IODs) ) {
750#ifdef DEBUG_RTCM2_2021
751 QString msg = _staID + QString(": stored eph %1 IODs").arg(storedPRN.c_str());
752
753 for (unsigned ii = 0; ii < IODs.size(); ii++) {
754 msg += QString(" %1").arg(IODs[ii],4);
755 }
756
757 emit(newMessage(msg.toAscii()));
758#endif
759 }
760 }
761
762 if ( decoder3 ) {
763 QMutexLocker locker(&_mutex);
764
765 if ( decoder3->storeEph(gpseph) ) {
766#ifdef DEBUG_RTCM3
767 QString msg = _staID + QString(": RTCM3Decoder, stored eph for satellite %1").arg(gpseph.satellite);
768 emit(newMessage(msg.toAscii(),true));
769#endif
770 }
771 }
772}
773
Note: See TracBrowser for help on using the repository browser.