[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.
|
---|
[82] | 24 |
|
---|
| 25 | /* -------------------------------------------------------------------------
|
---|
[93] | 26 | * BKG NTRIP Client
|
---|
[82] | 27 | * -------------------------------------------------------------------------
|
---|
| 28 | *
|
---|
[5072] | 29 | * Class: t_bncCore
|
---|
[82] | 30 | *
|
---|
| 31 | * Purpose: This class implements the main application
|
---|
| 32 | *
|
---|
| 33 | * Author: L. Mervart
|
---|
| 34 | *
|
---|
| 35 | * Created: 29-Aug-2006
|
---|
| 36 | *
|
---|
| 37 | * Changes:
|
---|
| 38 | *
|
---|
| 39 | * -----------------------------------------------------------------------*/
|
---|
| 40 |
|
---|
[1029] | 41 | #include <iostream>
|
---|
[150] | 42 | #include <QMessageBox>
|
---|
[519] | 43 | #include <cmath>
|
---|
[82] | 44 |
|
---|
[5070] | 45 | #include "bnccore.h"
|
---|
[151] | 46 | #include "bncutils.h"
|
---|
[647] | 47 | #include "bncrinex.h"
|
---|
[1535] | 48 | #include "bncsettings.h"
|
---|
[2011] | 49 | #include "bncversion.h"
|
---|
[5738] | 50 | #include "ephemeris.h"
|
---|
[5375] | 51 | #include "rinex/rnxobsfile.h"
|
---|
| 52 | #include "rinex/rnxnavfile.h"
|
---|
[5899] | 53 | #include "PPP/pppMain.h"
|
---|
[82] | 54 |
|
---|
[2899] | 55 | #ifdef USE_COMBINATION
|
---|
| 56 | #include "combination/bnccomb.h"
|
---|
| 57 | #endif
|
---|
| 58 |
|
---|
[82] | 59 | using namespace std;
|
---|
| 60 |
|
---|
[5084] | 61 | // Singleton
|
---|
| 62 | ////////////////////////////////////////////////////////////////////////////
|
---|
[5861] | 63 | t_bncCore* t_bncCore::instance() {
|
---|
[5084] | 64 | static t_bncCore _bncCore;
|
---|
[5861] | 65 | return &_bncCore;
|
---|
[5084] | 66 | }
|
---|
| 67 |
|
---|
[82] | 68 | // Constructor
|
---|
| 69 | ////////////////////////////////////////////////////////////////////////////
|
---|
[5084] | 70 | t_bncCore::t_bncCore() {
|
---|
| 71 | _GUIenabled = true;
|
---|
[150] | 72 | _logFileFlag = 0;
|
---|
| 73 | _logFile = 0;
|
---|
| 74 | _logStream = 0;
|
---|
[2519] | 75 | _rawFile = 0;
|
---|
[5729] | 76 | _caster = 0;
|
---|
[2922] | 77 | #ifdef USE_COMBINATION
|
---|
| 78 | _bncComb = 0;
|
---|
| 79 | #endif
|
---|
[152] | 80 |
|
---|
[516] | 81 | // Lists of Ephemeris
|
---|
| 82 | // ------------------
|
---|
| 83 | for (int ii = PRN_GPS_START; ii <= PRN_GPS_END; ii++) {
|
---|
| 84 | _gpsEph[ii-PRN_GPS_START] = 0;
|
---|
| 85 | }
|
---|
| 86 | for (int ii = PRN_GLONASS_START; ii <= PRN_GLONASS_END; ii++) {
|
---|
| 87 | _glonassEph[ii-PRN_GLONASS_START] = 0;
|
---|
| 88 | }
|
---|
[2770] | 89 | for (int ii = PRN_GALILEO_START; ii <= PRN_GALILEO_END; ii++) {
|
---|
| 90 | _galileoEph[ii-PRN_GALILEO_START] = 0;
|
---|
| 91 | }
|
---|
[516] | 92 |
|
---|
[533] | 93 | // Eph file(s)
|
---|
| 94 | // -----------
|
---|
[534] | 95 | _rinexVers = 0;
|
---|
[533] | 96 | _ephFileGPS = 0;
|
---|
| 97 | _ephStreamGPS = 0;
|
---|
| 98 | _ephFileGlonass = 0;
|
---|
| 99 | _ephStreamGlonass = 0;
|
---|
[2770] | 100 | _ephFileGalileo = 0;
|
---|
| 101 | _ephStreamGalileo = 0;
|
---|
[559] | 102 |
|
---|
[591] | 103 | _port = 0;
|
---|
[589] | 104 | _server = 0;
|
---|
| 105 | _sockets = 0;
|
---|
| 106 |
|
---|
[937] | 107 | _portCorr = 0;
|
---|
| 108 | _serverCorr = 0;
|
---|
| 109 | _socketsCorr = 0;
|
---|
| 110 |
|
---|
[2011] | 111 | _pgmName = QString(BNCPGMNAME).leftJustified(20, ' ', true);
|
---|
[559] | 112 | #ifdef WIN32
|
---|
| 113 | _userName = QString("${USERNAME}");
|
---|
| 114 | #else
|
---|
| 115 | _userName = QString("${USER}");
|
---|
| 116 | #endif
|
---|
| 117 | expandEnvVar(_userName);
|
---|
| 118 | _userName = _userName.leftJustified(20, ' ', true);
|
---|
[973] | 119 |
|
---|
[5120] | 120 | _corrs = new QMultiMap<bncTime, QString>;
|
---|
[975] | 121 |
|
---|
[5846] | 122 | _dateAndTimeGPS = 0;
|
---|
[2673] | 123 |
|
---|
| 124 | for (int ii = 0; ii < PRN_GLONASS_NUM; ++ii) {
|
---|
| 125 | _GLOFreq[ii] = 0;
|
---|
| 126 | }
|
---|
[3027] | 127 |
|
---|
[4346] | 128 | _mainWindow = 0;
|
---|
[5899] | 129 |
|
---|
| 130 | _pppMain = new BNC_PPP::t_pppMain();
|
---|
[5902] | 131 | qRegisterMetaType< QVector<double> >("QVector<double>");
|
---|
[82] | 132 | }
|
---|
| 133 |
|
---|
| 134 | // Destructor
|
---|
| 135 | ////////////////////////////////////////////////////////////////////////////
|
---|
[5072] | 136 | t_bncCore::~t_bncCore() {
|
---|
[109] | 137 | delete _logStream;
|
---|
| 138 | delete _logFile;
|
---|
[533] | 139 | delete _ephStreamGPS;
|
---|
| 140 | delete _ephFileGPS;
|
---|
[589] | 141 | delete _server;
|
---|
| 142 | delete _sockets;
|
---|
[937] | 143 | delete _serverCorr;
|
---|
| 144 | delete _socketsCorr;
|
---|
[534] | 145 | if (_rinexVers == 2) {
|
---|
[533] | 146 | delete _ephStreamGlonass;
|
---|
| 147 | delete _ephFileGlonass;
|
---|
| 148 | }
|
---|
[516] | 149 | for (int ii = PRN_GPS_START; ii <= PRN_GPS_END; ii++) {
|
---|
| 150 | delete _gpsEph[ii-PRN_GPS_START];
|
---|
| 151 | }
|
---|
| 152 | for (int ii = PRN_GLONASS_START; ii <= PRN_GLONASS_END; ii++) {
|
---|
| 153 | delete _glonassEph[ii-PRN_GLONASS_START];
|
---|
| 154 | }
|
---|
[2770] | 155 | for (int ii = PRN_GALILEO_START; ii <= PRN_GALILEO_END; ii++) {
|
---|
| 156 | delete _galileoEph[ii-PRN_GALILEO_START];
|
---|
| 157 | }
|
---|
[975] | 158 |
|
---|
| 159 | delete _corrs;
|
---|
[1156] | 160 |
|
---|
[5846] | 161 | delete _dateAndTimeGPS;
|
---|
[2385] | 162 |
|
---|
[2519] | 163 | delete _rawFile;
|
---|
[2865] | 164 |
|
---|
[2899] | 165 | #ifdef USE_COMBINATION
|
---|
[2865] | 166 | delete _bncComb;
|
---|
[2899] | 167 | #endif
|
---|
[82] | 168 | }
|
---|
| 169 |
|
---|
| 170 | // Write a Program Message
|
---|
| 171 | ////////////////////////////////////////////////////////////////////////////
|
---|
[5072] | 172 | void t_bncCore::slotMessage(QByteArray msg, bool showOnScreen) {
|
---|
[150] | 173 |
|
---|
[1218] | 174 | QMutexLocker locker(&_mutexMessage);
|
---|
[243] | 175 |
|
---|
[990] | 176 | messagePrivate(msg);
|
---|
[1299] | 177 | emit newMessage(msg, showOnScreen);
|
---|
[990] | 178 | }
|
---|
| 179 |
|
---|
| 180 | // Write a Program Message (private, no lock)
|
---|
| 181 | ////////////////////////////////////////////////////////////////////////////
|
---|
[5072] | 182 | void t_bncCore::messagePrivate(const QByteArray& msg) {
|
---|
[990] | 183 |
|
---|
[150] | 184 | // First time resolve the log file name
|
---|
| 185 | // ------------------------------------
|
---|
[1549] | 186 | QDate currDate = currentDateAndTimeGPS().date();
|
---|
| 187 | if (_logFileFlag == 0 || _fileDate != currDate) {
|
---|
[3034] | 188 | delete _logStream; _logStream = 0;
|
---|
| 189 | delete _logFile; _logFile = 0;
|
---|
[150] | 190 | _logFileFlag = 1;
|
---|
[1535] | 191 | bncSettings settings;
|
---|
[150] | 192 | QString logFileName = settings.value("logFile").toString();
|
---|
| 193 | if ( !logFileName.isEmpty() ) {
|
---|
[151] | 194 | expandEnvVar(logFileName);
|
---|
[1549] | 195 | _logFile = new QFile(logFileName + "_" +
|
---|
| 196 | currDate.toString("yyMMdd").toAscii().data());
|
---|
| 197 | _fileDate = currDate;
|
---|
[275] | 198 | if ( Qt::CheckState(settings.value("rnxAppend").toInt()) == Qt::Checked) {
|
---|
| 199 | _logFile->open(QIODevice::WriteOnly | QIODevice::Append);
|
---|
| 200 | }
|
---|
| 201 | else {
|
---|
| 202 | _logFile->open(QIODevice::WriteOnly);
|
---|
| 203 | }
|
---|
[150] | 204 | _logStream = new QTextStream();
|
---|
| 205 | _logStream->setDevice(_logFile);
|
---|
| 206 | }
|
---|
| 207 | }
|
---|
| 208 |
|
---|
[109] | 209 | if (_logStream) {
|
---|
[3371] | 210 | QByteArray msgLocal = msg;
|
---|
| 211 | if (msg.indexOf('\n') == 0) {
|
---|
| 212 | *_logStream << endl;
|
---|
| 213 | msgLocal = msg.mid(1);
|
---|
| 214 | }
|
---|
[1154] | 215 | *_logStream << currentDateAndTimeGPS().toString("yy-MM-dd hh:mm:ss ").toAscii().data();
|
---|
[3371] | 216 | *_logStream << msgLocal.data() << endl;
|
---|
[109] | 217 | _logStream->flush();
|
---|
[3637] | 218 | _logFile->flush();
|
---|
[82] | 219 | }
|
---|
| 220 | }
|
---|
[511] | 221 |
|
---|
[535] | 222 | // New GPS Ephemeris
|
---|
[511] | 223 | ////////////////////////////////////////////////////////////////////////////
|
---|
[5072] | 224 | void t_bncCore::slotNewGPSEph(gpsephemeris* gpseph) {
|
---|
[516] | 225 |
|
---|
| 226 | QMutexLocker locker(&_mutex);
|
---|
| 227 |
|
---|
[1044] | 228 | gpsephemeris copy_gpseph = *gpseph;
|
---|
| 229 | emit newEphGPS(copy_gpseph);
|
---|
| 230 |
|
---|
[534] | 231 | printEphHeader();
|
---|
| 232 |
|
---|
[532] | 233 | gpsephemeris** ee = &_gpsEph[gpseph->satellite-1];
|
---|
[1218] | 234 |
|
---|
[4245] | 235 | if ( *ee != 0 &&
|
---|
| 236 | gpseph->GPSweek == (*ee)->GPSweek && gpseph->TOC == (*ee)->TOC ) {
|
---|
| 237 | checkEphemeris(*ee, gpseph);
|
---|
| 238 | }
|
---|
| 239 |
|
---|
[538] | 240 | if ( *ee == 0 ||
|
---|
| 241 | gpseph->GPSweek > (*ee)->GPSweek ||
|
---|
[594] | 242 | (gpseph->GPSweek == (*ee)->GPSweek && gpseph->TOC > (*ee)->TOC) ) {
|
---|
[516] | 243 | delete *ee;
|
---|
| 244 | *ee = gpseph;
|
---|
[600] | 245 | printGPSEph(gpseph, true);
|
---|
[516] | 246 | }
|
---|
| 247 | else {
|
---|
[600] | 248 | printGPSEph(gpseph, false);
|
---|
[516] | 249 | delete gpseph;
|
---|
| 250 | }
|
---|
[511] | 251 | }
|
---|
| 252 |
|
---|
[535] | 253 | // New Glonass Ephemeris
|
---|
[511] | 254 | ////////////////////////////////////////////////////////////////////////////
|
---|
[5206] | 255 | void t_bncCore::slotNewGlonassEph(glonassephemeris* glonasseph, const QString& staID) {
|
---|
[516] | 256 |
|
---|
| 257 | QMutexLocker locker(&_mutex);
|
---|
| 258 |
|
---|
[4747] | 259 | // Check wrong Ephemerides
|
---|
| 260 | // -----------------------
|
---|
| 261 | if (glonasseph->x_pos == 0.0 &&
|
---|
| 262 | glonasseph->y_pos == 0.0 &&
|
---|
| 263 | glonasseph->z_pos == 0.0) {
|
---|
| 264 | delete glonasseph;
|
---|
| 265 | return;
|
---|
| 266 | }
|
---|
| 267 |
|
---|
[1164] | 268 | glonassephemeris copy_glonasseph = *glonasseph;
|
---|
| 269 | emit newEphGlonass(copy_glonasseph);
|
---|
| 270 |
|
---|
[534] | 271 | printEphHeader();
|
---|
| 272 |
|
---|
[532] | 273 | glonassephemeris** ee = &_glonassEph[glonasseph->almanac_number-1];
|
---|
[531] | 274 |
|
---|
[3539] | 275 | int wwOld, towOld, wwNew, towNew;
|
---|
| 276 | if (*ee != 0) {
|
---|
| 277 | wwOld = (*ee)->GPSWeek;
|
---|
| 278 | towOld = (*ee)->GPSTOW;
|
---|
| 279 | updatetime(&wwOld, &towOld, (*ee)->tb*1000, 0); // Moscow -> GPS
|
---|
| 280 |
|
---|
| 281 | wwNew = glonasseph->GPSWeek;
|
---|
| 282 | towNew = glonasseph->GPSTOW;
|
---|
| 283 | updatetime(&wwNew, &towNew, glonasseph->tb*1000, 0); // Moscow -> GPS
|
---|
| 284 | }
|
---|
| 285 |
|
---|
[578] | 286 | if ( *ee == 0 ||
|
---|
[3539] | 287 | wwNew > wwOld ||
|
---|
| 288 | (wwNew == wwOld && towNew > towOld) ) {
|
---|
[531] | 289 | delete *ee;
|
---|
| 290 | *ee = glonasseph;
|
---|
[5206] | 291 | printGlonassEph(glonasseph, true, staID);
|
---|
[531] | 292 | }
|
---|
| 293 | else {
|
---|
[5206] | 294 | printGlonassEph(glonasseph, false, staID);
|
---|
[531] | 295 | delete glonasseph;
|
---|
| 296 | }
|
---|
[511] | 297 | }
|
---|
| 298 |
|
---|
[2770] | 299 | // New Galileo Ephemeris
|
---|
| 300 | ////////////////////////////////////////////////////////////////////////////
|
---|
[5072] | 301 | void t_bncCore::slotNewGalileoEph(galileoephemeris* galileoeph) {
|
---|
[2770] | 302 |
|
---|
| 303 | QMutexLocker locker(&_mutex);
|
---|
| 304 |
|
---|
[2772] | 305 | galileoephemeris copy_galileoeph = *galileoeph;
|
---|
| 306 | emit newEphGalileo(copy_galileoeph);
|
---|
| 307 |
|
---|
| 308 | printEphHeader();
|
---|
| 309 |
|
---|
[3734] | 310 | int galIndex = galileoeph->satellite;
|
---|
| 311 | /* GIOVE */
|
---|
| 312 | if(galIndex == 51) galIndex = 1;
|
---|
| 313 | else if(galIndex == 52) galIndex = 16;
|
---|
[2785] | 314 | if (galIndex < 0 || galIndex > PRN_GALILEO_END - PRN_GALILEO_START) {
|
---|
[2773] | 315 | emit( newMessage("Wrong Galileo Satellite Number", true) );
|
---|
| 316 | exit(1);
|
---|
| 317 | }
|
---|
[2772] | 318 |
|
---|
[2773] | 319 | galileoephemeris** ee = &_galileoEph[galIndex];
|
---|
| 320 |
|
---|
| 321 | if ( *ee == 0 ||
|
---|
[2772] | 322 | galileoeph->Week > (*ee)->Week ||
|
---|
| 323 | (galileoeph->Week == (*ee)->Week && galileoeph->TOC > (*ee)->TOC) ) {
|
---|
| 324 | delete *ee;
|
---|
| 325 | *ee = galileoeph;
|
---|
| 326 | printGalileoEph(galileoeph, true);
|
---|
| 327 | }
|
---|
| 328 | else {
|
---|
| 329 | printGalileoEph(galileoeph, false);
|
---|
| 330 | delete galileoeph;
|
---|
| 331 | }
|
---|
[2770] | 332 | }
|
---|
| 333 |
|
---|
[535] | 334 | // Print Header of the output File(s)
|
---|
[516] | 335 | ////////////////////////////////////////////////////////////////////////////
|
---|
[5072] | 336 | void t_bncCore::printEphHeader() {
|
---|
[528] | 337 |
|
---|
[1535] | 338 | bncSettings settings;
|
---|
[535] | 339 |
|
---|
[534] | 340 | // Initialization
|
---|
| 341 | // --------------
|
---|
| 342 | if (_rinexVers == 0) {
|
---|
[528] | 343 |
|
---|
[533] | 344 | if ( Qt::CheckState(settings.value("ephV3").toInt()) == Qt::Checked) {
|
---|
[534] | 345 | _rinexVers = 3;
|
---|
[533] | 346 | }
|
---|
| 347 | else {
|
---|
[534] | 348 | _rinexVers = 2;
|
---|
[533] | 349 | }
|
---|
[529] | 350 |
|
---|
[533] | 351 | _ephPath = settings.value("ephPath").toString();
|
---|
| 352 |
|
---|
| 353 | if ( !_ephPath.isEmpty() ) {
|
---|
| 354 | if ( _ephPath[_ephPath.length()-1] != QDir::separator() ) {
|
---|
| 355 | _ephPath += QDir::separator();
|
---|
| 356 | }
|
---|
| 357 | expandEnvVar(_ephPath);
|
---|
| 358 | }
|
---|
[517] | 359 | }
|
---|
[533] | 360 |
|
---|
[534] | 361 | // (Re-)Open output File(s)
|
---|
| 362 | // ------------------------
|
---|
[533] | 363 | if (!_ephPath.isEmpty()) {
|
---|
| 364 |
|
---|
[1154] | 365 | QDateTime datTim = currentDateAndTimeGPS();
|
---|
[533] | 366 |
|
---|
[583] | 367 | QString ephFileNameGPS = _ephPath + "BRDC" +
|
---|
[563] | 368 | QString("%1").arg(datTim.date().dayOfYear(), 3, 10, QChar('0'));
|
---|
[533] | 369 |
|
---|
[647] | 370 | QString hlpStr = bncRinex::nextEpochStr(datTim,
|
---|
| 371 | settings.value("ephIntr").toString());
|
---|
[584] | 372 |
|
---|
[575] | 373 | if (_rinexVers == 3) {
|
---|
| 374 | ephFileNameGPS += hlpStr + datTim.toString(".yyP");
|
---|
| 375 | }
|
---|
| 376 | else {
|
---|
| 377 | ephFileNameGPS += hlpStr + datTim.toString(".yyN");
|
---|
| 378 | }
|
---|
[563] | 379 |
|
---|
[533] | 380 | if (_ephFileNameGPS == ephFileNameGPS) {
|
---|
| 381 | return;
|
---|
| 382 | }
|
---|
| 383 | else {
|
---|
| 384 | _ephFileNameGPS = ephFileNameGPS;
|
---|
| 385 | }
|
---|
| 386 |
|
---|
[575] | 387 | for (int ii = PRN_GPS_START; ii <= PRN_GPS_END; ii++) {
|
---|
| 388 | delete _gpsEph[ii-PRN_GPS_START];
|
---|
| 389 | _gpsEph[ii-PRN_GPS_START] = 0;
|
---|
| 390 | }
|
---|
| 391 | for (int ii = PRN_GLONASS_START; ii <= PRN_GLONASS_END; ii++) {
|
---|
| 392 | delete _glonassEph[ii-PRN_GLONASS_START];
|
---|
| 393 | _glonassEph[ii-PRN_GLONASS_START] = 0;
|
---|
| 394 | }
|
---|
[2770] | 395 | for (int ii = PRN_GALILEO_START; ii <= PRN_GALILEO_END; ii++) {
|
---|
| 396 | delete _galileoEph[ii-PRN_GALILEO_START];
|
---|
| 397 | _galileoEph[ii-PRN_GALILEO_START] = 0;
|
---|
| 398 | }
|
---|
[575] | 399 |
|
---|
[533] | 400 | delete _ephStreamGPS;
|
---|
| 401 | delete _ephFileGPS;
|
---|
| 402 |
|
---|
[535] | 403 | QFlags<QIODevice::OpenModeFlag> appendFlagGPS;
|
---|
[536] | 404 | QFlags<QIODevice::OpenModeFlag> appendFlagGlonass;
|
---|
[2770] | 405 | QFlags<QIODevice::OpenModeFlag> appendFlagGalileo;
|
---|
[536] | 406 |
|
---|
[535] | 407 | if ( Qt::CheckState(settings.value("rnxAppend").toInt()) == Qt::Checked &&
|
---|
| 408 | QFile::exists(ephFileNameGPS) ) {
|
---|
| 409 | appendFlagGPS = QIODevice::Append;
|
---|
| 410 | }
|
---|
| 411 |
|
---|
[533] | 412 | _ephFileGPS = new QFile(ephFileNameGPS);
|
---|
[535] | 413 | _ephFileGPS->open(QIODevice::WriteOnly | appendFlagGPS);
|
---|
[533] | 414 | _ephStreamGPS = new QTextStream();
|
---|
| 415 | _ephStreamGPS->setDevice(_ephFileGPS);
|
---|
| 416 |
|
---|
[534] | 417 | if (_rinexVers == 3) {
|
---|
[533] | 418 | _ephFileGlonass = _ephFileGPS;
|
---|
| 419 | _ephStreamGlonass = _ephStreamGPS;
|
---|
[2770] | 420 | _ephFileGalileo = _ephFileGPS;
|
---|
| 421 | _ephStreamGalileo = _ephStreamGPS;
|
---|
[533] | 422 | }
|
---|
[534] | 423 | else if (_rinexVers == 2) {
|
---|
[583] | 424 | QString ephFileNameGlonass = _ephPath + "BRDC" +
|
---|
[563] | 425 | QString("%1").arg(datTim.date().dayOfYear(), 3, 10, QChar('0')) +
|
---|
[575] | 426 | hlpStr + datTim.toString(".yyG");
|
---|
[533] | 427 |
|
---|
| 428 | delete _ephStreamGlonass;
|
---|
| 429 | delete _ephFileGlonass;
|
---|
| 430 |
|
---|
[535] | 431 | if ( Qt::CheckState(settings.value("rnxAppend").toInt()) == Qt::Checked &&
|
---|
| 432 | QFile::exists(ephFileNameGlonass) ) {
|
---|
| 433 | appendFlagGlonass = QIODevice::Append;
|
---|
| 434 | }
|
---|
| 435 |
|
---|
[533] | 436 | _ephFileGlonass = new QFile(ephFileNameGlonass);
|
---|
[535] | 437 | _ephFileGlonass->open(QIODevice::WriteOnly | appendFlagGlonass);
|
---|
[533] | 438 | _ephStreamGlonass = new QTextStream();
|
---|
| 439 | _ephStreamGlonass->setDevice(_ephFileGlonass);
|
---|
| 440 | }
|
---|
| 441 |
|
---|
[534] | 442 | // Header - RINEX Version 3
|
---|
| 443 | // ------------------------
|
---|
| 444 | if (_rinexVers == 3) {
|
---|
[537] | 445 | if ( ! (appendFlagGPS & QIODevice::Append)) {
|
---|
| 446 | QString line;
|
---|
| 447 | line.sprintf(
|
---|
| 448 | "%9.2f%11sN: GNSS NAV DATA M: Mixed%12sRINEX VERSION / TYPE\n",
|
---|
| 449 | 3.0, "", "");
|
---|
| 450 | *_ephStreamGPS << line;
|
---|
| 451 |
|
---|
[1154] | 452 | QString hlp = currentDateAndTimeGPS().toString("yyyyMMdd hhmmss UTC").leftJustified(20, ' ', true);
|
---|
[559] | 453 | *_ephStreamGPS << _pgmName.toAscii().data()
|
---|
| 454 | << _userName.toAscii().data()
|
---|
| 455 | << hlp.toAscii().data()
|
---|
| 456 | << "PGM / RUN BY / DATE" << endl;
|
---|
| 457 |
|
---|
| 458 | line.sprintf("%60sEND OF HEADER\n", "");
|
---|
[537] | 459 | *_ephStreamGPS << line;
|
---|
| 460 |
|
---|
| 461 | _ephStreamGPS->flush();
|
---|
[535] | 462 | }
|
---|
[533] | 463 | }
|
---|
| 464 |
|
---|
[536] | 465 | // Headers - RINEX Version 2
|
---|
| 466 | // -------------------------
|
---|
[534] | 467 | else if (_rinexVers == 2) {
|
---|
[536] | 468 | if (! (appendFlagGPS & QIODevice::Append)) {
|
---|
| 469 | QString line;
|
---|
[5375] | 470 | line.sprintf("%9.2f%11sN: GPS NAV DATA%25sRINEX VERSION / TYPE\n",
|
---|
| 471 | t_rnxNavFile::defaultRnxNavVersion2, "", "");
|
---|
[536] | 472 | *_ephStreamGPS << line;
|
---|
| 473 |
|
---|
[1154] | 474 | QString hlp = currentDateAndTimeGPS().date().toString("dd-MMM-yyyy").leftJustified(20, ' ', true);
|
---|
[559] | 475 | *_ephStreamGPS << _pgmName.toAscii().data()
|
---|
| 476 | << _userName.toAscii().data()
|
---|
| 477 | << hlp.toAscii().data()
|
---|
| 478 | << "PGM / RUN BY / DATE" << endl;
|
---|
| 479 |
|
---|
| 480 | line.sprintf("%60sEND OF HEADER\n", "");
|
---|
[536] | 481 | *_ephStreamGPS << line;
|
---|
[537] | 482 |
|
---|
| 483 | _ephStreamGPS->flush();
|
---|
[536] | 484 | }
|
---|
| 485 | if (! (appendFlagGlonass & QIODevice::Append)) {
|
---|
| 486 | QString line;
|
---|
[5375] | 487 | line.sprintf("%9.2f%11sG: GLONASS NAV DATA%21sRINEX VERSION / TYPE\n",
|
---|
| 488 | t_rnxNavFile::defaultRnxNavVersion2, "", "");
|
---|
[536] | 489 | *_ephStreamGlonass << line;
|
---|
| 490 |
|
---|
[1154] | 491 | QString hlp = currentDateAndTimeGPS().date().toString("dd-MMM-yyyy").leftJustified(20, ' ', true);
|
---|
[559] | 492 | *_ephStreamGlonass << _pgmName.toAscii().data()
|
---|
| 493 | << _userName.toAscii().data()
|
---|
| 494 | << hlp.toAscii().data()
|
---|
| 495 | << "PGM / RUN BY / DATE" << endl;
|
---|
| 496 |
|
---|
| 497 | line.sprintf("%60sEND OF HEADER\n", "");
|
---|
[536] | 498 | *_ephStreamGlonass << line;
|
---|
[537] | 499 |
|
---|
| 500 | _ephStreamGlonass->flush();
|
---|
[536] | 501 | }
|
---|
[533] | 502 | }
|
---|
| 503 | }
|
---|
[516] | 504 | }
|
---|
| 505 |
|
---|
[535] | 506 | // Print One GPS Ephemeris
|
---|
[516] | 507 | ////////////////////////////////////////////////////////////////////////////
|
---|
[5072] | 508 | void t_bncCore::printGPSEph(gpsephemeris* ep, bool printFile) {
|
---|
[519] | 509 |
|
---|
[4020] | 510 | t_ephGPS eph;
|
---|
| 511 | eph.set(ep);
|
---|
[533] | 512 |
|
---|
[5375] | 513 | QString strV2 = eph.toString(t_rnxNavFile::defaultRnxNavVersion2);
|
---|
| 514 | QString strV3 = eph.toString(t_rnxObsHeader::defaultRnxObsVersion3);
|
---|
[941] | 515 |
|
---|
[4020] | 516 | printOutput(printFile, _ephStreamGPS, strV2, strV3);
|
---|
[516] | 517 | }
|
---|
| 518 |
|
---|
[535] | 519 | // Print One Glonass Ephemeris
|
---|
[516] | 520 | ////////////////////////////////////////////////////////////////////////////
|
---|
[5375] | 521 | void t_bncCore::printGlonassEph(glonassephemeris* ep, bool printFile, const QString& /* staID */) {
|
---|
[523] | 522 |
|
---|
[4020] | 523 | t_ephGlo eph;
|
---|
[5133] | 524 | eph.set(ep);
|
---|
[523] | 525 |
|
---|
[5375] | 526 | QString strV2 = eph.toString(t_rnxNavFile::defaultRnxNavVersion2);
|
---|
| 527 | QString strV3 = eph.toString(t_rnxObsHeader::defaultRnxObsVersion3);
|
---|
[525] | 528 |
|
---|
[5206] | 529 | //// beg test Dirk
|
---|
[5312] | 530 | // QString hlp = strV2;
|
---|
| 531 | // cout << hlp.replace('\n', ' ').toAscii().data() << ' ' << staID.toAscii().data() << endl;
|
---|
[5206] | 532 | //// end test Dirk
|
---|
| 533 |
|
---|
[4225] | 534 | printOutput(printFile, _ephStreamGlonass, strV2, strV3);
|
---|
[941] | 535 | }
|
---|
| 536 |
|
---|
[2770] | 537 | // Print One Galileo Ephemeris
|
---|
| 538 | ////////////////////////////////////////////////////////////////////////////
|
---|
[5072] | 539 | void t_bncCore::printGalileoEph(galileoephemeris* ep, bool printFile) {
|
---|
[2772] | 540 |
|
---|
[4020] | 541 | t_ephGal eph;
|
---|
| 542 | eph.set(ep);
|
---|
[2772] | 543 |
|
---|
[5375] | 544 | QString strV2 = eph.toString(t_rnxNavFile::defaultRnxNavVersion2);
|
---|
| 545 | QString strV3 = eph.toString(t_rnxObsHeader::defaultRnxObsVersion3);
|
---|
[2772] | 546 |
|
---|
[4225] | 547 | printOutput(printFile, _ephStreamGalileo, strV2, strV3);
|
---|
[2770] | 548 | }
|
---|
| 549 |
|
---|
[941] | 550 | // Output
|
---|
| 551 | ////////////////////////////////////////////////////////////////////////////
|
---|
[5072] | 552 | void t_bncCore::printOutput(bool printFile, QTextStream* stream,
|
---|
[4020] | 553 | const QString& strV2, const QString& strV3) {
|
---|
| 554 |
|
---|
[590] | 555 | // Output into file
|
---|
| 556 | // ----------------
|
---|
[943] | 557 | if (printFile && stream) {
|
---|
[941] | 558 | if (_rinexVers == 2) {
|
---|
[4020] | 559 | *stream << strV2.toAscii();
|
---|
[941] | 560 | }
|
---|
| 561 | else {
|
---|
[4020] | 562 | *stream << strV3.toAscii();
|
---|
[941] | 563 | }
|
---|
[943] | 564 | stream->flush();
|
---|
[517] | 565 | }
|
---|
[590] | 566 |
|
---|
| 567 | // Output into the socket
|
---|
| 568 | // ----------------------
|
---|
| 569 | if (_sockets) {
|
---|
[642] | 570 | QMutableListIterator<QTcpSocket*> is(*_sockets);
|
---|
[590] | 571 | while (is.hasNext()) {
|
---|
| 572 | QTcpSocket* sock = is.next();
|
---|
| 573 | if (sock->state() == QAbstractSocket::ConnectedState) {
|
---|
[4020] | 574 | if (sock->write(strV3.toAscii()) == -1) {
|
---|
[642] | 575 | delete sock;
|
---|
| 576 | is.remove();
|
---|
| 577 | }
|
---|
[590] | 578 | }
|
---|
[642] | 579 | else if (sock->state() != QAbstractSocket::ConnectingState) {
|
---|
| 580 | delete sock;
|
---|
| 581 | is.remove();
|
---|
| 582 | }
|
---|
[590] | 583 | }
|
---|
| 584 | }
|
---|
[516] | 585 | }
|
---|
[589] | 586 |
|
---|
[591] | 587 | // Set Port Number
|
---|
| 588 | ////////////////////////////////////////////////////////////////////////////
|
---|
[5072] | 589 | void t_bncCore::setPort(int port) {
|
---|
[591] | 590 | _port = port;
|
---|
| 591 | if (_port != 0) {
|
---|
[942] | 592 | delete _server;
|
---|
[591] | 593 | _server = new QTcpServer;
|
---|
[1228] | 594 | if ( !_server->listen(QHostAddress::Any, _port) ) {
|
---|
[5072] | 595 | slotMessage("t_bncCore: Cannot listen on ephemeris port", true);
|
---|
[1228] | 596 | }
|
---|
[591] | 597 | connect(_server, SIGNAL(newConnection()), this, SLOT(slotNewConnection()));
|
---|
[942] | 598 | delete _sockets;
|
---|
[591] | 599 | _sockets = new QList<QTcpSocket*>;
|
---|
| 600 | }
|
---|
| 601 | }
|
---|
| 602 |
|
---|
[937] | 603 | // Set Port Number
|
---|
| 604 | ////////////////////////////////////////////////////////////////////////////
|
---|
[5072] | 605 | void t_bncCore::setPortCorr(int port) {
|
---|
[937] | 606 | _portCorr = port;
|
---|
| 607 | if (_portCorr != 0) {
|
---|
[942] | 608 | delete _serverCorr;
|
---|
[937] | 609 | _serverCorr = new QTcpServer;
|
---|
[1228] | 610 | if ( !_serverCorr->listen(QHostAddress::Any, _portCorr) ) {
|
---|
[5072] | 611 | slotMessage("t_bncCore: Cannot listen on correction port", true);
|
---|
[1228] | 612 | }
|
---|
[937] | 613 | connect(_serverCorr, SIGNAL(newConnection()), this, SLOT(slotNewConnectionCorr()));
|
---|
[942] | 614 | delete _socketsCorr;
|
---|
[937] | 615 | _socketsCorr = new QList<QTcpSocket*>;
|
---|
| 616 | }
|
---|
| 617 | }
|
---|
| 618 |
|
---|
[589] | 619 | // New Connection
|
---|
| 620 | ////////////////////////////////////////////////////////////////////////////
|
---|
[5072] | 621 | void t_bncCore::slotNewConnection() {
|
---|
[589] | 622 | _sockets->push_back( _server->nextPendingConnection() );
|
---|
| 623 | }
|
---|
| 624 |
|
---|
[937] | 625 | // New Connection
|
---|
| 626 | ////////////////////////////////////////////////////////////////////////////
|
---|
[5072] | 627 | void t_bncCore::slotNewConnectionCorr() {
|
---|
[937] | 628 | _socketsCorr->push_back( _serverCorr->nextPendingConnection() );
|
---|
| 629 | }
|
---|
| 630 |
|
---|
[621] | 631 | //
|
---|
| 632 | ////////////////////////////////////////////////////////////////////////////
|
---|
[5072] | 633 | void t_bncCore::slotQuit() {
|
---|
| 634 | cout << "t_bncCore::slotQuit" << endl;
|
---|
[5729] | 635 | delete _caster; _caster = 0;
|
---|
[5066] | 636 | qApp->quit();
|
---|
[621] | 637 | }
|
---|
| 638 |
|
---|
[936] | 639 | //
|
---|
| 640 | ////////////////////////////////////////////////////////////////////////////
|
---|
[5120] | 641 | void t_bncCore::slotNewCorrLine(QString line, QString staID, bncTime coTime) {
|
---|
[974] | 642 |
|
---|
| 643 | QMutexLocker locker(&_mutex);
|
---|
| 644 |
|
---|
[2866] | 645 | // Combination of Corrections
|
---|
| 646 | // --------------------------
|
---|
[2899] | 647 | #ifdef USE_COMBINATION
|
---|
[2866] | 648 | if (_bncComb) {
|
---|
| 649 | _bncComb->processCorrLine(staID, line);
|
---|
| 650 | }
|
---|
[2899] | 651 | #endif
|
---|
[2866] | 652 |
|
---|
[1535] | 653 | bncSettings settings;
|
---|
[5120] | 654 | _waitCoTime = settings.value("corrTime").toDouble();
|
---|
| 655 | if (_waitCoTime < 0.0) {
|
---|
| 656 | _waitCoTime = 0.0;
|
---|
[995] | 657 | }
|
---|
| 658 |
|
---|
[5123] | 659 | // First time, set the _lastCorrDumpTime
|
---|
| 660 | // -------------------------------------
|
---|
[5387] | 661 | if (!_lastCorrDumpTime[staID].valid()) {
|
---|
| 662 | _lastCorrDumpTime[staID] = coTime - 1.0;
|
---|
[974] | 663 | }
|
---|
| 664 |
|
---|
[975] | 665 | // An old correction - throw it away
|
---|
| 666 | // ---------------------------------
|
---|
[5387] | 667 | if (_waitCoTime > 0.0 && coTime <= _lastCorrDumpTime[staID]) {
|
---|
[5129] | 668 | if (!_bncComb) {
|
---|
[2916] | 669 | QString line = staID + ": Correction for one sat neglected because overaged by " +
|
---|
[5120] | 670 | QString().sprintf(" %f sec",
|
---|
[5387] | 671 | _lastCorrDumpTime[staID] - coTime + _waitCoTime);
|
---|
[2916] | 672 | messagePrivate(line.toAscii());
|
---|
| 673 | emit( newMessage(line.toAscii(), true) );
|
---|
[5129] | 674 | }
|
---|
[975] | 675 | return;
|
---|
| 676 | }
|
---|
| 677 |
|
---|
| 678 | _corrs->insert(coTime, QString(line + " " + staID));
|
---|
| 679 |
|
---|
[976] | 680 | // Dump Corrections
|
---|
| 681 | // ----------------
|
---|
[5120] | 682 | if (_waitCoTime == 0.0) {
|
---|
[3109] | 683 | dumpCorrs();
|
---|
| 684 | }
|
---|
[5387] | 685 | else if (coTime - _waitCoTime > _lastCorrDumpTime[staID]) {
|
---|
| 686 | dumpCorrs(_lastCorrDumpTime[staID] + 1, coTime - _waitCoTime);
|
---|
| 687 | _lastCorrDumpTime[staID] = coTime - _waitCoTime;
|
---|
[976] | 688 | }
|
---|
| 689 | }
|
---|
| 690 |
|
---|
| 691 | // Dump Complete Correction Epochs
|
---|
| 692 | ////////////////////////////////////////////////////////////////////////////
|
---|
[5120] | 693 | void t_bncCore::dumpCorrs(bncTime minTime, bncTime maxTime) {
|
---|
[5732] | 694 | QStringList allCorrs;
|
---|
[5121] | 695 | QMutableMapIterator<bncTime, QString> it(*_corrs);
|
---|
| 696 | while (it.hasNext()) {
|
---|
| 697 | it.next();
|
---|
| 698 | const bncTime& corrTime = it.key();
|
---|
| 699 | if (minTime <= corrTime && corrTime <= maxTime) {
|
---|
| 700 | allCorrs << it.value();
|
---|
| 701 | it.remove();
|
---|
| 702 | }
|
---|
[3109] | 703 | }
|
---|
[5122] | 704 | dumpCorrs(allCorrs);
|
---|
[3109] | 705 | }
|
---|
| 706 |
|
---|
| 707 | // Dump all corrections
|
---|
| 708 | ////////////////////////////////////////////////////////////////////////////
|
---|
[5072] | 709 | void t_bncCore::dumpCorrs() {
|
---|
[5732] | 710 | QStringList allCorrs;
|
---|
[5120] | 711 | QMutableMapIterator<bncTime, QString> it(*_corrs);
|
---|
[3110] | 712 | while (it.hasNext()) {
|
---|
| 713 | allCorrs << it.next().value();
|
---|
| 714 | it.remove();
|
---|
| 715 | }
|
---|
| 716 | dumpCorrs(allCorrs);
|
---|
[3109] | 717 | }
|
---|
| 718 |
|
---|
| 719 | // Dump List of Corrections
|
---|
| 720 | ////////////////////////////////////////////////////////////////////////////
|
---|
[5732] | 721 | void t_bncCore::dumpCorrs(const QStringList& allCorrs) {
|
---|
[3109] | 722 | emit newCorrections(allCorrs);
|
---|
| 723 | if (_socketsCorr) {
|
---|
| 724 | QListIterator<QString> it(allCorrs);
|
---|
| 725 | while (it.hasNext()) {
|
---|
| 726 | QString corrLine = it.next() + "\n";
|
---|
| 727 |
|
---|
| 728 | QMutableListIterator<QTcpSocket*> is(*_socketsCorr);
|
---|
| 729 | while (is.hasNext()) {
|
---|
| 730 | QTcpSocket* sock = is.next();
|
---|
| 731 | if (sock->state() == QAbstractSocket::ConnectedState) {
|
---|
| 732 | if (sock->write(corrLine.toAscii()) == -1) {
|
---|
[976] | 733 | delete sock;
|
---|
| 734 | is.remove();
|
---|
| 735 | }
|
---|
| 736 | }
|
---|
[3109] | 737 | else if (sock->state() != QAbstractSocket::ConnectingState) {
|
---|
| 738 | delete sock;
|
---|
| 739 | is.remove();
|
---|
| 740 | }
|
---|
[937] | 741 | }
|
---|
| 742 | }
|
---|
| 743 | }
|
---|
[936] | 744 | }
|
---|
[1538] | 745 |
|
---|
| 746 | //
|
---|
| 747 | ////////////////////////////////////////////////////////////////////////////
|
---|
[5072] | 748 | void t_bncCore::setConfFileName(const QString& confFileName) {
|
---|
[4169] | 749 | if (confFileName.isEmpty()) {
|
---|
| 750 | _confFileName = QDir::homePath() + QDir::separator()
|
---|
| 751 | + ".config" + QDir::separator()
|
---|
[5066] | 752 | + qApp->organizationName() + QDir::separator()
|
---|
| 753 | + qApp->applicationName() + ".bnc";
|
---|
[1538] | 754 | }
|
---|
[4169] | 755 | else {
|
---|
| 756 | _confFileName = confFileName;
|
---|
| 757 | }
|
---|
[1538] | 758 | }
|
---|
[2385] | 759 |
|
---|
| 760 | // Raw Output
|
---|
| 761 | ////////////////////////////////////////////////////////////////////////////
|
---|
[5072] | 762 | void t_bncCore::writeRawData(const QByteArray& data, const QByteArray& staID,
|
---|
[2518] | 763 | const QByteArray& format) {
|
---|
[2385] | 764 |
|
---|
[2386] | 765 | QMutexLocker locker(&_mutex);
|
---|
| 766 |
|
---|
[2519] | 767 | if (!_rawFile) {
|
---|
[2386] | 768 | bncSettings settings;
|
---|
[2519] | 769 | QByteArray fileName = settings.value("rawOutFile").toByteArray();
|
---|
| 770 | if (!fileName.isEmpty()) {
|
---|
[3524] | 771 | _rawFile = new bncRawFile(fileName, staID, bncRawFile::output);
|
---|
[2407] | 772 | }
|
---|
[2386] | 773 | }
|
---|
| 774 |
|
---|
[2519] | 775 | if (_rawFile) {
|
---|
| 776 | _rawFile->writeRawData(data, staID, format);
|
---|
[2386] | 777 | }
|
---|
[2385] | 778 | }
|
---|
[2672] | 779 |
|
---|
| 780 | // Get Glonass Slot Numbers from Global Array
|
---|
| 781 | ////////////////////////////////////////////////////////////////////////////
|
---|
[5072] | 782 | void t_bncCore::getGlonassSlotNums(int GLOFreq[]) {
|
---|
[2672] | 783 |
|
---|
| 784 | QMutexLocker locker(&_mutex);
|
---|
| 785 |
|
---|
[2673] | 786 | for (int ii = 0; ii < PRN_GLONASS_NUM; ++ii) {
|
---|
| 787 | if (_GLOFreq[ii] != 0) {
|
---|
| 788 | GLOFreq[ii] = _GLOFreq[ii];
|
---|
| 789 | }
|
---|
| 790 | }
|
---|
[2672] | 791 | }
|
---|
| 792 |
|
---|
| 793 | // Store Glonass Slot Numbers to Global Array
|
---|
| 794 | ////////////////////////////////////////////////////////////////////////////
|
---|
[5072] | 795 | void t_bncCore::storeGlonassSlotNums(const int GLOFreq[]) {
|
---|
[2672] | 796 |
|
---|
| 797 | QMutexLocker locker(&_mutex);
|
---|
| 798 |
|
---|
[2673] | 799 | for (int ii = 0; ii < PRN_GLONASS_NUM; ++ii) {
|
---|
| 800 | if (GLOFreq[ii] != 0) {
|
---|
| 801 | _GLOFreq[ii] = GLOFreq[ii];
|
---|
| 802 | }
|
---|
| 803 | }
|
---|
[2672] | 804 | }
|
---|
[2909] | 805 |
|
---|
| 806 | //
|
---|
| 807 | ////////////////////////////////////////////////////////////////////////////
|
---|
[5072] | 808 | void t_bncCore::initCombination() {
|
---|
[2909] | 809 | #ifdef USE_COMBINATION
|
---|
| 810 | _bncComb = new bncComb();
|
---|
[3142] | 811 | if (_bncComb->nStreams() < 1) {
|
---|
[2909] | 812 | delete _bncComb;
|
---|
| 813 | _bncComb = 0;
|
---|
| 814 | }
|
---|
| 815 | #endif
|
---|
| 816 | }
|
---|
[3231] | 817 |
|
---|
| 818 | //
|
---|
| 819 | ////////////////////////////////////////////////////////////////////////////
|
---|
[5072] | 820 | void t_bncCore::stopCombination() {
|
---|
[3231] | 821 | #ifdef USE_COMBINATION
|
---|
| 822 | delete _bncComb;
|
---|
| 823 | _bncComb = 0;
|
---|
| 824 | #endif
|
---|
| 825 | }
|
---|
[4167] | 826 |
|
---|
[4245] | 827 | // Check Ephemeris Consistency
|
---|
| 828 | ////////////////////////////////////////////////////////////////////////////
|
---|
[5072] | 829 | void t_bncCore::checkEphemeris(gpsephemeris* oldEph, gpsephemeris* newEph) {
|
---|
[4245] | 830 | if (oldEph->clock_bias != newEph->clock_bias ||
|
---|
| 831 | oldEph->clock_drift != newEph->clock_drift ||
|
---|
| 832 | oldEph->clock_driftrate != newEph->clock_driftrate) {
|
---|
| 833 | QString msg = currentDateAndTimeGPS().toString(Qt::ISODate) +
|
---|
| 834 | QString(" %1 EPH DIFFERS\n").arg(oldEph->satellite);
|
---|
| 835 | messagePrivate(msg.toAscii());
|
---|
| 836 | }
|
---|
| 837 | }
|
---|
[5577] | 838 |
|
---|
[5846] | 839 |
|
---|
| 840 | //
|
---|
| 841 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 842 | bool t_bncCore::dateAndTimeGPSSet() const {
|
---|
| 843 | QMutexLocker locker(&_mutexDateAndTimeGPS);
|
---|
| 844 | if (_dateAndTimeGPS) {
|
---|
| 845 | return true;
|
---|
| 846 | }
|
---|
| 847 | else {
|
---|
| 848 | return false;
|
---|
| 849 | }
|
---|
| 850 | }
|
---|
| 851 |
|
---|
| 852 | //
|
---|
| 853 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 854 | QDateTime t_bncCore::dateAndTimeGPS() const {
|
---|
| 855 | QMutexLocker locker(&_mutexDateAndTimeGPS);
|
---|
| 856 | if (_dateAndTimeGPS) {
|
---|
| 857 | return *_dateAndTimeGPS;
|
---|
| 858 | }
|
---|
| 859 | else {
|
---|
| 860 | return QDateTime();
|
---|
| 861 | }
|
---|
| 862 | }
|
---|
| 863 |
|
---|
| 864 | //
|
---|
| 865 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 866 | void t_bncCore::setDateAndTimeGPS(QDateTime dateTime) {
|
---|
| 867 | QMutexLocker locker(&_mutexDateAndTimeGPS);
|
---|
| 868 | delete _dateAndTimeGPS;
|
---|
| 869 | _dateAndTimeGPS = new QDateTime(dateTime);
|
---|
| 870 | }
|
---|
[5900] | 871 |
|
---|
| 872 | //
|
---|
| 873 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 874 | void t_bncCore::startPPP() {
|
---|
| 875 | _pppMain->start();
|
---|
| 876 | }
|
---|
| 877 |
|
---|
| 878 | //
|
---|
| 879 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 880 | void t_bncCore::stopPPP() {
|
---|
[5903] | 881 | _pppMain->stop();
|
---|
[5900] | 882 | }
|
---|