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