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