| 1 | // Part of BNC, a utility for retrieving decoding and
|
|---|
| 2 | // converting GNSS data streams from NTRIP broadcasters.
|
|---|
| 3 | //
|
|---|
| 4 | // Copyright (C) 2007
|
|---|
| 5 | // German Federal Agency for Cartography and Geodesy (BKG)
|
|---|
| 6 | // http://www.bkg.bund.de
|
|---|
| 7 | // Czech Technical University Prague, Department of Geodesy
|
|---|
| 8 | // http://www.fsv.cvut.cz
|
|---|
| 9 | //
|
|---|
| 10 | // Email: euref-ip@bkg.bund.de
|
|---|
| 11 | //
|
|---|
| 12 | // This program is free software; you can redistribute it and/or
|
|---|
| 13 | // modify it under the terms of the GNU General Public License
|
|---|
| 14 | // as published by the Free Software Foundation, version 2.
|
|---|
| 15 | //
|
|---|
| 16 | // This program is distributed in the hope that it will be useful,
|
|---|
| 17 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|---|
| 18 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|---|
| 19 | // GNU General Public License for more details.
|
|---|
| 20 | //
|
|---|
| 21 | // You should have received a copy of the GNU General Public License
|
|---|
| 22 | // along with this program; if not, write to the Free Software
|
|---|
| 23 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|---|
| 24 |
|
|---|
| 25 | /* -------------------------------------------------------------------------
|
|---|
| 26 | * BKG NTRIP Client
|
|---|
| 27 | * -------------------------------------------------------------------------
|
|---|
| 28 | *
|
|---|
| 29 | * Class: bncApp
|
|---|
| 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 |
|
|---|
| 41 | #include <iostream>
|
|---|
| 42 | #include <QMessageBox>
|
|---|
| 43 | #include <cmath>
|
|---|
| 44 |
|
|---|
| 45 | #include "bncapp.h"
|
|---|
| 46 | #include "bncutils.h"
|
|---|
| 47 | #include "bncrinex.h"
|
|---|
| 48 | #include "bncsettings.h"
|
|---|
| 49 | #include "bncversion.h"
|
|---|
| 50 |
|
|---|
| 51 | #ifdef USE_COMBINATION
|
|---|
| 52 | #include "combination/bnccomb.h"
|
|---|
| 53 | #endif
|
|---|
| 54 |
|
|---|
| 55 | using namespace std;
|
|---|
| 56 |
|
|---|
| 57 | // Constructor
|
|---|
| 58 | ////////////////////////////////////////////////////////////////////////////
|
|---|
| 59 | bncApp::bncApp(int& argc, char* argv[], bool GUIenabled) :
|
|---|
| 60 | QApplication(argc, argv, GUIenabled) {
|
|---|
| 61 |
|
|---|
| 62 | _logFileFlag = 0;
|
|---|
| 63 | _logFile = 0;
|
|---|
| 64 | _logStream = 0;
|
|---|
| 65 | _caster = 0;
|
|---|
| 66 | _rawFile = 0;
|
|---|
| 67 | #ifdef USE_COMBINATION
|
|---|
| 68 | _bncComb = 0;
|
|---|
| 69 | #endif
|
|---|
| 70 |
|
|---|
| 71 | // Lists of Ephemeris
|
|---|
| 72 | // ------------------
|
|---|
| 73 | for (int ii = PRN_GPS_START; ii <= PRN_GPS_END; ii++) {
|
|---|
| 74 | _gpsEph[ii-PRN_GPS_START] = 0;
|
|---|
| 75 | }
|
|---|
| 76 | for (int ii = PRN_GLONASS_START; ii <= PRN_GLONASS_END; ii++) {
|
|---|
| 77 | _glonassEph[ii-PRN_GLONASS_START] = 0;
|
|---|
| 78 | }
|
|---|
| 79 | for (int ii = PRN_GALILEO_START; ii <= PRN_GALILEO_END; ii++) {
|
|---|
| 80 | _galileoEph[ii-PRN_GALILEO_START] = 0;
|
|---|
| 81 | }
|
|---|
| 82 |
|
|---|
| 83 | // Eph file(s)
|
|---|
| 84 | // -----------
|
|---|
| 85 | _rinexVers = 0;
|
|---|
| 86 | _ephFileGPS = 0;
|
|---|
| 87 | _ephStreamGPS = 0;
|
|---|
| 88 | _ephFileGlonass = 0;
|
|---|
| 89 | _ephStreamGlonass = 0;
|
|---|
| 90 | _ephFileGalileo = 0;
|
|---|
| 91 | _ephStreamGalileo = 0;
|
|---|
| 92 |
|
|---|
| 93 | _port = 0;
|
|---|
| 94 | _server = 0;
|
|---|
| 95 | _sockets = 0;
|
|---|
| 96 |
|
|---|
| 97 | _portCorr = 0;
|
|---|
| 98 | _serverCorr = 0;
|
|---|
| 99 | _socketsCorr = 0;
|
|---|
| 100 |
|
|---|
| 101 | _pgmName = QString(BNCPGMNAME).leftJustified(20, ' ', true);
|
|---|
| 102 | #ifdef WIN32
|
|---|
| 103 | _userName = QString("${USERNAME}");
|
|---|
| 104 | #else
|
|---|
| 105 | _userName = QString("${USER}");
|
|---|
| 106 | #endif
|
|---|
| 107 | expandEnvVar(_userName);
|
|---|
| 108 | _userName = _userName.leftJustified(20, ' ', true);
|
|---|
| 109 |
|
|---|
| 110 | _lastDumpCoSec = 0;
|
|---|
| 111 |
|
|---|
| 112 | _corrs = new QMultiMap<long, QString>;
|
|---|
| 113 |
|
|---|
| 114 | _currentDateAndTimeGPS = 0;
|
|---|
| 115 |
|
|---|
| 116 | for (int ii = 0; ii < PRN_GLONASS_NUM; ++ii) {
|
|---|
| 117 | _GLOFreq[ii] = 0;
|
|---|
| 118 | }
|
|---|
| 119 | }
|
|---|
| 120 |
|
|---|
| 121 | // Destructor
|
|---|
| 122 | ////////////////////////////////////////////////////////////////////////////
|
|---|
| 123 | bncApp::~bncApp() {
|
|---|
| 124 | delete _logStream;
|
|---|
| 125 | delete _logFile;
|
|---|
| 126 | delete _ephStreamGPS;
|
|---|
| 127 | delete _ephFileGPS;
|
|---|
| 128 | delete _server;
|
|---|
| 129 | delete _sockets;
|
|---|
| 130 | delete _serverCorr;
|
|---|
| 131 | delete _socketsCorr;
|
|---|
| 132 | if (_rinexVers == 2) {
|
|---|
| 133 | delete _ephStreamGlonass;
|
|---|
| 134 | delete _ephFileGlonass;
|
|---|
| 135 | }
|
|---|
| 136 | for (int ii = PRN_GPS_START; ii <= PRN_GPS_END; ii++) {
|
|---|
| 137 | delete _gpsEph[ii-PRN_GPS_START];
|
|---|
| 138 | }
|
|---|
| 139 | for (int ii = PRN_GLONASS_START; ii <= PRN_GLONASS_END; ii++) {
|
|---|
| 140 | delete _glonassEph[ii-PRN_GLONASS_START];
|
|---|
| 141 | }
|
|---|
| 142 | for (int ii = PRN_GALILEO_START; ii <= PRN_GALILEO_END; ii++) {
|
|---|
| 143 | delete _galileoEph[ii-PRN_GALILEO_START];
|
|---|
| 144 | }
|
|---|
| 145 |
|
|---|
| 146 | delete _corrs;
|
|---|
| 147 |
|
|---|
| 148 | delete _currentDateAndTimeGPS;
|
|---|
| 149 |
|
|---|
| 150 | delete _rawFile;
|
|---|
| 151 |
|
|---|
| 152 | #ifdef USE_COMBINATION
|
|---|
| 153 | delete _bncComb;
|
|---|
| 154 | #endif
|
|---|
| 155 | }
|
|---|
| 156 |
|
|---|
| 157 | // Write a Program Message
|
|---|
| 158 | ////////////////////////////////////////////////////////////////////////////
|
|---|
| 159 | void bncApp::slotMessage(QByteArray msg, bool showOnScreen) {
|
|---|
| 160 |
|
|---|
| 161 | QMutexLocker locker(&_mutexMessage);
|
|---|
| 162 |
|
|---|
| 163 | messagePrivate(msg);
|
|---|
| 164 | emit newMessage(msg, showOnScreen);
|
|---|
| 165 | }
|
|---|
| 166 |
|
|---|
| 167 | // Write a Program Message (private, no lock)
|
|---|
| 168 | ////////////////////////////////////////////////////////////////////////////
|
|---|
| 169 | void bncApp::messagePrivate(const QByteArray& msg) {
|
|---|
| 170 |
|
|---|
| 171 | // First time resolve the log file name
|
|---|
| 172 | // ------------------------------------
|
|---|
| 173 | QDate currDate = currentDateAndTimeGPS().date();
|
|---|
| 174 | if (_logFileFlag == 0 || _fileDate != currDate) {
|
|---|
| 175 | delete _logFile;
|
|---|
| 176 | _logFileFlag = 1;
|
|---|
| 177 | bncSettings settings;
|
|---|
| 178 | QString logFileName = settings.value("logFile").toString();
|
|---|
| 179 | if ( !logFileName.isEmpty() ) {
|
|---|
| 180 | expandEnvVar(logFileName);
|
|---|
| 181 | _logFile = new QFile(logFileName + "_" +
|
|---|
| 182 | currDate.toString("yyMMdd").toAscii().data());
|
|---|
| 183 | _fileDate = currDate;
|
|---|
| 184 | if ( Qt::CheckState(settings.value("rnxAppend").toInt()) == Qt::Checked) {
|
|---|
| 185 | _logFile->open(QIODevice::WriteOnly | QIODevice::Append);
|
|---|
| 186 | }
|
|---|
| 187 | else {
|
|---|
| 188 | _logFile->open(QIODevice::WriteOnly);
|
|---|
| 189 | }
|
|---|
| 190 | _logStream = new QTextStream();
|
|---|
| 191 | _logStream->setDevice(_logFile);
|
|---|
| 192 | }
|
|---|
| 193 | }
|
|---|
| 194 |
|
|---|
| 195 | if (_logStream) {
|
|---|
| 196 | *_logStream << currentDateAndTimeGPS().toString("yy-MM-dd hh:mm:ss ").toAscii().data();
|
|---|
| 197 | *_logStream << msg.data() << endl;
|
|---|
| 198 | _logStream->flush();
|
|---|
| 199 | }
|
|---|
| 200 | }
|
|---|
| 201 |
|
|---|
| 202 | // New GPS Ephemeris
|
|---|
| 203 | ////////////////////////////////////////////////////////////////////////////
|
|---|
| 204 | void bncApp::slotNewGPSEph(gpsephemeris* gpseph) {
|
|---|
| 205 |
|
|---|
| 206 | QMutexLocker locker(&_mutex);
|
|---|
| 207 |
|
|---|
| 208 | gpsephemeris copy_gpseph = *gpseph;
|
|---|
| 209 | emit newEphGPS(copy_gpseph);
|
|---|
| 210 |
|
|---|
| 211 | printEphHeader();
|
|---|
| 212 |
|
|---|
| 213 | gpsephemeris** ee = &_gpsEph[gpseph->satellite-1];
|
|---|
| 214 |
|
|---|
| 215 | if ( *ee == 0 ||
|
|---|
| 216 | gpseph->GPSweek > (*ee)->GPSweek ||
|
|---|
| 217 | (gpseph->GPSweek == (*ee)->GPSweek && gpseph->TOC > (*ee)->TOC) ) {
|
|---|
| 218 | delete *ee;
|
|---|
| 219 | *ee = gpseph;
|
|---|
| 220 | printGPSEph(gpseph, true);
|
|---|
| 221 | }
|
|---|
| 222 | else {
|
|---|
| 223 | printGPSEph(gpseph, false);
|
|---|
| 224 | delete gpseph;
|
|---|
| 225 | }
|
|---|
| 226 | }
|
|---|
| 227 |
|
|---|
| 228 | // New Glonass Ephemeris
|
|---|
| 229 | ////////////////////////////////////////////////////////////////////////////
|
|---|
| 230 | void bncApp::slotNewGlonassEph(glonassephemeris* glonasseph) {
|
|---|
| 231 |
|
|---|
| 232 | QMutexLocker locker(&_mutex);
|
|---|
| 233 |
|
|---|
| 234 | glonassephemeris copy_glonasseph = *glonasseph;
|
|---|
| 235 | emit newEphGlonass(copy_glonasseph);
|
|---|
| 236 |
|
|---|
| 237 | printEphHeader();
|
|---|
| 238 |
|
|---|
| 239 | glonassephemeris** ee = &_glonassEph[glonasseph->almanac_number-1];
|
|---|
| 240 |
|
|---|
| 241 | int wwOld, towOld, wwNew, towNew;
|
|---|
| 242 | if (*ee != 0) {
|
|---|
| 243 | wwOld = (*ee)->GPSWeek;
|
|---|
| 244 | towOld = (*ee)->GPSTOW;
|
|---|
| 245 | updatetime(&wwOld, &towOld, (*ee)->tb*1000, 0); // Moscow -> GPS
|
|---|
| 246 |
|
|---|
| 247 | wwNew = glonasseph->GPSWeek;
|
|---|
| 248 | towNew = glonasseph->GPSTOW;
|
|---|
| 249 | updatetime(&wwNew, &towNew, glonasseph->tb*1000, 0); // Moscow -> GPS
|
|---|
| 250 | }
|
|---|
| 251 |
|
|---|
| 252 | if ( *ee == 0 ||
|
|---|
| 253 | wwNew > wwOld ||
|
|---|
| 254 | (wwNew == wwOld && towNew > towOld) ) {
|
|---|
| 255 | delete *ee;
|
|---|
| 256 | *ee = glonasseph;
|
|---|
| 257 | printGlonassEph(glonasseph, true);
|
|---|
| 258 | }
|
|---|
| 259 | else {
|
|---|
| 260 | printGlonassEph(glonasseph, false);
|
|---|
| 261 | delete glonasseph;
|
|---|
| 262 | }
|
|---|
| 263 | }
|
|---|
| 264 |
|
|---|
| 265 | // New Galileo Ephemeris
|
|---|
| 266 | ////////////////////////////////////////////////////////////////////////////
|
|---|
| 267 | void bncApp::slotNewGalileoEph(galileoephemeris* galileoeph) {
|
|---|
| 268 |
|
|---|
| 269 | QMutexLocker locker(&_mutex);
|
|---|
| 270 |
|
|---|
| 271 | galileoephemeris copy_galileoeph = *galileoeph;
|
|---|
| 272 | emit newEphGalileo(copy_galileoeph);
|
|---|
| 273 |
|
|---|
| 274 | printEphHeader();
|
|---|
| 275 |
|
|---|
| 276 | int galIndex = galileoeph->satellite - 51;
|
|---|
| 277 | if (galIndex < 0 || galIndex > PRN_GALILEO_END - PRN_GALILEO_START) {
|
|---|
| 278 | emit( newMessage("Wrong Galileo Satellite Number", true) );
|
|---|
| 279 | exit(1);
|
|---|
| 280 | }
|
|---|
| 281 |
|
|---|
| 282 | galileoephemeris** ee = &_galileoEph[galIndex];
|
|---|
| 283 |
|
|---|
| 284 | if ( *ee == 0 ||
|
|---|
| 285 | galileoeph->Week > (*ee)->Week ||
|
|---|
| 286 | (galileoeph->Week == (*ee)->Week && galileoeph->TOC > (*ee)->TOC) ) {
|
|---|
| 287 | delete *ee;
|
|---|
| 288 | *ee = galileoeph;
|
|---|
| 289 | printGalileoEph(galileoeph, true);
|
|---|
| 290 | }
|
|---|
| 291 | else {
|
|---|
| 292 | printGalileoEph(galileoeph, false);
|
|---|
| 293 | delete galileoeph;
|
|---|
| 294 | }
|
|---|
| 295 | }
|
|---|
| 296 |
|
|---|
| 297 | // Print Header of the output File(s)
|
|---|
| 298 | ////////////////////////////////////////////////////////////////////////////
|
|---|
| 299 | void bncApp::printEphHeader() {
|
|---|
| 300 |
|
|---|
| 301 | bncSettings settings;
|
|---|
| 302 |
|
|---|
| 303 | // Initialization
|
|---|
| 304 | // --------------
|
|---|
| 305 | if (_rinexVers == 0) {
|
|---|
| 306 |
|
|---|
| 307 | if ( Qt::CheckState(settings.value("ephV3").toInt()) == Qt::Checked) {
|
|---|
| 308 | _rinexVers = 3;
|
|---|
| 309 | }
|
|---|
| 310 | else {
|
|---|
| 311 | _rinexVers = 2;
|
|---|
| 312 | }
|
|---|
| 313 |
|
|---|
| 314 | _ephPath = settings.value("ephPath").toString();
|
|---|
| 315 |
|
|---|
| 316 | if ( !_ephPath.isEmpty() ) {
|
|---|
| 317 | if ( _ephPath[_ephPath.length()-1] != QDir::separator() ) {
|
|---|
| 318 | _ephPath += QDir::separator();
|
|---|
| 319 | }
|
|---|
| 320 | expandEnvVar(_ephPath);
|
|---|
| 321 | }
|
|---|
| 322 | }
|
|---|
| 323 |
|
|---|
| 324 | // (Re-)Open output File(s)
|
|---|
| 325 | // ------------------------
|
|---|
| 326 | if (!_ephPath.isEmpty()) {
|
|---|
| 327 |
|
|---|
| 328 | QDateTime datTim = currentDateAndTimeGPS();
|
|---|
| 329 |
|
|---|
| 330 | QString ephFileNameGPS = _ephPath + "BRDC" +
|
|---|
| 331 | QString("%1").arg(datTim.date().dayOfYear(), 3, 10, QChar('0'));
|
|---|
| 332 |
|
|---|
| 333 | QString hlpStr = bncRinex::nextEpochStr(datTim,
|
|---|
| 334 | settings.value("ephIntr").toString());
|
|---|
| 335 |
|
|---|
| 336 | if (_rinexVers == 3) {
|
|---|
| 337 | ephFileNameGPS += hlpStr + datTim.toString(".yyP");
|
|---|
| 338 | }
|
|---|
| 339 | else {
|
|---|
| 340 | ephFileNameGPS += hlpStr + datTim.toString(".yyN");
|
|---|
| 341 | }
|
|---|
| 342 |
|
|---|
| 343 | if (_ephFileNameGPS == ephFileNameGPS) {
|
|---|
| 344 | return;
|
|---|
| 345 | }
|
|---|
| 346 | else {
|
|---|
| 347 | _ephFileNameGPS = ephFileNameGPS;
|
|---|
| 348 | }
|
|---|
| 349 |
|
|---|
| 350 | for (int ii = PRN_GPS_START; ii <= PRN_GPS_END; ii++) {
|
|---|
| 351 | delete _gpsEph[ii-PRN_GPS_START];
|
|---|
| 352 | _gpsEph[ii-PRN_GPS_START] = 0;
|
|---|
| 353 | }
|
|---|
| 354 | for (int ii = PRN_GLONASS_START; ii <= PRN_GLONASS_END; ii++) {
|
|---|
| 355 | delete _glonassEph[ii-PRN_GLONASS_START];
|
|---|
| 356 | _glonassEph[ii-PRN_GLONASS_START] = 0;
|
|---|
| 357 | }
|
|---|
| 358 | for (int ii = PRN_GALILEO_START; ii <= PRN_GALILEO_END; ii++) {
|
|---|
| 359 | delete _galileoEph[ii-PRN_GALILEO_START];
|
|---|
| 360 | _galileoEph[ii-PRN_GALILEO_START] = 0;
|
|---|
| 361 | }
|
|---|
| 362 |
|
|---|
| 363 | delete _ephStreamGPS;
|
|---|
| 364 | delete _ephFileGPS;
|
|---|
| 365 |
|
|---|
| 366 | QFlags<QIODevice::OpenModeFlag> appendFlagGPS;
|
|---|
| 367 | QFlags<QIODevice::OpenModeFlag> appendFlagGlonass;
|
|---|
| 368 | QFlags<QIODevice::OpenModeFlag> appendFlagGalileo;
|
|---|
| 369 |
|
|---|
| 370 | if ( Qt::CheckState(settings.value("rnxAppend").toInt()) == Qt::Checked &&
|
|---|
| 371 | QFile::exists(ephFileNameGPS) ) {
|
|---|
| 372 | appendFlagGPS = QIODevice::Append;
|
|---|
| 373 | }
|
|---|
| 374 |
|
|---|
| 375 | _ephFileGPS = new QFile(ephFileNameGPS);
|
|---|
| 376 | _ephFileGPS->open(QIODevice::WriteOnly | appendFlagGPS);
|
|---|
| 377 | _ephStreamGPS = new QTextStream();
|
|---|
| 378 | _ephStreamGPS->setDevice(_ephFileGPS);
|
|---|
| 379 |
|
|---|
| 380 | if (_rinexVers == 3) {
|
|---|
| 381 | _ephFileGlonass = _ephFileGPS;
|
|---|
| 382 | _ephStreamGlonass = _ephStreamGPS;
|
|---|
| 383 | _ephFileGalileo = _ephFileGPS;
|
|---|
| 384 | _ephStreamGalileo = _ephStreamGPS;
|
|---|
| 385 | }
|
|---|
| 386 | else if (_rinexVers == 2) {
|
|---|
| 387 | QString ephFileNameGlonass = _ephPath + "BRDC" +
|
|---|
| 388 | QString("%1").arg(datTim.date().dayOfYear(), 3, 10, QChar('0')) +
|
|---|
| 389 | hlpStr + datTim.toString(".yyG");
|
|---|
| 390 |
|
|---|
| 391 | delete _ephStreamGlonass;
|
|---|
| 392 | delete _ephFileGlonass;
|
|---|
| 393 |
|
|---|
| 394 | if ( Qt::CheckState(settings.value("rnxAppend").toInt()) == Qt::Checked &&
|
|---|
| 395 | QFile::exists(ephFileNameGlonass) ) {
|
|---|
| 396 | appendFlagGlonass = QIODevice::Append;
|
|---|
| 397 | }
|
|---|
| 398 |
|
|---|
| 399 | _ephFileGlonass = new QFile(ephFileNameGlonass);
|
|---|
| 400 | _ephFileGlonass->open(QIODevice::WriteOnly | appendFlagGlonass);
|
|---|
| 401 | _ephStreamGlonass = new QTextStream();
|
|---|
| 402 | _ephStreamGlonass->setDevice(_ephFileGlonass);
|
|---|
| 403 | }
|
|---|
| 404 |
|
|---|
| 405 | // Header - RINEX Version 3
|
|---|
| 406 | // ------------------------
|
|---|
| 407 | if (_rinexVers == 3) {
|
|---|
| 408 | if ( ! (appendFlagGPS & QIODevice::Append)) {
|
|---|
| 409 | QString line;
|
|---|
| 410 | line.sprintf(
|
|---|
| 411 | "%9.2f%11sN: GNSS NAV DATA M: Mixed%12sRINEX VERSION / TYPE\n",
|
|---|
| 412 | 3.0, "", "");
|
|---|
| 413 | *_ephStreamGPS << line;
|
|---|
| 414 |
|
|---|
| 415 | QString hlp = currentDateAndTimeGPS().toString("yyyyMMdd hhmmss UTC").leftJustified(20, ' ', true);
|
|---|
| 416 | *_ephStreamGPS << _pgmName.toAscii().data()
|
|---|
| 417 | << _userName.toAscii().data()
|
|---|
| 418 | << hlp.toAscii().data()
|
|---|
| 419 | << "PGM / RUN BY / DATE" << endl;
|
|---|
| 420 |
|
|---|
| 421 | line.sprintf("%60sEND OF HEADER\n", "");
|
|---|
| 422 | *_ephStreamGPS << line;
|
|---|
| 423 |
|
|---|
| 424 | _ephStreamGPS->flush();
|
|---|
| 425 | }
|
|---|
| 426 | }
|
|---|
| 427 |
|
|---|
| 428 | // Headers - RINEX Version 2
|
|---|
| 429 | // -------------------------
|
|---|
| 430 | else if (_rinexVers == 2) {
|
|---|
| 431 | if (! (appendFlagGPS & QIODevice::Append)) {
|
|---|
| 432 | QString line;
|
|---|
| 433 | line.sprintf(
|
|---|
| 434 | "%9.2f%11sN: GPS NAV DATA%25sRINEX VERSION / TYPE\n", 2.10, "", "");
|
|---|
| 435 | *_ephStreamGPS << line;
|
|---|
| 436 |
|
|---|
| 437 | QString hlp = currentDateAndTimeGPS().date().toString("dd-MMM-yyyy").leftJustified(20, ' ', true);
|
|---|
| 438 | *_ephStreamGPS << _pgmName.toAscii().data()
|
|---|
| 439 | << _userName.toAscii().data()
|
|---|
| 440 | << hlp.toAscii().data()
|
|---|
| 441 | << "PGM / RUN BY / DATE" << endl;
|
|---|
| 442 |
|
|---|
| 443 | line.sprintf("%60sEND OF HEADER\n", "");
|
|---|
| 444 | *_ephStreamGPS << line;
|
|---|
| 445 |
|
|---|
| 446 | _ephStreamGPS->flush();
|
|---|
| 447 | }
|
|---|
| 448 | if (! (appendFlagGlonass & QIODevice::Append)) {
|
|---|
| 449 | QString line;
|
|---|
| 450 | line.sprintf(
|
|---|
| 451 | "%9.2f%11sG: GLONASS NAV DATA%21sRINEX VERSION / TYPE\n",2.10,"","");
|
|---|
| 452 | *_ephStreamGlonass << line;
|
|---|
| 453 |
|
|---|
| 454 | QString hlp = currentDateAndTimeGPS().date().toString("dd-MMM-yyyy").leftJustified(20, ' ', true);
|
|---|
| 455 | *_ephStreamGlonass << _pgmName.toAscii().data()
|
|---|
| 456 | << _userName.toAscii().data()
|
|---|
| 457 | << hlp.toAscii().data()
|
|---|
| 458 | << "PGM / RUN BY / DATE" << endl;
|
|---|
| 459 |
|
|---|
| 460 | line.sprintf("%60sEND OF HEADER\n", "");
|
|---|
| 461 | *_ephStreamGlonass << line;
|
|---|
| 462 |
|
|---|
| 463 | _ephStreamGlonass->flush();
|
|---|
| 464 | }
|
|---|
| 465 | }
|
|---|
| 466 | }
|
|---|
| 467 | }
|
|---|
| 468 |
|
|---|
| 469 | // Print One GPS Ephemeris
|
|---|
| 470 | ////////////////////////////////////////////////////////////////////////////
|
|---|
| 471 | void bncApp::printGPSEph(gpsephemeris* ep, bool printFile) {
|
|---|
| 472 |
|
|---|
| 473 | QString lineV2;
|
|---|
| 474 | QString lineV3;
|
|---|
| 475 |
|
|---|
| 476 | struct converttimeinfo cti;
|
|---|
| 477 | converttime(&cti, ep->GPSweek, ep->TOC);
|
|---|
| 478 |
|
|---|
| 479 | lineV3.sprintf("G%02d %04d %02d %02d %02d %02d %02d%19.12e%19.12e%19.12e\n",
|
|---|
| 480 | ep->satellite, cti.year, cti.month, cti.day, cti.hour,
|
|---|
| 481 | cti.minute, cti.second, ep->clock_bias, ep->clock_drift,
|
|---|
| 482 | ep->clock_driftrate);
|
|---|
| 483 |
|
|---|
| 484 | lineV2.sprintf("%02d %02d %02d %02d %02d %02d%5.1f%19.12e%19.12e%19.12e\n",
|
|---|
| 485 | ep->satellite, cti.year%100, cti.month, cti.day, cti.hour,
|
|---|
| 486 | cti.minute, (double) cti.second, ep->clock_bias,
|
|---|
| 487 | ep->clock_drift, ep->clock_driftrate);
|
|---|
| 488 |
|
|---|
| 489 | QString line;
|
|---|
| 490 | QByteArray allLines;
|
|---|
| 491 |
|
|---|
| 492 | QByteArray fmt;
|
|---|
| 493 | QByteArray fmt2;
|
|---|
| 494 | if (_rinexVers == 2) {
|
|---|
| 495 | fmt = " %19.12e%19.12e%19.12e%19.12e\n";
|
|---|
| 496 | fmt2 = " %19.12e%19.12e\n";
|
|---|
| 497 | }
|
|---|
| 498 | else {
|
|---|
| 499 | fmt = " %19.12e%19.12e%19.12e%19.12e\n";
|
|---|
| 500 | fmt2 = " %19.12e%19.12e\n";
|
|---|
| 501 | }
|
|---|
| 502 |
|
|---|
| 503 | line.sprintf(fmt.data(), (double)ep->IODE, ep->Crs, ep->Delta_n, ep->M0);
|
|---|
| 504 | allLines += line;
|
|---|
| 505 |
|
|---|
| 506 | line.sprintf(fmt.data(), ep->Cuc, ep->e, ep->Cus, ep->sqrt_A);
|
|---|
| 507 | allLines += line;
|
|---|
| 508 |
|
|---|
| 509 | line.sprintf(fmt.data(), (double) ep->TOE, ep->Cic, ep->OMEGA0, ep->Cis);
|
|---|
| 510 | allLines += line;
|
|---|
| 511 |
|
|---|
| 512 | line.sprintf(fmt.data(), ep->i0, ep->Crc, ep->omega, ep->OMEGADOT);
|
|---|
| 513 | allLines += line;
|
|---|
| 514 |
|
|---|
| 515 | double dd = 0;
|
|---|
| 516 | unsigned long ii = ep->flags;
|
|---|
| 517 | if(ii & GPSEPHF_L2CACODE)
|
|---|
| 518 | dd += 2.0;
|
|---|
| 519 | if(ii & GPSEPHF_L2PCODE)
|
|---|
| 520 | dd += 1.0;
|
|---|
| 521 | line.sprintf(fmt.data(), ep->IDOT, dd, (double) ep->GPSweek,
|
|---|
| 522 | ii & GPSEPHF_L2PCODEDATA ? 1.0 : 0.0);
|
|---|
| 523 | allLines += line;
|
|---|
| 524 |
|
|---|
| 525 | if(ep->URAindex <= 6) /* URA index */
|
|---|
| 526 | dd = ceil(10.0*pow(2.0, 1.0+((double)ep->URAindex)/2.0))/10.0;
|
|---|
| 527 | else
|
|---|
| 528 | dd = ceil(10.0*pow(2.0, ((double)ep->URAindex)/2.0))/10.0;
|
|---|
| 529 | line.sprintf(fmt.data(), dd, ((double) ep->SVhealth), ep->TGD,
|
|---|
| 530 | ((double) ep->IODC));
|
|---|
| 531 | allLines += line;
|
|---|
| 532 |
|
|---|
| 533 | line.sprintf(fmt2.data(), ((double)ep->TOW), 0.0);
|
|---|
| 534 | allLines += line;
|
|---|
| 535 |
|
|---|
| 536 | printOutput(printFile, _ephStreamGPS, lineV2, lineV3, allLines);
|
|---|
| 537 | }
|
|---|
| 538 |
|
|---|
| 539 | // Print One Glonass Ephemeris
|
|---|
| 540 | ////////////////////////////////////////////////////////////////////////////
|
|---|
| 541 | void bncApp::printGlonassEph(glonassephemeris* ep, bool printFile) {
|
|---|
| 542 |
|
|---|
| 543 | int ww = ep->GPSWeek;
|
|---|
| 544 | int tow = ep->GPSTOW;
|
|---|
| 545 | struct converttimeinfo cti;
|
|---|
| 546 |
|
|---|
| 547 | updatetime(&ww, &tow, ep->tb*1000, 1); // Moscow -> UTC
|
|---|
| 548 | converttime(&cti, ww, tow);
|
|---|
| 549 |
|
|---|
| 550 | int tk = ep->tk-3*60*60;
|
|---|
| 551 | if (tk < 0) {
|
|---|
| 552 | tk += 86400;
|
|---|
| 553 | }
|
|---|
| 554 |
|
|---|
| 555 | QString lineV2;
|
|---|
| 556 | QString lineV3;
|
|---|
| 557 |
|
|---|
| 558 | lineV3.sprintf("R%02d %04d %02d %02d %02d %02d %02d%19.12e%19.12e%19.12e\n",
|
|---|
| 559 | ep->almanac_number, cti.year, cti.month, cti.day, cti.hour,
|
|---|
| 560 | cti.minute, cti.second, -ep->tau, ep->gamma, (double) tk);
|
|---|
| 561 |
|
|---|
| 562 | lineV2.sprintf("%02d %02d %02d %02d %02d %02d%5.1f%19.12e%19.12e%19.12e\n",
|
|---|
| 563 | ep->almanac_number, cti.year%100, cti.month, cti.day,
|
|---|
| 564 | cti.hour, cti.minute, (double) cti.second, -ep->tau,
|
|---|
| 565 | ep->gamma, (double) tk);
|
|---|
| 566 |
|
|---|
| 567 | QString line;
|
|---|
| 568 | QByteArray allLines;
|
|---|
| 569 |
|
|---|
| 570 | QByteArray fmt;
|
|---|
| 571 | if (_rinexVers == 2) {
|
|---|
| 572 | fmt = " %19.12e%19.12e%19.12e%19.12e\n";
|
|---|
| 573 | }
|
|---|
| 574 | else {
|
|---|
| 575 | fmt = " %19.12e%19.12e%19.12e%19.12e\n";
|
|---|
| 576 | }
|
|---|
| 577 |
|
|---|
| 578 | line.sprintf(fmt.data(), ep->x_pos, ep->x_velocity, ep->x_acceleration,
|
|---|
| 579 | (ep->flags & GLOEPHF_UNHEALTHY) ? 1.0 : 0.0);
|
|---|
| 580 | allLines += line;
|
|---|
| 581 |
|
|---|
| 582 | line.sprintf(fmt.data(), ep->y_pos, ep->y_velocity, ep->y_acceleration,
|
|---|
| 583 | (double) ep->frequency_number);
|
|---|
| 584 | allLines += line;
|
|---|
| 585 |
|
|---|
| 586 | line.sprintf(fmt.data(), ep->z_pos, ep->z_velocity, ep->z_acceleration,
|
|---|
| 587 | (double) ep->E);
|
|---|
| 588 | allLines += line;
|
|---|
| 589 |
|
|---|
| 590 | printOutput(printFile, _ephStreamGlonass, lineV2, lineV3, allLines);
|
|---|
| 591 | }
|
|---|
| 592 |
|
|---|
| 593 | // Print One Galileo Ephemeris
|
|---|
| 594 | ////////////////////////////////////////////////////////////////////////////
|
|---|
| 595 | void bncApp::printGalileoEph(galileoephemeris* ep, bool printFile) {
|
|---|
| 596 |
|
|---|
| 597 | QString lineV2;
|
|---|
| 598 | QString lineV3;
|
|---|
| 599 |
|
|---|
| 600 | struct converttimeinfo cti;
|
|---|
| 601 | converttime(&cti, ep->Week, ep->TOC);
|
|---|
| 602 |
|
|---|
| 603 | lineV3.sprintf("E%02d %04d %02d %02d %02d %02d %02d%19.12e%19.12e%19.12e\n",
|
|---|
| 604 | ep->satellite, cti.year, cti.month, cti.day, cti.hour,
|
|---|
| 605 | cti.minute, cti.second, ep->clock_bias, ep->clock_drift,
|
|---|
| 606 | ep->clock_driftrate);
|
|---|
| 607 |
|
|---|
| 608 | QString line;
|
|---|
| 609 | QByteArray allLines;
|
|---|
| 610 |
|
|---|
| 611 | const QByteArray fmt4 = " %19.12e%19.12e%19.12e%19.12e\n";
|
|---|
| 612 | const QByteArray fmt3 = " %19.12e%19.12e%19.12e\n";
|
|---|
| 613 | const QByteArray fmt1 = " %19.12e\n";
|
|---|
| 614 |
|
|---|
| 615 | line.sprintf(fmt4.data(), (double)ep->IODnav, ep->Crs, ep->Delta_n, ep->M0);
|
|---|
| 616 | allLines += line;
|
|---|
| 617 |
|
|---|
| 618 | line.sprintf(fmt4.data(), ep->Cuc, ep->e, ep->Cus, ep->sqrt_A);
|
|---|
| 619 | allLines += line;
|
|---|
| 620 |
|
|---|
| 621 | line.sprintf(fmt4.data(), (double) ep->TOE, ep->Cic, ep->OMEGA0, ep->Cis);
|
|---|
| 622 | allLines += line;
|
|---|
| 623 |
|
|---|
| 624 | line.sprintf(fmt4.data(), ep->i0, ep->Crc, ep->omega, ep->OMEGADOT);
|
|---|
| 625 | allLines += line;
|
|---|
| 626 |
|
|---|
| 627 | double dataSources = 0.0; // TODO
|
|---|
| 628 | line.sprintf(fmt3.data(), ep->IDOT, dataSources, (double) ep->Week);
|
|---|
| 629 | allLines += line;
|
|---|
| 630 |
|
|---|
| 631 | double health = 0.0; // TODO
|
|---|
| 632 | double BGD_1_5B = ep->BGD_1_5A; // TODO
|
|---|
| 633 | line.sprintf(fmt4.data(), (double) ep->SISA, health, ep->BGD_1_5A, BGD_1_5B);
|
|---|
| 634 | allLines += line;
|
|---|
| 635 |
|
|---|
| 636 | double transmissionTimeOfMessage = 0.9999e9; // unknown (Rinex v3 standard)
|
|---|
| 637 | line.sprintf(fmt1.data(), transmissionTimeOfMessage);
|
|---|
| 638 | allLines += line;
|
|---|
| 639 |
|
|---|
| 640 | printOutput(printFile, _ephStreamGalileo, lineV2, lineV3, allLines);
|
|---|
| 641 | }
|
|---|
| 642 |
|
|---|
| 643 | // Output
|
|---|
| 644 | ////////////////////////////////////////////////////////////////////////////
|
|---|
| 645 | void bncApp::printOutput(bool printFile, QTextStream* stream,
|
|---|
| 646 | const QString& lineV2,
|
|---|
| 647 | const QString& lineV3,
|
|---|
| 648 | const QByteArray& allLines) {
|
|---|
| 649 | // Output into file
|
|---|
| 650 | // ----------------
|
|---|
| 651 | if (printFile && stream) {
|
|---|
| 652 | if (_rinexVers == 2) {
|
|---|
| 653 | *stream << lineV2.toAscii();
|
|---|
| 654 | }
|
|---|
| 655 | else {
|
|---|
| 656 | *stream << lineV3.toAscii();
|
|---|
| 657 | }
|
|---|
| 658 | *stream << allLines;
|
|---|
| 659 | stream->flush();
|
|---|
| 660 | }
|
|---|
| 661 |
|
|---|
| 662 | // Output into the socket
|
|---|
| 663 | // ----------------------
|
|---|
| 664 | if (_sockets) {
|
|---|
| 665 | QMutableListIterator<QTcpSocket*> is(*_sockets);
|
|---|
| 666 | while (is.hasNext()) {
|
|---|
| 667 | QTcpSocket* sock = is.next();
|
|---|
| 668 | if (sock->state() == QAbstractSocket::ConnectedState) {
|
|---|
| 669 | if (sock->write(lineV3.toAscii()) == -1 ||
|
|---|
| 670 | sock->write(allLines) == -1) {
|
|---|
| 671 | delete sock;
|
|---|
| 672 | is.remove();
|
|---|
| 673 | }
|
|---|
| 674 | }
|
|---|
| 675 | else if (sock->state() != QAbstractSocket::ConnectingState) {
|
|---|
| 676 | delete sock;
|
|---|
| 677 | is.remove();
|
|---|
| 678 | }
|
|---|
| 679 | }
|
|---|
| 680 | }
|
|---|
| 681 | }
|
|---|
| 682 |
|
|---|
| 683 | // Set Port Number
|
|---|
| 684 | ////////////////////////////////////////////////////////////////////////////
|
|---|
| 685 | void bncApp::setPort(int port) {
|
|---|
| 686 | _port = port;
|
|---|
| 687 | if (_port != 0) {
|
|---|
| 688 | delete _server;
|
|---|
| 689 | _server = new QTcpServer;
|
|---|
| 690 | if ( !_server->listen(QHostAddress::Any, _port) ) {
|
|---|
| 691 | slotMessage("bncApp: Cannot listen on ephemeris port", true);
|
|---|
| 692 | }
|
|---|
| 693 | connect(_server, SIGNAL(newConnection()), this, SLOT(slotNewConnection()));
|
|---|
| 694 | delete _sockets;
|
|---|
| 695 | _sockets = new QList<QTcpSocket*>;
|
|---|
| 696 | }
|
|---|
| 697 | }
|
|---|
| 698 |
|
|---|
| 699 | // Set Port Number
|
|---|
| 700 | ////////////////////////////////////////////////////////////////////////////
|
|---|
| 701 | void bncApp::setPortCorr(int port) {
|
|---|
| 702 | _portCorr = port;
|
|---|
| 703 | if (_portCorr != 0) {
|
|---|
| 704 | delete _serverCorr;
|
|---|
| 705 | _serverCorr = new QTcpServer;
|
|---|
| 706 | if ( !_serverCorr->listen(QHostAddress::Any, _portCorr) ) {
|
|---|
| 707 | slotMessage("bncApp: Cannot listen on correction port", true);
|
|---|
| 708 | }
|
|---|
| 709 | connect(_serverCorr, SIGNAL(newConnection()), this, SLOT(slotNewConnectionCorr()));
|
|---|
| 710 | delete _socketsCorr;
|
|---|
| 711 | _socketsCorr = new QList<QTcpSocket*>;
|
|---|
| 712 | }
|
|---|
| 713 | }
|
|---|
| 714 |
|
|---|
| 715 | // New Connection
|
|---|
| 716 | ////////////////////////////////////////////////////////////////////////////
|
|---|
| 717 | void bncApp::slotNewConnection() {
|
|---|
| 718 | _sockets->push_back( _server->nextPendingConnection() );
|
|---|
| 719 | }
|
|---|
| 720 |
|
|---|
| 721 | // New Connection
|
|---|
| 722 | ////////////////////////////////////////////////////////////////////////////
|
|---|
| 723 | void bncApp::slotNewConnectionCorr() {
|
|---|
| 724 | _socketsCorr->push_back( _serverCorr->nextPendingConnection() );
|
|---|
| 725 | }
|
|---|
| 726 |
|
|---|
| 727 | //
|
|---|
| 728 | ////////////////////////////////////////////////////////////////////////////
|
|---|
| 729 | void bncApp::slotQuit() {
|
|---|
| 730 | cout << "bncApp::slotQuit" << endl;
|
|---|
| 731 | delete _caster;
|
|---|
| 732 | quit();
|
|---|
| 733 | }
|
|---|
| 734 |
|
|---|
| 735 | //
|
|---|
| 736 | ////////////////////////////////////////////////////////////////////////////
|
|---|
| 737 | void bncApp::slotNewCorrLine(QString line, QString staID, long coTime) {
|
|---|
| 738 |
|
|---|
| 739 | QMutexLocker locker(&_mutex);
|
|---|
| 740 |
|
|---|
| 741 | // Combination of Corrections
|
|---|
| 742 | // --------------------------
|
|---|
| 743 | #ifdef USE_COMBINATION
|
|---|
| 744 | if (_bncComb) {
|
|---|
| 745 | _bncComb->processCorrLine(staID, line);
|
|---|
| 746 | }
|
|---|
| 747 | #endif
|
|---|
| 748 |
|
|---|
| 749 | bncSettings settings;
|
|---|
| 750 | _waitCoTime = settings.value("corrTime").toInt();
|
|---|
| 751 | if (_waitCoTime < 1) {
|
|---|
| 752 | _waitCoTime = 1;
|
|---|
| 753 | }
|
|---|
| 754 |
|
|---|
| 755 | // First time, set the _lastDumpSec immediately
|
|---|
| 756 | // --------------------------------------------
|
|---|
| 757 | if (_lastDumpCoSec == 0) {
|
|---|
| 758 | _lastDumpCoSec = coTime - 1;
|
|---|
| 759 | }
|
|---|
| 760 |
|
|---|
| 761 | // An old correction - throw it away
|
|---|
| 762 | // ---------------------------------
|
|---|
| 763 | if (coTime <= _lastDumpCoSec) {
|
|---|
| 764 | if (!_bncComb) {
|
|---|
| 765 | QString line = staID + ": Correction for one sat neglected because overaged by " +
|
|---|
| 766 | QString().sprintf(" %ld sec",
|
|---|
| 767 | _lastDumpCoSec - coTime + _waitCoTime);
|
|---|
| 768 | messagePrivate(line.toAscii());
|
|---|
| 769 | emit( newMessage(line.toAscii(), true) );
|
|---|
| 770 | }
|
|---|
| 771 | return;
|
|---|
| 772 | }
|
|---|
| 773 |
|
|---|
| 774 | _corrs->insert(coTime, QString(line + " " + staID));
|
|---|
| 775 |
|
|---|
| 776 | // Dump Corrections
|
|---|
| 777 | // ----------------
|
|---|
| 778 | if (coTime - _waitCoTime > _lastDumpCoSec) {
|
|---|
| 779 | dumpCorrs(_lastDumpCoSec + 1, coTime - _waitCoTime);
|
|---|
| 780 | _lastDumpCoSec = coTime - _waitCoTime;
|
|---|
| 781 | }
|
|---|
| 782 | }
|
|---|
| 783 |
|
|---|
| 784 | // Dump Complete Correction Epochs
|
|---|
| 785 | ////////////////////////////////////////////////////////////////////////////
|
|---|
| 786 | void bncApp::dumpCorrs(long minTime, long maxTime) {
|
|---|
| 787 |
|
|---|
| 788 | for (long sec = minTime; sec <= maxTime; sec++) {
|
|---|
| 789 | QList<QString> allCorrs = _corrs->values(sec);
|
|---|
| 790 | emit newCorrections(allCorrs);
|
|---|
| 791 | if (_socketsCorr) {
|
|---|
| 792 | QListIterator<QString> it(allCorrs);
|
|---|
| 793 | while (it.hasNext()) {
|
|---|
| 794 | QString corrLine = it.next() + "\n";
|
|---|
| 795 |
|
|---|
| 796 | QMutableListIterator<QTcpSocket*> is(*_socketsCorr);
|
|---|
| 797 | while (is.hasNext()) {
|
|---|
| 798 | QTcpSocket* sock = is.next();
|
|---|
| 799 | if (sock->state() == QAbstractSocket::ConnectedState) {
|
|---|
| 800 | if (sock->write(corrLine.toAscii()) == -1) {
|
|---|
| 801 | delete sock;
|
|---|
| 802 | is.remove();
|
|---|
| 803 | }
|
|---|
| 804 | }
|
|---|
| 805 | else if (sock->state() != QAbstractSocket::ConnectingState) {
|
|---|
| 806 | delete sock;
|
|---|
| 807 | is.remove();
|
|---|
| 808 | }
|
|---|
| 809 | }
|
|---|
| 810 | }
|
|---|
| 811 | }
|
|---|
| 812 | _corrs->remove(sec);
|
|---|
| 813 | }
|
|---|
| 814 | }
|
|---|
| 815 |
|
|---|
| 816 | //
|
|---|
| 817 | ////////////////////////////////////////////////////////////////////////////
|
|---|
| 818 | void bncApp::setConfFileName(const QString& confFileName) {
|
|---|
| 819 | if (confFileName.isEmpty()) {
|
|---|
| 820 | _confFileName = QDir::homePath() + QDir::separator()
|
|---|
| 821 | + ".config" + QDir::separator()
|
|---|
| 822 | + organizationName() + QDir::separator()
|
|---|
| 823 | + applicationName() + ".ini";
|
|---|
| 824 | }
|
|---|
| 825 | else {
|
|---|
| 826 | _confFileName = confFileName;
|
|---|
| 827 | }
|
|---|
| 828 | }
|
|---|
| 829 |
|
|---|
| 830 | // Raw Output
|
|---|
| 831 | ////////////////////////////////////////////////////////////////////////////
|
|---|
| 832 | void bncApp::writeRawData(const QByteArray& data, const QByteArray& staID,
|
|---|
| 833 | const QByteArray& format) {
|
|---|
| 834 |
|
|---|
| 835 | QMutexLocker locker(&_mutex);
|
|---|
| 836 |
|
|---|
| 837 | if (!_rawFile) {
|
|---|
| 838 | bncSettings settings;
|
|---|
| 839 | QByteArray fileName = settings.value("rawOutFile").toByteArray();
|
|---|
| 840 | if (!fileName.isEmpty()) {
|
|---|
| 841 | _rawFile = new bncRawFile(fileName, format, bncRawFile::output);
|
|---|
| 842 | }
|
|---|
| 843 | }
|
|---|
| 844 |
|
|---|
| 845 | if (_rawFile) {
|
|---|
| 846 | _rawFile->writeRawData(data, staID, format);
|
|---|
| 847 | }
|
|---|
| 848 | }
|
|---|
| 849 |
|
|---|
| 850 | // Get Glonass Slot Numbers from Global Array
|
|---|
| 851 | ////////////////////////////////////////////////////////////////////////////
|
|---|
| 852 | void bncApp::getGlonassSlotNums(int GLOFreq[]) {
|
|---|
| 853 |
|
|---|
| 854 | QMutexLocker locker(&_mutex);
|
|---|
| 855 |
|
|---|
| 856 | for (int ii = 0; ii < PRN_GLONASS_NUM; ++ii) {
|
|---|
| 857 | if (_GLOFreq[ii] != 0) {
|
|---|
| 858 | GLOFreq[ii] = _GLOFreq[ii];
|
|---|
| 859 | }
|
|---|
| 860 | }
|
|---|
| 861 | }
|
|---|
| 862 |
|
|---|
| 863 | // Store Glonass Slot Numbers to Global Array
|
|---|
| 864 | ////////////////////////////////////////////////////////////////////////////
|
|---|
| 865 | void bncApp::storeGlonassSlotNums(const int GLOFreq[]) {
|
|---|
| 866 |
|
|---|
| 867 | QMutexLocker locker(&_mutex);
|
|---|
| 868 |
|
|---|
| 869 | for (int ii = 0; ii < PRN_GLONASS_NUM; ++ii) {
|
|---|
| 870 | if (GLOFreq[ii] != 0) {
|
|---|
| 871 | _GLOFreq[ii] = GLOFreq[ii];
|
|---|
| 872 | }
|
|---|
| 873 | }
|
|---|
| 874 | }
|
|---|
| 875 |
|
|---|
| 876 | //
|
|---|
| 877 | ////////////////////////////////////////////////////////////////////////////
|
|---|
| 878 | void bncApp::initCombination() {
|
|---|
| 879 | #ifdef USE_COMBINATION
|
|---|
| 880 | _bncComb = new bncComb();
|
|---|
| 881 | if (_bncComb->nStreams() < 2) {
|
|---|
| 882 | delete _bncComb;
|
|---|
| 883 | _bncComb = 0;
|
|---|
| 884 | }
|
|---|
| 885 | #endif
|
|---|
| 886 | }
|
|---|