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

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