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