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