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