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 "bncsocket.h"
|
---|
57 |
|
---|
58 | #include "RTCM/RTCM2Decoder.h"
|
---|
59 | #include "RTCM3/RTCM3Decoder.h"
|
---|
60 | #include "RTIGS/RTIGSDecoder.h"
|
---|
61 | #include "GPSS/gpssDecoder.h"
|
---|
62 | #include "serial/qextserialport.h"
|
---|
63 |
|
---|
64 | using namespace std;
|
---|
65 |
|
---|
66 | // Constructor 1
|
---|
67 | ////////////////////////////////////////////////////////////////////////////
|
---|
68 | bncGetThread::bncGetThread(const QByteArray& rawInpFileName,
|
---|
69 | const QByteArray& format) {
|
---|
70 |
|
---|
71 | _format = format;
|
---|
72 |
|
---|
73 | int iSep = rawInpFileName.lastIndexOf(QDir::separator());
|
---|
74 | _staID = rawInpFileName.mid(iSep+1,4);
|
---|
75 |
|
---|
76 | initialize();
|
---|
77 |
|
---|
78 | _inspSegm = 0;
|
---|
79 |
|
---|
80 | _rawInpFile = new QFile(rawInpFileName);
|
---|
81 | _rawInpFile->open(QIODevice::ReadOnly);
|
---|
82 |
|
---|
83 | if (!_rnx) {
|
---|
84 | cerr << "no RINEX path specified" << endl;
|
---|
85 | ::exit(0);
|
---|
86 | }
|
---|
87 | }
|
---|
88 |
|
---|
89 | // Constructor 2
|
---|
90 | ////////////////////////////////////////////////////////////////////////////
|
---|
91 | bncGetThread::bncGetThread(const QUrl& mountPoint,
|
---|
92 | const QByteArray& format,
|
---|
93 | const QByteArray& latitude,
|
---|
94 | const QByteArray& longitude,
|
---|
95 | const QByteArray& nmea, int iMount) {
|
---|
96 |
|
---|
97 | setTerminationEnabled(true);
|
---|
98 |
|
---|
99 | _mountPoint = mountPoint;
|
---|
100 | _staID = mountPoint.path().mid(1).toAscii();
|
---|
101 | _format = format;
|
---|
102 | _latitude = latitude;
|
---|
103 | _longitude = longitude;
|
---|
104 | _nmea = nmea;
|
---|
105 | _iMount = iMount; // index in mountpoints array
|
---|
106 |
|
---|
107 | initialize();
|
---|
108 | }
|
---|
109 |
|
---|
110 | // Initialization
|
---|
111 | ////////////////////////////////////////////////////////////////////////////
|
---|
112 | void bncGetThread::initialize() {
|
---|
113 |
|
---|
114 |
|
---|
115 | bncApp* app = (bncApp*) qApp;
|
---|
116 | app->connect(this, SIGNAL(newMessage(QByteArray,bool)),
|
---|
117 | app, SLOT(slotMessage(const QByteArray,bool)));
|
---|
118 |
|
---|
119 | _decoder = 0;
|
---|
120 | _socket = 0;
|
---|
121 | _timeOut = 20*1000; // 20 seconds
|
---|
122 | _nextSleep = 1; // 1 second
|
---|
123 | _rawInpFile = 0;
|
---|
124 | _rawOutFile = 0;
|
---|
125 | _staID_orig = _staID;
|
---|
126 |
|
---|
127 | // Check name conflict
|
---|
128 | // -------------------
|
---|
129 | QSettings settings;
|
---|
130 | QListIterator<QString> it(settings.value("mountPoints").toStringList());
|
---|
131 | int num = 0;
|
---|
132 | int ind = -1;
|
---|
133 | while (it.hasNext()) {
|
---|
134 | ++ind;
|
---|
135 | QStringList hlp = it.next().split(" ");
|
---|
136 | if (hlp.size() <= 1) continue;
|
---|
137 | QUrl url(hlp[0]);
|
---|
138 | if (_mountPoint.path() == url.path()) {
|
---|
139 | if (_iMount > ind || _iMount < 0) {
|
---|
140 | ++num;
|
---|
141 | }
|
---|
142 | }
|
---|
143 | }
|
---|
144 |
|
---|
145 | if (num > 0) {
|
---|
146 | _staID = _staID.left(_staID.length()-1) + QString("%1").arg(num).toAscii();
|
---|
147 | }
|
---|
148 |
|
---|
149 | // Notice threshold
|
---|
150 | // ----------------
|
---|
151 | _inspSegm = 50;
|
---|
152 | if ( settings.value("obsRate").toString().isEmpty() ) { _inspSegm = 0; }
|
---|
153 | if ( settings.value("obsRate").toString().indexOf("5 Hz") != -1 ) { _inspSegm = 2; }
|
---|
154 | if ( settings.value("obsRate").toString().indexOf("1 Hz") != -1 ) { _inspSegm = 10; }
|
---|
155 | if ( settings.value("obsRate").toString().indexOf("0.5 Hz") != -1 ) { _inspSegm = 20; }
|
---|
156 | if ( settings.value("obsRate").toString().indexOf("0.2 Hz") != -1 ) { _inspSegm = 40; }
|
---|
157 | if ( settings.value("obsRate").toString().indexOf("0.1 Hz") != -1 ) { _inspSegm = 50; }
|
---|
158 | _adviseFail = settings.value("adviseFail").toInt();
|
---|
159 | _adviseReco = settings.value("adviseReco").toInt();
|
---|
160 | _makePause = false;
|
---|
161 | if ( Qt::CheckState(settings.value("makePause").toInt()) == Qt::Checked) {_makePause = true; }
|
---|
162 | _adviseScript = settings.value("adviseScript").toString();
|
---|
163 | expandEnvVar(_adviseScript);
|
---|
164 |
|
---|
165 | // Latency interval/average
|
---|
166 | // ------------------------
|
---|
167 | _perfIntr = 86400;
|
---|
168 | if ( settings.value("perfIntr").toString().isEmpty() ) { _perfIntr = 0; }
|
---|
169 | if ( settings.value("perfIntr").toString().indexOf("1 min") != -1 ) { _perfIntr = 60; }
|
---|
170 | if ( settings.value("perfIntr").toString().indexOf("5 min") != -1 ) { _perfIntr = 300; }
|
---|
171 | if ( settings.value("perfIntr").toString().indexOf("15 min") != -1 ) { _perfIntr = 900; }
|
---|
172 | if ( settings.value("perfIntr").toString().indexOf("1 hour") != -1 ) { _perfIntr = 3600; }
|
---|
173 | if ( settings.value("perfIntr").toString().indexOf("6 hours") != -1 ) { _perfIntr = 21600; }
|
---|
174 | if ( settings.value("perfIntr").toString().indexOf("1 day") != -1 ) { _perfIntr = 86400; }
|
---|
175 |
|
---|
176 | // RTCM message types
|
---|
177 | // ------------------
|
---|
178 | _checkMountPoint = settings.value("miscMount").toString();
|
---|
179 |
|
---|
180 | // RINEX writer
|
---|
181 | // ------------
|
---|
182 | _samplingRate = settings.value("rnxSampl").toInt();
|
---|
183 | if ( settings.value("rnxPath").toString().isEmpty() ) {
|
---|
184 | _rnx = 0;
|
---|
185 | }
|
---|
186 | else {
|
---|
187 | _rnx = new bncRinex(_staID, _mountPoint,
|
---|
188 | _format, _latitude, _longitude, _nmea);
|
---|
189 | }
|
---|
190 | _rnx_set_position = false;
|
---|
191 |
|
---|
192 | connect(((bncApp*)qApp), SIGNAL(newEphGPS(gpsephemeris)),
|
---|
193 | this, SLOT(slotNewEphGPS(gpsephemeris)));
|
---|
194 |
|
---|
195 | if (settings.value("serialMountPoint").toString() == _staID) {
|
---|
196 | _serialPort = new QextSerialPort(
|
---|
197 | settings.value("serialPortName").toString() );
|
---|
198 | QString hlp = settings.value("serialBaudRate").toString();
|
---|
199 | if (hlp == "110") {
|
---|
200 | _serialPort->setBaudRate(BAUD110);
|
---|
201 | }
|
---|
202 | else if (hlp == "300") {
|
---|
203 | _serialPort->setBaudRate(BAUD300);
|
---|
204 | }
|
---|
205 | else if (hlp == "600") {
|
---|
206 | _serialPort->setBaudRate(BAUD600);
|
---|
207 | }
|
---|
208 | else if (hlp == "1200") {
|
---|
209 | _serialPort->setBaudRate(BAUD1200);
|
---|
210 | }
|
---|
211 | else if (hlp == "2400") {
|
---|
212 | _serialPort->setBaudRate(BAUD2400);
|
---|
213 | }
|
---|
214 | else if (hlp == "4800") {
|
---|
215 | _serialPort->setBaudRate(BAUD4800);
|
---|
216 | }
|
---|
217 | else if (hlp == "9600") {
|
---|
218 | _serialPort->setBaudRate(BAUD9600);
|
---|
219 | }
|
---|
220 | else if (hlp == "19200") {
|
---|
221 | _serialPort->setBaudRate(BAUD19200);
|
---|
222 | }
|
---|
223 | else if (hlp == "38400") {
|
---|
224 | _serialPort->setBaudRate(BAUD38400);
|
---|
225 | }
|
---|
226 | else if (hlp == "57600") {
|
---|
227 | _serialPort->setBaudRate(BAUD57600);
|
---|
228 | }
|
---|
229 | else if (hlp == "115200") {
|
---|
230 | _serialPort->setBaudRate(BAUD115200);
|
---|
231 | }
|
---|
232 | hlp = settings.value("serialParity").toString();
|
---|
233 | if (hlp == "NONE") {
|
---|
234 | _serialPort->setParity(PAR_NONE);
|
---|
235 | }
|
---|
236 | else if (hlp == "ODD") {
|
---|
237 | _serialPort->setParity(PAR_ODD);
|
---|
238 | }
|
---|
239 | else if (hlp == "EVEN") {
|
---|
240 | _serialPort->setParity(PAR_EVEN);
|
---|
241 | }
|
---|
242 | else if (hlp == "SPACE") {
|
---|
243 | _serialPort->setParity(PAR_SPACE);
|
---|
244 | }
|
---|
245 | hlp = settings.value("serialDataBits").toString();
|
---|
246 | if (hlp == "5") {
|
---|
247 | _serialPort->setDataBits(DATA_5);
|
---|
248 | }
|
---|
249 | else if (hlp == "6") {
|
---|
250 | _serialPort->setDataBits(DATA_6);
|
---|
251 | }
|
---|
252 | else if (hlp == "7") {
|
---|
253 | _serialPort->setDataBits(DATA_7);
|
---|
254 | }
|
---|
255 | else if (hlp == "8") {
|
---|
256 | _serialPort->setDataBits(DATA_8);
|
---|
257 | }
|
---|
258 | hlp = settings.value("serialStopBits").toString();
|
---|
259 | if (hlp == "1") {
|
---|
260 | _serialPort->setStopBits(STOP_1);
|
---|
261 | }
|
---|
262 | else if (hlp == "2") {
|
---|
263 | _serialPort->setStopBits(STOP_2);
|
---|
264 | }
|
---|
265 | _serialPort->open(QIODevice::ReadWrite|QIODevice::Unbuffered);
|
---|
266 | if (!_serialPort->isOpen()) {
|
---|
267 | delete _serialPort;
|
---|
268 | _serialPort = 0;
|
---|
269 | emit(newMessage((_staID + ": Cannot Open Serial Port\n"), true));
|
---|
270 | }
|
---|
271 | }
|
---|
272 | else {
|
---|
273 | _serialPort = 0;
|
---|
274 | }
|
---|
275 |
|
---|
276 | // Raw Output
|
---|
277 | // ----------
|
---|
278 | // QByteArray rawOutFileName = "./" + _staID + ".raw";
|
---|
279 | // _rawOutFile = new QFile(rawOutFileName);
|
---|
280 | // _rawOutFile->open(QIODevice::WriteOnly);
|
---|
281 |
|
---|
282 | msleep(100); //sleep 0.1 sec
|
---|
283 | }
|
---|
284 |
|
---|
285 | // Destructor
|
---|
286 | ////////////////////////////////////////////////////////////////////////////
|
---|
287 | bncGetThread::~bncGetThread() {
|
---|
288 | if (_socket) {
|
---|
289 | _socket->close();
|
---|
290 | #if QT_VERSION == 0x040203
|
---|
291 | delete _socket;
|
---|
292 | #else
|
---|
293 | _socket->deleteLater();
|
---|
294 | #endif
|
---|
295 | }
|
---|
296 | delete _decoder;
|
---|
297 | delete _rnx;
|
---|
298 | delete _rawInpFile;
|
---|
299 | delete _rawOutFile;
|
---|
300 | delete _serialPort;
|
---|
301 | }
|
---|
302 |
|
---|
303 | // Init Run
|
---|
304 | ////////////////////////////////////////////////////////////////////////////
|
---|
305 | t_irc bncGetThread::initRun() {
|
---|
306 |
|
---|
307 | if (!_rawInpFile) {
|
---|
308 |
|
---|
309 | // Initialize Socket
|
---|
310 | // -----------------
|
---|
311 | QString msg;
|
---|
312 | delete _socket;
|
---|
313 | _socket = new bncSocket;
|
---|
314 | if (_socket->request(_mountPoint, _latitude, _longitude,
|
---|
315 | _nmea, _timeOut, msg) != success) {
|
---|
316 | delete _socket;
|
---|
317 | _socket = 0;
|
---|
318 | return failure;
|
---|
319 | }
|
---|
320 |
|
---|
321 | // Read Caster Response
|
---|
322 | // --------------------
|
---|
323 | _socket->waitForReadyRead(_timeOut);
|
---|
324 | if (_socket->canReadLine()) {
|
---|
325 | QString line = _socket->readLine();
|
---|
326 |
|
---|
327 | // Skip messages from proxy server
|
---|
328 | // -------------------------------
|
---|
329 | if (line.indexOf("ICY 200 OK") == -1 &&
|
---|
330 | line.indexOf("200 OK") != -1 ) {
|
---|
331 | bool proxyRespond = true;
|
---|
332 | while (true) {
|
---|
333 | if (_socket->canReadLine()) {
|
---|
334 | line = _socket->readLine();
|
---|
335 | if (!proxyRespond) {
|
---|
336 | break;
|
---|
337 | }
|
---|
338 | if (line.trimmed().isEmpty()) {
|
---|
339 | proxyRespond = false;
|
---|
340 | }
|
---|
341 | }
|
---|
342 | else {
|
---|
343 | _socket->waitForReadyRead(_timeOut);
|
---|
344 | if (_socket->bytesAvailable() <= 0) {
|
---|
345 | break;
|
---|
346 | }
|
---|
347 | }
|
---|
348 | }
|
---|
349 | }
|
---|
350 |
|
---|
351 | if (line.indexOf("Unauthorized") != -1) {
|
---|
352 | QStringList table;
|
---|
353 | bncTableDlg::getFullTable(_mountPoint.host(), _mountPoint.port(), table);
|
---|
354 | QString net;
|
---|
355 | QStringListIterator it(table);
|
---|
356 | while (it.hasNext()) {
|
---|
357 | QString line = it.next();
|
---|
358 | if (line.indexOf("STR") == 0) {
|
---|
359 | QStringList tags = line.split(";");
|
---|
360 | if (tags.at(1) == _staID_orig) {
|
---|
361 | net = tags.at(7);
|
---|
362 | break;
|
---|
363 | }
|
---|
364 | }
|
---|
365 | }
|
---|
366 |
|
---|
367 | QString reg;
|
---|
368 | it.toFront();
|
---|
369 | while (it.hasNext()) {
|
---|
370 | QString line = it.next();
|
---|
371 | if (line.indexOf("NET") == 0) {
|
---|
372 | QStringList tags = line.split(";");
|
---|
373 | if (tags.at(1) == net) {
|
---|
374 | reg = tags.at(7);
|
---|
375 | break;
|
---|
376 | }
|
---|
377 | }
|
---|
378 | }
|
---|
379 | emit(newMessage((_staID + ": Caster Response: " + line +
|
---|
380 | " Adjust User-ID and Password Register, see"
|
---|
381 | "\n " + reg).toAscii(), true));
|
---|
382 | return fatal;
|
---|
383 | }
|
---|
384 | if (line.indexOf("ICY 200 OK") != 0) {
|
---|
385 | emit(newMessage((_staID + ": Wrong Caster Response:\n" + line).toAscii(), true));
|
---|
386 | return failure;
|
---|
387 | }
|
---|
388 | }
|
---|
389 | else {
|
---|
390 | emit(newMessage(_staID + ": Response Timeout", true));
|
---|
391 | return failure;
|
---|
392 | }
|
---|
393 | }
|
---|
394 |
|
---|
395 | // Instantiate the filter
|
---|
396 | // ----------------------
|
---|
397 | if (!_decoder) {
|
---|
398 | if (_format.indexOf("RTCM_2") != -1) {
|
---|
399 | emit(newMessage("Get Data: " + _staID + " in RTCM 2.x format", true));
|
---|
400 | _decoder = new RTCM2Decoder(_staID.data());
|
---|
401 | }
|
---|
402 | else if (_format.indexOf("RTCM_3") != -1) {
|
---|
403 | emit(newMessage("Get Data: " + _staID + " in RTCM 3.x format", true));
|
---|
404 | _decoder = new RTCM3Decoder(_staID);
|
---|
405 | connect((RTCM3Decoder*) _decoder, SIGNAL(newMessage(QByteArray,bool)),
|
---|
406 | this, SIGNAL(newMessage(QByteArray,bool)));
|
---|
407 | }
|
---|
408 | else if (_format.indexOf("RTIGS") != -1) {
|
---|
409 | emit(newMessage("Get Data: " + _staID + " in RTIGS format", true));
|
---|
410 | _decoder = new RTIGSDecoder();
|
---|
411 | }
|
---|
412 | else if (_format.indexOf("GPSS") != -1 || _format.indexOf("BNC") != -1) {
|
---|
413 | emit(newMessage("Get Data: " + _staID + " in GPSS format", true));
|
---|
414 | _decoder = new gpssDecoder();
|
---|
415 | }
|
---|
416 | else if (_format.indexOf("ZERO") != -1) {
|
---|
417 | emit(newMessage("Get Data: " + _staID + " in original format", true));
|
---|
418 | _decoder = new bncZeroDecoder(_staID);
|
---|
419 | }
|
---|
420 | else {
|
---|
421 | emit(newMessage(_staID + ": Unknown data format " + _format, true));
|
---|
422 | if (_rawInpFile) {
|
---|
423 | cerr << "Uknown data format" << endl;
|
---|
424 | ::exit(0);
|
---|
425 | }
|
---|
426 | else {
|
---|
427 | return fatal;
|
---|
428 | }
|
---|
429 | }
|
---|
430 | }
|
---|
431 | return success;
|
---|
432 | }
|
---|
433 |
|
---|
434 | // Run
|
---|
435 | ////////////////////////////////////////////////////////////////////////////
|
---|
436 | void bncGetThread::run() {
|
---|
437 |
|
---|
438 | const double maxDt = 600.0; // Check observation epoch
|
---|
439 | bool wrongEpoch = false;
|
---|
440 | bool decode = true;
|
---|
441 | int numSucc = 0;
|
---|
442 | int secSucc = 0;
|
---|
443 | int secFail = 0;
|
---|
444 | int initPause = 30; // Initial pause for corrupted streams
|
---|
445 | int currPause = 0;
|
---|
446 | bool begCorrupt = false;
|
---|
447 | bool endCorrupt = false;
|
---|
448 | bool followSec = false;
|
---|
449 | int oldSecGPS= 0;
|
---|
450 | int newSecGPS = 0;
|
---|
451 | int numGaps = 0;
|
---|
452 | int diffSecGPS = 0;
|
---|
453 | int numLat = 0;
|
---|
454 | double sumLat = 0.;
|
---|
455 | double sumLatQ = 0.;
|
---|
456 | double meanDiff = 0.;
|
---|
457 | double minLat = maxDt;
|
---|
458 | double maxLat = -maxDt;
|
---|
459 | double curLat = 0.;
|
---|
460 |
|
---|
461 | _decodeTime = QDateTime::currentDateTime();
|
---|
462 | _decodeSucc = QDateTime::currentDateTime();
|
---|
463 | t_irc irc = initRun();
|
---|
464 |
|
---|
465 | if (irc == fatal) {
|
---|
466 | QThread::exit(1);
|
---|
467 | return;
|
---|
468 | }
|
---|
469 | else if (irc != success) {
|
---|
470 | emit(newMessage(_staID + ": initRun failed, reconnecting", true));
|
---|
471 | tryReconnect();
|
---|
472 | }
|
---|
473 |
|
---|
474 | if (initPause < _inspSegm) {
|
---|
475 | initPause = _inspSegm;
|
---|
476 | }
|
---|
477 | if(!_makePause) {initPause = 0;}
|
---|
478 | currPause = initPause;
|
---|
479 |
|
---|
480 | // Read Incoming Data
|
---|
481 | // ------------------
|
---|
482 | while (true) {
|
---|
483 | try {
|
---|
484 | if (_socket && _socket->state() != QAbstractSocket::ConnectedState) {
|
---|
485 | emit(newMessage(_staID + ": Socket not connected, reconnecting", true));
|
---|
486 | tryReconnect();
|
---|
487 | }
|
---|
488 |
|
---|
489 | QListIterator<p_obs> it(_decoder->_obsList);
|
---|
490 | while (it.hasNext()) {
|
---|
491 | delete it.next();
|
---|
492 | }
|
---|
493 | _decoder->_obsList.clear();
|
---|
494 |
|
---|
495 | qint64 nBytes = 0;
|
---|
496 |
|
---|
497 | if (_socket) {
|
---|
498 | _socket->waitForReadyRead(_timeOut);
|
---|
499 | nBytes = _socket->bytesAvailable();
|
---|
500 | }
|
---|
501 | else if (_rawInpFile) {
|
---|
502 | const qint64 maxBytes = 1024;
|
---|
503 | nBytes = maxBytes;
|
---|
504 | }
|
---|
505 |
|
---|
506 | if (nBytes > 0) {
|
---|
507 | emit newBytes(_staID, nBytes);
|
---|
508 |
|
---|
509 | char* data = new char[nBytes];
|
---|
510 |
|
---|
511 | if (_socket) {
|
---|
512 | _socket->read(data, nBytes);
|
---|
513 | }
|
---|
514 | else if (_rawInpFile) {
|
---|
515 | nBytes = _rawInpFile->read(data, nBytes);
|
---|
516 | if (nBytes <= 0) {
|
---|
517 | cout << "no more data" << endl;
|
---|
518 | ::exit(0);
|
---|
519 | }
|
---|
520 | }
|
---|
521 |
|
---|
522 | if (_rawOutFile) {
|
---|
523 | _rawOutFile->write(data, nBytes);
|
---|
524 | _rawOutFile->flush();
|
---|
525 | }
|
---|
526 |
|
---|
527 | if (_serialPort) {
|
---|
528 | _serialPort->write(data, nBytes);
|
---|
529 | //// _serialPort->flush();
|
---|
530 | }
|
---|
531 |
|
---|
532 | if (_inspSegm<1) {
|
---|
533 | vector<string> errmsg;
|
---|
534 | _decoder->Decode(data, nBytes, errmsg);
|
---|
535 | #ifdef DEBUG_RTCM2_2021
|
---|
536 | for (unsigned ii = 0; ii < errmsg.size(); ii++) {
|
---|
537 | emit newMessage(_staID + ": " + errmsg[ii].c_str(), false);
|
---|
538 | }
|
---|
539 | #endif
|
---|
540 | }
|
---|
541 | else {
|
---|
542 |
|
---|
543 | // Decode data
|
---|
544 | // -----------
|
---|
545 | if (!_decodePause.isValid() ||
|
---|
546 | _decodePause.secsTo(QDateTime::currentDateTime()) >= currPause ) {
|
---|
547 |
|
---|
548 | if (decode) {
|
---|
549 | vector<string> errmsg;
|
---|
550 | if ( _decoder->Decode(data, nBytes, errmsg) == success ) {
|
---|
551 | numSucc += 1;
|
---|
552 | }
|
---|
553 | if ( _decodeTime.secsTo(QDateTime::currentDateTime()) > _inspSegm ) {
|
---|
554 | decode = false;
|
---|
555 | }
|
---|
556 | #ifdef DEBUG_RTCM2_2021
|
---|
557 | for (unsigned ii = 0; ii < errmsg.size(); ii++) {
|
---|
558 | emit newMessage(_staID + ": " + errmsg[ii].c_str(), false);
|
---|
559 | }
|
---|
560 | #endif
|
---|
561 | }
|
---|
562 |
|
---|
563 | // Check - once per inspect segment
|
---|
564 | // --------------------------------
|
---|
565 | if (!decode) {
|
---|
566 | _decodeTime = QDateTime::currentDateTime();
|
---|
567 | if (numSucc>0) {
|
---|
568 | secSucc += _inspSegm;
|
---|
569 | _decodeSucc = QDateTime::currentDateTime();
|
---|
570 | if (secSucc > _adviseReco * 60) {
|
---|
571 | secSucc = _adviseReco * 60 + 1;
|
---|
572 | }
|
---|
573 | numSucc = 0;
|
---|
574 | currPause = initPause;
|
---|
575 | _decodePause.setDate(QDate());
|
---|
576 | _decodePause.setTime(QTime());
|
---|
577 | }
|
---|
578 | else {
|
---|
579 | secFail += _inspSegm;
|
---|
580 | secSucc = 0;
|
---|
581 | if (secFail > _adviseFail * 60) {
|
---|
582 | secFail = _adviseFail * 60 + 1;
|
---|
583 | }
|
---|
584 | if (!_decodePause.isValid() || !_makePause) {
|
---|
585 | _decodePause = QDateTime::currentDateTime();
|
---|
586 | }
|
---|
587 | else {
|
---|
588 | _decodePause.setDate(QDate());
|
---|
589 | _decodePause.setTime(QTime());
|
---|
590 | secFail = secFail + currPause - _inspSegm;
|
---|
591 | currPause = currPause * 2;
|
---|
592 | if (currPause > 960) {
|
---|
593 | currPause = 960;
|
---|
594 | }
|
---|
595 | }
|
---|
596 | }
|
---|
597 |
|
---|
598 | // End corrupt threshold
|
---|
599 | // ---------------------
|
---|
600 | if ( begCorrupt && !endCorrupt && secSucc > _adviseReco * 60 ) {
|
---|
601 | _endDateCor = QDateTime::currentDateTime().addSecs(- _adviseReco * 60).toUTC().date().toString("yy-MM-dd");
|
---|
602 | _endTimeCor = QDateTime::currentDateTime().addSecs(- _adviseReco * 60).toUTC().time().toString("hh:mm:ss");
|
---|
603 | emit(newMessage((_staID + ": Recovery threshold exceeded, corruption ended "
|
---|
604 | + _endDateCor + " " + _endTimeCor).toAscii(), true));
|
---|
605 | callScript(("End_Corrupted " + _endDateCor + " " + _endTimeCor + " Begin was " + _begDateCor + " " + _begTimeCor).toAscii());
|
---|
606 | endCorrupt = true;
|
---|
607 | begCorrupt = false;
|
---|
608 | secFail = 0;
|
---|
609 | }
|
---|
610 | else {
|
---|
611 |
|
---|
612 | // Begin corrupt threshold
|
---|
613 | // -----------------------
|
---|
614 | if ( !begCorrupt && secFail > _adviseFail * 60 ) {
|
---|
615 | _begDateCor = _decodeSucc.toUTC().date().toString("yy-MM-dd");
|
---|
616 | _begTimeCor = _decodeSucc.toUTC().time().toString("hh:mm:ss");
|
---|
617 | emit(newMessage((_staID + ": Failure threshold exceeded, corrupted since "
|
---|
618 | + _begDateCor + " " + _begTimeCor).toAscii(), true));
|
---|
619 | callScript(("Begin_Corrupted " + _begDateCor + " " + _begTimeCor).toAscii());
|
---|
620 | begCorrupt = true;
|
---|
621 | endCorrupt = false;
|
---|
622 | secSucc = 0;
|
---|
623 | numSucc = 0;
|
---|
624 | }
|
---|
625 | }
|
---|
626 | decode = true;
|
---|
627 | }
|
---|
628 | }
|
---|
629 | }
|
---|
630 |
|
---|
631 | // End outage threshold
|
---|
632 | // --------------------
|
---|
633 | if ( _decodeStart.isValid() && _decodeStart.secsTo(QDateTime::currentDateTime()) > _adviseReco * 60 ) {
|
---|
634 | _decodeStart.setDate(QDate());
|
---|
635 | _decodeStart.setTime(QTime());
|
---|
636 | if (_inspSegm>0) {
|
---|
637 | _endDateOut = QDateTime::currentDateTime().addSecs(- _adviseReco * 60).toUTC().date().toString("yy-MM-dd");
|
---|
638 | _endTimeOut = QDateTime::currentDateTime().addSecs(- _adviseReco * 60).toUTC().time().toString("hh:mm:ss");
|
---|
639 | emit(newMessage((_staID + ": Recovery threshold exceeded, outage ended "
|
---|
640 | + _endDateOut + " " + _endTimeOut).toAscii(), true));
|
---|
641 | callScript(("End_Outage " + _endDateOut + " " + _endTimeOut + " Begin was " + _begDateOut + " " + _begTimeOut).toAscii());
|
---|
642 | }
|
---|
643 | }
|
---|
644 |
|
---|
645 | delete [] data;
|
---|
646 |
|
---|
647 |
|
---|
648 | // RTCM scan output
|
---|
649 | // ----------------
|
---|
650 | if ( _checkMountPoint == _staID || _checkMountPoint == "ALL" ) {
|
---|
651 | QSettings settings;
|
---|
652 | if ( Qt::CheckState(settings.value("scanRTCM").toInt()) == Qt::Checked) {
|
---|
653 |
|
---|
654 | // RTCMv3 message types
|
---|
655 | // --------------------
|
---|
656 | if (0<_decoder->_typeList.size()) {
|
---|
657 | QString type;
|
---|
658 | for (int ii=0;ii<_decoder->_typeList.size();ii++) {
|
---|
659 | type = QString("%1 ").arg(_decoder->_typeList[ii]);
|
---|
660 | emit(newMessage(_staID + ": Received message type " + type.toAscii(), true));
|
---|
661 | }
|
---|
662 | }
|
---|
663 |
|
---|
664 | // RTCMv3 antenna descriptor
|
---|
665 | // -------------------------
|
---|
666 | if (0<_decoder->_antType.size()) {
|
---|
667 | QString ant1;
|
---|
668 | for (int ii=0;ii<_decoder->_antType.size();ii++) {
|
---|
669 | ant1 = QString("%1 ").arg(_decoder->_antType[ii]);
|
---|
670 | emit(newMessage(_staID + ": Antenna descriptor " + ant1.toAscii(), true));
|
---|
671 | }
|
---|
672 | }
|
---|
673 |
|
---|
674 | // Antenna XYZ
|
---|
675 | // ------------------
|
---|
676 | if (0<_decoder->_antList.size()) {
|
---|
677 | for (int ii=0;ii<_decoder->_antList.size();++ii) {
|
---|
678 | QByteArray ant1,ant2,ant3, antT;
|
---|
679 | ant1 = QString("%1 ").arg(_decoder->_antList[ii].xx,0,'f',4).toAscii();
|
---|
680 | ant2 = QString("%1 ").arg(_decoder->_antList[ii].yy,0,'f',4).toAscii();
|
---|
681 | ant3 = QString("%1 ").arg(_decoder->_antList[ii].zz,0,'f',4).toAscii();
|
---|
682 | switch (_decoder->_antList[ii].type) {
|
---|
683 | case GPSDecoder::t_antInfo::ARP: antT = "ARP"; break;
|
---|
684 | case GPSDecoder::t_antInfo::APC: antT = "APC"; break;
|
---|
685 | }
|
---|
686 | emit(newMessage(_staID + ": " + antT + " (ITRF) X " + ant1 + "m", true));
|
---|
687 | emit(newMessage(_staID + ": " + antT + " (ITRF) Y " + ant2 + "m", true));
|
---|
688 | emit(newMessage(_staID + ": " + antT + " (ITRF) Z " + ant3 + "m", true));
|
---|
689 | if (_decoder->_antList[ii].height_f) {
|
---|
690 | QByteArray ant4 = QString("%1 ").arg(_decoder->_antList[ii].height,0,'f',4).toAscii();
|
---|
691 | emit(newMessage(_staID + ": Antenna height above marker " + ant4 + "m", true));
|
---|
692 | }
|
---|
693 | emit(newAntCrd(_staID,
|
---|
694 | _decoder->_antList[ii].xx, _decoder->_antList[ii].yy, _decoder->_antList[ii].zz,
|
---|
695 | antT));
|
---|
696 | }
|
---|
697 | }
|
---|
698 | }
|
---|
699 | if ( _checkMountPoint == "ANTCRD_ONLY" && _decoder->_antList.size() ) {
|
---|
700 | for (int ii=0;ii<_decoder->_antList.size();++ii) {
|
---|
701 | QByteArray antT;
|
---|
702 | switch (_decoder->_antList[ii].type) {
|
---|
703 | case GPSDecoder::t_antInfo::ARP: antT = "ARP"; break;
|
---|
704 | case GPSDecoder::t_antInfo::APC: antT = "APC"; break;
|
---|
705 | }
|
---|
706 | emit(newAntCrd(_staID,
|
---|
707 | _decoder->_antList[ii].xx, _decoder->_antList[ii].yy, _decoder->_antList[ii].zz,
|
---|
708 | antT));
|
---|
709 | }
|
---|
710 | }
|
---|
711 | }
|
---|
712 |
|
---|
713 | _decoder->_typeList.clear();
|
---|
714 | _decoder->_antType.clear();
|
---|
715 | _decoder->_antList.clear();
|
---|
716 |
|
---|
717 | // Loop over all observations (observations output)
|
---|
718 | // ------------------------------------------------
|
---|
719 | QListIterator<p_obs> it(_decoder->_obsList);
|
---|
720 | while (it.hasNext()) {
|
---|
721 | p_obs obs = it.next();
|
---|
722 |
|
---|
723 | // Check observation epoch
|
---|
724 | // -----------------------
|
---|
725 | if (!_rawInpFile && !dynamic_cast<gpssDecoder*>(_decoder)) {
|
---|
726 | int week;
|
---|
727 | double sec;
|
---|
728 | currentGPSWeeks(week, sec);
|
---|
729 | const double secPerWeek = 7.0 * 24.0 * 3600.0;
|
---|
730 |
|
---|
731 | if (week < obs->_o.GPSWeek) {
|
---|
732 | week += 1;
|
---|
733 | sec -= secPerWeek;
|
---|
734 | }
|
---|
735 | if (week > obs->_o.GPSWeek) {
|
---|
736 | week -= 1;
|
---|
737 | sec += secPerWeek;
|
---|
738 | }
|
---|
739 | double dt = fabs(sec - obs->_o.GPSWeeks);
|
---|
740 | if (week != obs->_o.GPSWeek || dt > maxDt) {
|
---|
741 | if (!wrongEpoch) {
|
---|
742 | emit( newMessage(_staID + ": Wrong observation epoch(s)", true) );
|
---|
743 | wrongEpoch = true;
|
---|
744 | }
|
---|
745 | delete obs;
|
---|
746 | continue;
|
---|
747 | }
|
---|
748 | else {
|
---|
749 | wrongEpoch = false;
|
---|
750 |
|
---|
751 | // Latency and completeness
|
---|
752 | // ------------------------
|
---|
753 | if (_perfIntr>0) {
|
---|
754 | if ( _checkMountPoint == _staID || _checkMountPoint == "ALL" ) {
|
---|
755 | newSecGPS = static_cast<int>(obs->_o.GPSWeeks);
|
---|
756 | if (newSecGPS != oldSecGPS) {
|
---|
757 | if (newSecGPS % _perfIntr < oldSecGPS % _perfIntr) {
|
---|
758 | if (numLat>0) {
|
---|
759 | if (meanDiff>0.) {
|
---|
760 | emit( newMessage(QString("%1: Mean latency %2 sec, min %3, max %4, rms %5, %6 epochs, %7 gaps")
|
---|
761 | .arg(_staID.data())
|
---|
762 | .arg(int(sumLat/numLat*100)/100.)
|
---|
763 | .arg(int(minLat*100)/100.)
|
---|
764 | .arg(int(maxLat*100)/100.)
|
---|
765 | .arg(int((sqrt((sumLatQ - sumLat * sumLat / numLat)/numLat))*100)/100.)
|
---|
766 | .arg(numLat)
|
---|
767 | .arg(numGaps)
|
---|
768 | .toAscii(), true) );
|
---|
769 | } else {
|
---|
770 | emit( newMessage(QString("%1: Mean latency %2 sec, min %3, max %4, rms %5, %6 epochs")
|
---|
771 | .arg(_staID.data())
|
---|
772 | .arg(int(sumLat/numLat*100)/100.)
|
---|
773 | .arg(int(minLat*100)/100.)
|
---|
774 | .arg(int(maxLat*100)/100.)
|
---|
775 | .arg(int((sqrt((sumLatQ - sumLat * sumLat / numLat)/numLat))*100)/100.)
|
---|
776 | .arg(numLat)
|
---|
777 | .toAscii(), true) );
|
---|
778 | }
|
---|
779 | }
|
---|
780 | meanDiff = diffSecGPS/numLat;
|
---|
781 | diffSecGPS = 0;
|
---|
782 | numGaps = 0;
|
---|
783 | sumLat = 0.;
|
---|
784 | sumLatQ = 0.;
|
---|
785 | numLat = 0;
|
---|
786 | minLat = maxDt;
|
---|
787 | maxLat = -maxDt;
|
---|
788 | }
|
---|
789 | if (followSec) {
|
---|
790 | diffSecGPS += newSecGPS - oldSecGPS;
|
---|
791 | if (meanDiff>0.) {
|
---|
792 | if (newSecGPS - oldSecGPS > 1.5 * meanDiff) {
|
---|
793 | numGaps += 1;
|
---|
794 | }
|
---|
795 | }
|
---|
796 | }
|
---|
797 | curLat = sec - obs->_o.GPSWeeks;
|
---|
798 | sumLat += curLat;
|
---|
799 | sumLatQ += curLat * curLat;
|
---|
800 | if (curLat < minLat) minLat = curLat;
|
---|
801 | if (curLat >= maxLat) maxLat = curLat;
|
---|
802 | numLat += 1;
|
---|
803 | oldSecGPS = newSecGPS;
|
---|
804 | followSec = true;
|
---|
805 | }
|
---|
806 | }
|
---|
807 | }
|
---|
808 | }
|
---|
809 | }
|
---|
810 |
|
---|
811 | // RINEX Output
|
---|
812 | // ------------
|
---|
813 | if (_rnx) {
|
---|
814 | bool dump = true;
|
---|
815 |
|
---|
816 | //// // RTCMv2 XYZ
|
---|
817 | //// // ----------
|
---|
818 | //// RTCM2Decoder* decoder2 = dynamic_cast<RTCM2Decoder*>(_decoder);
|
---|
819 | //// if ( decoder2 && !_rnx_set_position ) {
|
---|
820 | //// double stax, stay, staz;
|
---|
821 | //// double dL1[3], dL2[3];
|
---|
822 | //// if ( decoder2->getStaCrd(stax, stay, staz,
|
---|
823 | //// dL1[0], dL1[1], dL1[2],
|
---|
824 | //// dL2[0], dL2[1], dL2[2]) == success ) {
|
---|
825 | ////
|
---|
826 | //// if ( _checkMountPoint == _staID || _checkMountPoint == "ALL" ) {
|
---|
827 | //// QString ant1;
|
---|
828 | //// ant1 = QString("%1 ").arg(stax,0,'f',4);
|
---|
829 | //// emit(newMessage(_staID + ": ARP X " + ant1.toAscii() + "m" ));
|
---|
830 | //// ant1 = QString("%1 ").arg(stay,0,'f',4);
|
---|
831 | //// emit(newMessage(_staID + ": ARP Y " + ant1.toAscii() + "m" ));
|
---|
832 | //// ant1 = QString("%1 ").arg(staz,0,'f',4);
|
---|
833 | //// emit(newMessage(_staID + ": ARP Z " + ant1.toAscii() + "m" ));
|
---|
834 | //// ant1 = QString("%1 ").arg(dL1[0],0,'f',4);
|
---|
835 | //// emit(newMessage(_staID + ": L1 APC DX " + ant1.toAscii() + "m" ));
|
---|
836 | //// ant1 = QString("%1 ").arg(dL1[1],0,'f',4);
|
---|
837 | //// emit(newMessage(_staID + ": L1 APC DY " + ant1.toAscii() + "m" ));
|
---|
838 | //// ant1 = QString("%1 ").arg(dL1[2],0,'f',4);
|
---|
839 | //// emit(newMessage(_staID + ": L1 APC DZ " + ant1.toAscii() + "m" ));
|
---|
840 | //// ant1 = QString("%1 ").arg(dL2[0],0,'f',4);
|
---|
841 | //// emit(newMessage(_staID + ": L2 APC DX " + ant1.toAscii() + "m" ));
|
---|
842 | //// ant1 = QString("%1 ").arg(dL2[1],0,'f',4);
|
---|
843 | //// emit(newMessage(_staID + ": L2 APC DY " + ant1.toAscii() + "m" ));
|
---|
844 | //// ant1 = QString("%1 ").arg(dL2[2],0,'f',4);
|
---|
845 | //// emit(newMessage(_staID + ": L2 APC DZ " + ant1.toAscii() + "m" ));
|
---|
846 | //// }
|
---|
847 | //// _rnx_set_position = true;
|
---|
848 | //// }
|
---|
849 | //// }
|
---|
850 |
|
---|
851 | if ( dump ) {
|
---|
852 | long iSec = long(floor(obs->_o.GPSWeeks+0.5));
|
---|
853 | long newTime = obs->_o.GPSWeek * 7*24*3600 + iSec;
|
---|
854 | if (_samplingRate == 0 || iSec % _samplingRate == 0) {
|
---|
855 | _rnx->deepCopy(obs);
|
---|
856 | }
|
---|
857 | _rnx->dumpEpoch(newTime);
|
---|
858 | }
|
---|
859 | }
|
---|
860 |
|
---|
861 | // Emit new observation signal
|
---|
862 | // ---------------------------
|
---|
863 | bool firstObs = (obs == _decoder->_obsList.first());
|
---|
864 | obs->_status = t_obs::posted;
|
---|
865 | emit newObs(_staID, firstObs, obs);
|
---|
866 | }
|
---|
867 | _decoder->_obsList.clear();
|
---|
868 |
|
---|
869 | }
|
---|
870 |
|
---|
871 | // Timeout, reconnect
|
---|
872 | // ------------------
|
---|
873 | else {
|
---|
874 | emit(newMessage(_staID + ": Data Timeout, reconnecting", true));
|
---|
875 | tryReconnect();
|
---|
876 | }
|
---|
877 | }
|
---|
878 | catch (const char* msg) {
|
---|
879 | emit(newMessage(_staID + msg, true));
|
---|
880 | tryReconnect();
|
---|
881 | }
|
---|
882 | }
|
---|
883 | }
|
---|
884 |
|
---|
885 | // Exit
|
---|
886 | ////////////////////////////////////////////////////////////////////////////
|
---|
887 | void bncGetThread::exit(int exitCode) {
|
---|
888 | if (exitCode!= 0) {
|
---|
889 | emit error(_staID);
|
---|
890 | }
|
---|
891 | QThread::exit(exitCode);
|
---|
892 | terminate();
|
---|
893 | }
|
---|
894 |
|
---|
895 | // Try Re-Connect
|
---|
896 | ////////////////////////////////////////////////////////////////////////////
|
---|
897 | void bncGetThread::tryReconnect() {
|
---|
898 | if (_rnx) {
|
---|
899 | _rnx->setReconnectFlag(true);
|
---|
900 | }
|
---|
901 | if ( !_decodeStart.isValid()) {
|
---|
902 | _decodeStop = QDateTime::currentDateTime();
|
---|
903 | }
|
---|
904 | while (1) {
|
---|
905 | sleep(_nextSleep);
|
---|
906 | if ( initRun() == success ) {
|
---|
907 | if ( !_decodeStop.isValid()) {
|
---|
908 | _decodeStart = QDateTime::currentDateTime();
|
---|
909 | }
|
---|
910 | break;
|
---|
911 | }
|
---|
912 | else {
|
---|
913 |
|
---|
914 | // Begin outage threshold
|
---|
915 | // ----------------------
|
---|
916 | if ( _decodeStop.isValid() && _decodeStop.secsTo(QDateTime::currentDateTime()) > _adviseFail * 60 ) {
|
---|
917 | _decodeStop.setDate(QDate());
|
---|
918 | _decodeStop.setTime(QTime());
|
---|
919 | if (_inspSegm>0) {
|
---|
920 | _begDateOut = _decodeTime.toUTC().date().toString("yy-MM-dd");
|
---|
921 | _begTimeOut = _decodeTime.toUTC().time().toString("hh:mm:ss");
|
---|
922 | emit(newMessage((_staID + ": Failure threshold exceeded, outage since "
|
---|
923 | + _begDateOut + " " + _begTimeOut).toAscii(), true));
|
---|
924 | callScript(("Begin_Outage " + _begDateOut + " " + _begTimeOut).toAscii());
|
---|
925 | }
|
---|
926 | }
|
---|
927 | _nextSleep *= 2;
|
---|
928 | if (_nextSleep > 256) {
|
---|
929 | _nextSleep = 256;
|
---|
930 | }
|
---|
931 | _nextSleep += rand() % 6;
|
---|
932 | }
|
---|
933 | }
|
---|
934 | _nextSleep = 1;
|
---|
935 | }
|
---|
936 |
|
---|
937 | // Call advisory notice script
|
---|
938 | ////////////////////////////////////////////////////////////////////////////
|
---|
939 | void bncGetThread::callScript(const char* _comment) {
|
---|
940 | QMutexLocker locker(&_mutex);
|
---|
941 | if (!_adviseScript.isEmpty()) {
|
---|
942 | msleep(1);
|
---|
943 | #ifdef WIN32
|
---|
944 | QProcess::startDetached(_adviseScript, QStringList() << _staID << _comment) ;
|
---|
945 | #else
|
---|
946 | QProcess::startDetached("nohup", QStringList() << _adviseScript << _staID << _comment) ;
|
---|
947 | #endif
|
---|
948 | }
|
---|
949 | }
|
---|
950 |
|
---|
951 | //
|
---|
952 | //////////////////////////////////////////////////////////////////////////////
|
---|
953 | void bncGetThread::slotNewEphGPS(gpsephemeris gpseph) {
|
---|
954 | RTCM2Decoder* decoder = dynamic_cast<RTCM2Decoder*>(_decoder);
|
---|
955 |
|
---|
956 | if ( decoder ) {
|
---|
957 | QMutexLocker locker(&_mutex);
|
---|
958 |
|
---|
959 | string storedPRN;
|
---|
960 | vector<int> IODs;
|
---|
961 |
|
---|
962 | if ( decoder->storeEph(gpseph, storedPRN, IODs) ) {
|
---|
963 | #ifdef DEBUG_RTCM2_2021
|
---|
964 | QString msg = _staID + QString(": stored eph %1 IODs").arg(storedPRN.c_str());
|
---|
965 |
|
---|
966 | for (unsigned ii = 0; ii < IODs.size(); ii++) {
|
---|
967 | msg += QString(" %1").arg(IODs[ii],4);
|
---|
968 | }
|
---|
969 |
|
---|
970 | emit(newMessage(msg.toAscii(), false));
|
---|
971 | #endif
|
---|
972 | }
|
---|
973 | }
|
---|
974 | }
|
---|
975 |
|
---|