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