source: ntrip/trunk/BNC/src/bnccore.cpp@ 7207

Last change on this file since 7207 was 7179, checked in by stuerze, 10 years ago

RINEX v3 filenames can now be formed optionally during RINEX file generation from RTCM observation and navigation streams

File size: 22.4 KB
Line 
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: t_bncCore
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 <sstream>
43#include <QMessageBox>
44#include <cmath>
45
46#include "bnccore.h"
47#include "bncutils.h"
48#include "bncrinex.h"
49#include "bncsettings.h"
50#include "bncversion.h"
51#include "ephemeris.h"
52#include "rinex/rnxobsfile.h"
53#include "rinex/rnxnavfile.h"
54#include "pppMain.h"
55
56#ifdef USE_COMBINATION
57# include "combination/bnccomb.h"
58#endif
59
60using namespace std;
61
62// Singleton
63////////////////////////////////////////////////////////////////////////////
64t_bncCore* t_bncCore::instance() {
65 static t_bncCore _bncCore;
66 return &_bncCore;
67}
68
69// Constructor
70////////////////////////////////////////////////////////////////////////////
71t_bncCore::t_bncCore() : _ephUser(false) {
72 _GUIenabled = true;
73 _logFileFlag = 0;
74 _logFile = 0;
75 _logStream = 0;
76 _rawFile = 0;
77 _caster = 0;
78#ifdef USE_COMBINATION
79 _bncComb = 0;
80#endif
81
82 // Eph file(s)
83 // -----------
84 _rinexVers = 0;
85 _ephFileGPS = 0;
86 _ephStreamGPS = 0;
87 _ephFileGlonass = 0;
88 _ephStreamGlonass = 0;
89 _ephFileGalileo = 0;
90 _ephStreamGalileo = 0;
91 _ephFileSBAS = 0;
92 _ephStreamSBAS = 0;
93
94 _portEph = 0;
95 _serverEph = 0;
96 _socketsEph = 0;
97
98 _portCorr = 0;
99 _serverCorr = 0;
100 _socketsCorr = 0;
101
102 _pgmName = QString(BNCPGMNAME).leftJustified(20, ' ', true);
103#ifdef WIN32
104 _userName = QString("${USERNAME}");
105#else
106 _userName = QString("${USER}");
107#endif
108 expandEnvVar(_userName);
109
110 _userName = _userName.leftJustified(20, ' ', true);
111 _dateAndTimeGPS = 0;
112 _mainWindow = 0;
113
114 _pppMain = new BNC_PPP::t_pppMain();
115 qRegisterMetaType< QVector<double> > ("QVector<double>");
116 qRegisterMetaType<bncTime> ("bncTime");
117 qRegisterMetaType<t_ephGPS> ("t_ephGPS");
118 qRegisterMetaType<t_ephGlo> ("t_ephGlo");
119 qRegisterMetaType<t_ephGal> ("t_ephGal");
120 qRegisterMetaType<t_ephSBAS> ("t_ephSBAS");
121 qRegisterMetaType<t_ephBDS> ("t_ephBDS");
122 qRegisterMetaType<QList<t_orbCorr> > ("QList<t_orbCorr>");
123 qRegisterMetaType<QList<t_clkCorr> > ("QList<t_clkCorr>");
124 qRegisterMetaType<QList<t_satCodeBias> > ("QList<t_satCodeBias>");
125 qRegisterMetaType<QList<t_satPhaseBias> > ("QList<t_satPhaseBias>");
126 qRegisterMetaType<t_vTec> ("t_vTec");
127}
128
129// Destructor
130////////////////////////////////////////////////////////////////////////////
131t_bncCore::~t_bncCore() {
132 delete _logStream;
133 delete _logFile;
134 delete _ephStreamGPS;
135 delete _ephFileGPS;
136 delete _serverEph;
137 delete _socketsEph;
138 delete _serverCorr;
139 delete _socketsCorr;
140 if (_rinexVers == 2) {
141 delete _ephStreamGlonass;
142 delete _ephFileGlonass;
143 }
144
145 delete _dateAndTimeGPS;
146 delete _rawFile;
147
148#ifdef USE_COMBINATION
149 delete _bncComb;
150#endif
151}
152
153// Write a Program Message
154////////////////////////////////////////////////////////////////////////////
155void t_bncCore::slotMessage(QByteArray msg, bool showOnScreen) {
156
157 QMutexLocker locker(&_mutexMessage);
158
159 messagePrivate(msg);
160 emit newMessage(msg, showOnScreen);
161}
162
163// Write a Program Message (private, no lock)
164////////////////////////////////////////////////////////////////////////////
165void t_bncCore::messagePrivate(const QByteArray& msg) {
166
167 // First time resolve the log file name
168 // ------------------------------------
169 QDate currDate = currentDateAndTimeGPS().date();
170 if (_logFileFlag == 0 || _fileDate != currDate) {
171 delete _logStream; _logStream = 0;
172 delete _logFile; _logFile = 0;
173 _logFileFlag = 1;
174 bncSettings settings;
175 QString logFileName = settings.value("logFile").toString();
176 if ( !logFileName.isEmpty() ) {
177 expandEnvVar(logFileName);
178 _logFile = new QFile(logFileName + "_" +
179 currDate.toString("yyMMdd").toAscii().data());
180 _fileDate = currDate;
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 }
187 _logStream = new QTextStream();
188 _logStream->setDevice(_logFile);
189 }
190 }
191
192 if (_logStream) {
193 QByteArray msgLocal = msg;
194 if (msg.indexOf('\n') == 0) {
195 *_logStream << endl;
196 msgLocal = msg.mid(1);
197 }
198 *_logStream << currentDateAndTimeGPS().toString("yy-MM-dd hh:mm:ss ").toAscii().data();
199 *_logStream << msgLocal.data() << endl;
200 _logStream->flush();
201 _logFile->flush();
202 }
203}
204
205//
206////////////////////////////////////////////////////////////////////////////
207t_irc t_bncCore::checkPrintEph(t_eph* eph) {
208 QMutexLocker locker(&_mutex);
209 t_irc ircPut = _ephUser.putNewEph(eph, true);
210 if (eph->checkState() == t_eph::bad) {
211 messagePrivate("WRONG EPHEMERIS\n" + eph->toString(3.0).toAscii());
212 return failure;
213 }
214 printEphHeader();
215 printEph(*eph, (ircPut == success));
216 return success;
217}
218
219// New GPS Ephemeris
220////////////////////////////////////////////////////////////////////////////
221void t_bncCore::slotNewGPSEph(t_ephGPS eph) {
222 if (checkPrintEph(&eph) == success) {
223 emit newGPSEph(eph);
224 }
225}
226
227// New Glonass Ephemeris
228////////////////////////////////////////////////////////////////////////////
229void t_bncCore::slotNewGlonassEph(t_ephGlo eph) {
230 if (checkPrintEph(&eph) == success) {
231 emit newGlonassEph(eph);
232 }
233}
234
235// New Galileo Ephemeris
236////////////////////////////////////////////////////////////////////////////
237void t_bncCore::slotNewGalileoEph(t_ephGal eph) {
238 if (checkPrintEph(&eph) == success) {
239 emit newGalileoEph(eph);
240 }
241}
242
243// New SBAS Ephemeris
244////////////////////////////////////////////////////////////////////////////
245void t_bncCore::slotNewSBASEph(t_ephSBAS eph) {
246 if (checkPrintEph(&eph) == success) {
247 emit newSBASEph(eph);
248 }
249}
250
251// New BDS Ephemeris
252////////////////////////////////////////////////////////////////////////////
253void t_bncCore::slotNewBDSEph(t_ephBDS eph) {
254 if (checkPrintEph(&eph) == success) {
255 emit newBDSEph(eph);
256 }
257}
258
259// Print Header of the output File(s)
260////////////////////////////////////////////////////////////////////////////
261void t_bncCore::printEphHeader() {
262
263 bncSettings settings;
264
265 // Initialization
266 // --------------
267 if (_rinexVers == 0) {
268
269 if ( Qt::CheckState(settings.value("ephV3").toInt()) == Qt::Checked) {
270 _rinexVers = 3;
271 }
272 else {
273 _rinexVers = 2;
274 }
275
276 _ephPath = settings.value("ephPath").toString();
277
278 if ( !_ephPath.isEmpty() ) {
279 if ( _ephPath[_ephPath.length()-1] != QDir::separator() ) {
280 _ephPath += QDir::separator();
281 }
282 expandEnvVar(_ephPath);
283 }
284 }
285
286 // (Re-)Open output File(s)
287 // ------------------------
288 if (!_ephPath.isEmpty()) {
289
290 QDateTime datTim = currentDateAndTimeGPS();
291
292 QString ephFileNameGPS = _ephPath + "BRDC";
293
294 bool ephV3filenames = settings.value("ephV3filenames").toBool();
295
296 QString hlpStr = bncRinex::nextEpochStr(datTim,
297 settings.value("ephIntr").toString(), ephV3filenames);
298
299 if (_rinexVers == 3) {
300 if (ephV3filenames) {
301 QString country = "WLD";
302 QString monNum = "0";
303 QString recNum = "0";
304 ephFileNameGPS += QString("%1").arg(monNum, 1, 10) +
305 QString("%1").arg(recNum, 1, 10) +
306 country +
307 "_S_" + // stream
308 QString("%1").arg(datTim.date().year()) +
309 QString("%1").arg(datTim.date().dayOfYear(), 3, 10, QChar('0')) +
310 hlpStr + // HMS_period
311 "_MN.rnx"; // mixed BRDC
312 }
313 else { // RNX v3 with old filenames
314 ephFileNameGPS += QString("%1").arg(datTim.date().dayOfYear(), 3, 10, QChar('0')) +
315 hlpStr + datTim.toString(".yyP");
316 }
317 }
318 else { // RNX v2.11
319 ephFileNameGPS += QString("%1").arg(datTim.date().dayOfYear(), 3, 10, QChar('0')) +
320 hlpStr + datTim.toString(".yyN");
321 }
322
323 if (_ephFileNameGPS == ephFileNameGPS) {
324 return;
325 }
326 else {
327 _ephFileNameGPS = ephFileNameGPS;
328 }
329
330 delete _ephStreamGPS;
331 delete _ephFileGPS;
332
333 QFlags<QIODevice::OpenModeFlag> appendFlagGPS;
334 QFlags<QIODevice::OpenModeFlag> appendFlagGlonass;
335
336 if ( Qt::CheckState(settings.value("rnxAppend").toInt()) == Qt::Checked &&
337 QFile::exists(ephFileNameGPS) ) {
338 appendFlagGPS = QIODevice::Append;
339 }
340
341 _ephFileGPS = new QFile(ephFileNameGPS);
342 _ephFileGPS->open(QIODevice::WriteOnly | appendFlagGPS);
343 _ephStreamGPS = new QTextStream();
344 _ephStreamGPS->setDevice(_ephFileGPS);
345
346 if (_rinexVers == 3) {
347 _ephFileGlonass = _ephFileGPS;
348 _ephStreamGlonass = _ephStreamGPS;
349 _ephFileGalileo = _ephFileGPS;
350 _ephStreamGalileo = _ephStreamGPS;
351 _ephFileSBAS = _ephFileGPS;
352 _ephStreamSBAS = _ephStreamGPS;
353 }
354 else if (_rinexVers == 2) {
355 QString ephFileNameGlonass = _ephPath + "BRDC" +
356 QString("%1").arg(datTim.date().dayOfYear(), 3, 10, QChar('0')) +
357 hlpStr + datTim.toString(".yyG");
358
359 delete _ephStreamGlonass;
360 delete _ephFileGlonass;
361
362 if ( Qt::CheckState(settings.value("rnxAppend").toInt()) == Qt::Checked &&
363 QFile::exists(ephFileNameGlonass) ) {
364 appendFlagGlonass = QIODevice::Append;
365 }
366
367 _ephFileGlonass = new QFile(ephFileNameGlonass);
368 _ephFileGlonass->open(QIODevice::WriteOnly | appendFlagGlonass);
369 _ephStreamGlonass = new QTextStream();
370 _ephStreamGlonass->setDevice(_ephFileGlonass);
371 }
372
373 // Header - RINEX Version 3
374 // ------------------------
375 if (_rinexVers == 3) {
376 if ( ! (appendFlagGPS & QIODevice::Append)) {
377 QString line;
378 line.sprintf(
379 "%9.2f%11sN: GNSS NAV DATA M: Mixed%12sRINEX VERSION / TYPE\n",
380 3.0, "", "");
381 *_ephStreamGPS << line;
382
383 QString hlp = currentDateAndTimeGPS().toString("yyyyMMdd hhmmss UTC").leftJustified(20, ' ', true);
384 *_ephStreamGPS << _pgmName.toAscii().data()
385 << _userName.toAscii().data()
386 << hlp.toAscii().data()
387 << "PGM / RUN BY / DATE" << endl;
388
389 line.sprintf("%60sEND OF HEADER\n", "");
390 *_ephStreamGPS << line;
391
392 _ephStreamGPS->flush();
393 }
394 }
395
396 // Headers - RINEX Version 2
397 // -------------------------
398 else if (_rinexVers == 2) {
399 if (! (appendFlagGPS & QIODevice::Append)) {
400 QString line;
401 line.sprintf("%9.2f%11sN: GPS NAV DATA%25sRINEX VERSION / TYPE\n",
402 t_rnxNavFile::defaultRnxNavVersion2, "", "");
403 *_ephStreamGPS << line;
404
405 QString hlp = currentDateAndTimeGPS().date().toString("dd-MMM-yyyy").leftJustified(20, ' ', true);
406 *_ephStreamGPS << _pgmName.toAscii().data()
407 << _userName.toAscii().data()
408 << hlp.toAscii().data()
409 << "PGM / RUN BY / DATE" << endl;
410
411 line.sprintf("%60sEND OF HEADER\n", "");
412 *_ephStreamGPS << line;
413
414 _ephStreamGPS->flush();
415 }
416 if (! (appendFlagGlonass & QIODevice::Append)) {
417 QString line;
418 line.sprintf("%9.2f%11sG: GLONASS NAV DATA%21sRINEX VERSION / TYPE\n",
419 t_rnxNavFile::defaultRnxNavVersion2, "", "");
420 *_ephStreamGlonass << line;
421
422 QString hlp = currentDateAndTimeGPS().date().toString("dd-MMM-yyyy").leftJustified(20, ' ', true);
423 *_ephStreamGlonass << _pgmName.toAscii().data()
424 << _userName.toAscii().data()
425 << hlp.toAscii().data()
426 << "PGM / RUN BY / DATE" << endl;
427
428 line.sprintf("%60sEND OF HEADER\n", "");
429 *_ephStreamGlonass << line;
430
431 _ephStreamGlonass->flush();
432 }
433 }
434 }
435}
436
437// Print One Ephemeris
438////////////////////////////////////////////////////////////////////////////
439void t_bncCore::printEph(const t_eph& eph, bool printFile) {
440
441 QString strV2 = eph.toString(t_rnxNavFile::defaultRnxNavVersion2);
442 QString strV3 = eph.toString(t_rnxObsHeader::defaultRnxObsVersion3);
443
444 if (_rinexVers == 2 && eph.type() == t_eph::GLONASS) {
445 printOutputEph(printFile, _ephStreamGlonass, strV2, strV3);
446 }
447 else if(_rinexVers == 2 && eph.type() == t_eph::GPS) {
448 printOutputEph(printFile, _ephStreamGPS, strV2, strV3);
449 }
450 else if (_rinexVers == 3) {
451 printOutputEph(printFile, _ephStreamGPS, strV2, strV3);
452 }
453}
454
455// Output
456////////////////////////////////////////////////////////////////////////////
457void t_bncCore::printOutputEph(bool printFile, QTextStream* stream,
458 const QString& strV2, const QString& strV3) {
459
460 // Output into file
461 // ----------------
462 if (printFile && stream) {
463 if (_rinexVers == 2) {
464 *stream << strV2.toAscii();
465 }
466 else {
467 *stream << strV3.toAscii();
468 }
469 stream->flush();
470 }
471
472 // Output into the socket
473 // ----------------------
474 if (_socketsEph) {
475 QMutableListIterator<QTcpSocket*> is(*_socketsEph);
476 while (is.hasNext()) {
477 QTcpSocket* sock = is.next();
478 if (sock->state() == QAbstractSocket::ConnectedState) {
479 if (sock->write(strV3.toAscii()) == -1) {
480 delete sock;
481 is.remove();
482 }
483 }
484 else if (sock->state() != QAbstractSocket::ConnectingState) {
485 delete sock;
486 is.remove();
487 }
488 }
489 }
490}
491
492// Set Port Number
493////////////////////////////////////////////////////////////////////////////
494void t_bncCore::setPortEph(int port) {
495 _portEph = port;
496 if (_portEph != 0) {
497 delete _serverEph;
498 _serverEph = new QTcpServer;
499 if ( !_serverEph->listen(QHostAddress::Any, _portEph) ) {
500 slotMessage("t_bncCore: Cannot listen on ephemeris port", true);
501 }
502 connect(_serverEph, SIGNAL(newConnection()), this, SLOT(slotNewConnectionEph()));
503 delete _socketsEph;
504 _socketsEph = new QList<QTcpSocket*>;
505 }
506}
507
508// Set Port Number
509////////////////////////////////////////////////////////////////////////////
510void t_bncCore::setPortCorr(int port) {
511 _portCorr = port;
512 if (_portCorr != 0) {
513 delete _serverCorr;
514 _serverCorr = new QTcpServer;
515 if ( !_serverCorr->listen(QHostAddress::Any, _portCorr) ) {
516 slotMessage("t_bncCore: Cannot listen on correction port", true);
517 }
518 connect(_serverCorr, SIGNAL(newConnection()), this, SLOT(slotNewConnectionCorr()));
519 delete _socketsCorr;
520 _socketsCorr = new QList<QTcpSocket*>;
521 }
522}
523
524// New Connection
525////////////////////////////////////////////////////////////////////////////
526void t_bncCore::slotNewConnectionEph() {
527 _socketsEph->push_back( _serverEph->nextPendingConnection() );
528}
529
530// New Connection
531////////////////////////////////////////////////////////////////////////////
532void t_bncCore::slotNewConnectionCorr() {
533 _socketsCorr->push_back( _serverCorr->nextPendingConnection() );
534}
535
536//
537////////////////////////////////////////////////////////////////////////////
538void t_bncCore::slotQuit() {
539 delete _caster; _caster = 0;
540 qApp->quit();
541}
542
543//
544////////////////////////////////////////////////////////////////////////////
545void t_bncCore::slotNewOrbCorrections(QList<t_orbCorr> orbCorrections) {
546 QMutexLocker locker(&_mutex);
547 emit newOrbCorrections(orbCorrections);
548 if (_socketsCorr) {
549 ostringstream out;
550 t_orbCorr::writeEpoch(&out, orbCorrections);
551 QMutableListIterator<QTcpSocket*> is(*_socketsCorr);
552 while (is.hasNext()) {
553 QTcpSocket* sock = is.next();
554 if (sock->state() == QAbstractSocket::ConnectedState) {
555 if (sock->write(out.str().c_str()) == -1) {
556 delete sock;
557 is.remove();
558 }
559 }
560 else if (sock->state() != QAbstractSocket::ConnectingState) {
561 delete sock;
562 is.remove();
563 }
564 }
565 }
566}
567
568//
569////////////////////////////////////////////////////////////////////////////
570void t_bncCore::slotNewClkCorrections(QList<t_clkCorr> clkCorrections) {
571 QMutexLocker locker(&_mutex);
572 emit newClkCorrections(clkCorrections);
573 if (_socketsCorr) {
574 ostringstream out;
575 t_clkCorr::writeEpoch(&out, clkCorrections);
576 QMutableListIterator<QTcpSocket*> is(*_socketsCorr);
577 while (is.hasNext()) {
578 QTcpSocket* sock = is.next();
579 if (sock->state() == QAbstractSocket::ConnectedState) {
580 if (sock->write(out.str().c_str()) == -1) {
581 delete sock;
582 is.remove();
583 }
584 }
585 else if (sock->state() != QAbstractSocket::ConnectingState) {
586 delete sock;
587 is.remove();
588 }
589 }
590 }
591}
592
593//
594////////////////////////////////////////////////////////////////////////////
595void t_bncCore::slotNewCodeBiases(QList<t_satCodeBias> codeBiases) {
596 QMutexLocker locker(&_mutex);
597 emit newCodeBiases(codeBiases);
598 if (_socketsCorr) {
599 ostringstream out;
600 t_satCodeBias::writeEpoch(&out, codeBiases);
601 QMutableListIterator<QTcpSocket*> is(*_socketsCorr);
602 while (is.hasNext()) {
603 QTcpSocket* sock = is.next();
604 if (sock->state() == QAbstractSocket::ConnectedState) {
605 if (sock->write(out.str().c_str()) == -1) {
606 delete sock;
607 is.remove();
608 }
609 }
610 else if (sock->state() != QAbstractSocket::ConnectingState) {
611 delete sock;
612 is.remove();
613 }
614 }
615 }
616}
617
618//
619////////////////////////////////////////////////////////////////////////////
620void t_bncCore::slotNewPhaseBiases(QList<t_satPhaseBias> phaseBiases) {
621 QMutexLocker locker(&_mutex);
622 emit newPhaseBiases(phaseBiases);
623 if (_socketsCorr) {
624 ostringstream out;
625 t_satPhaseBias::writeEpoch(&out, phaseBiases);
626 QMutableListIterator<QTcpSocket*> is(*_socketsCorr);
627 while (is.hasNext()) {
628 QTcpSocket* sock = is.next();
629 if (sock->state() == QAbstractSocket::ConnectedState) {
630 if (sock->write(out.str().c_str()) == -1) {
631 delete sock;
632 is.remove();
633 }
634 }
635 else if (sock->state() != QAbstractSocket::ConnectingState) {
636 delete sock;
637 is.remove();
638 }
639 }
640 }
641}
642
643//
644////////////////////////////////////////////////////////////////////////////
645void t_bncCore::slotNewTec(t_vTec vTec) {
646 QMutexLocker locker(&_mutex);
647 emit newTec(vTec);
648 if (_socketsCorr) {
649 ostringstream out;
650 t_vTec::write(&out, vTec);
651 QMutableListIterator<QTcpSocket*> is(*_socketsCorr);
652 while (is.hasNext()) {
653 QTcpSocket* sock = is.next();
654 if (sock->state() == QAbstractSocket::ConnectedState) {
655 if (sock->write(out.str().c_str()) == -1) {
656 delete sock;
657 is.remove();
658 }
659 }
660 else if (sock->state() != QAbstractSocket::ConnectingState) {
661 delete sock;
662 is.remove();
663 }
664 }
665 }
666}
667
668//
669////////////////////////////////////////////////////////////////////////////
670void t_bncCore::setConfFileName(const QString& confFileName) {
671 if (confFileName.isEmpty()) {
672 _confFileName = QDir::homePath() + QDir::separator()
673 + ".config" + QDir::separator()
674 + qApp->organizationName() + QDir::separator()
675 + qApp->applicationName() + ".bnc";
676 }
677 else {
678 _confFileName = confFileName;
679 }
680}
681
682// Raw Output
683////////////////////////////////////////////////////////////////////////////
684void t_bncCore::writeRawData(const QByteArray& data, const QByteArray& staID,
685 const QByteArray& format) {
686
687 QMutexLocker locker(&_mutex);
688
689 if (!_rawFile) {
690 bncSettings settings;
691 QByteArray fileName = settings.value("rawOutFile").toByteArray();
692 if (!fileName.isEmpty()) {
693 _rawFile = new bncRawFile(fileName, staID, bncRawFile::output);
694 }
695 }
696
697 if (_rawFile) {
698 _rawFile->writeRawData(data, staID, format);
699 }
700}
701
702//
703////////////////////////////////////////////////////////////////////////////
704void t_bncCore::initCombination() {
705#ifdef USE_COMBINATION
706 _bncComb = new bncComb();
707 if (_bncComb->nStreams() < 1) {
708 delete _bncComb;
709 _bncComb = 0;
710 }
711#endif
712}
713
714//
715////////////////////////////////////////////////////////////////////////////
716void t_bncCore::stopCombination() {
717#ifdef USE_COMBINATION
718 delete _bncComb;
719 _bncComb = 0;
720#endif
721}
722
723//
724////////////////////////////////////////////////////////////////////////////
725bool t_bncCore::dateAndTimeGPSSet() const {
726 QMutexLocker locker(&_mutexDateAndTimeGPS);
727 if (_dateAndTimeGPS) {
728 return true;
729 }
730 else {
731 return false;
732 }
733}
734
735//
736////////////////////////////////////////////////////////////////////////////
737QDateTime t_bncCore::dateAndTimeGPS() const {
738 QMutexLocker locker(&_mutexDateAndTimeGPS);
739 if (_dateAndTimeGPS) {
740 return *_dateAndTimeGPS;
741 }
742 else {
743 return QDateTime();
744 }
745}
746
747//
748////////////////////////////////////////////////////////////////////////////
749void t_bncCore::setDateAndTimeGPS(QDateTime dateTime) {
750 QMutexLocker locker(&_mutexDateAndTimeGPS);
751 delete _dateAndTimeGPS;
752 _dateAndTimeGPS = new QDateTime(dateTime);
753}
754
755//
756////////////////////////////////////////////////////////////////////////////
757void t_bncCore::startPPP() {
758 _pppMain->start();
759}
760
761//
762////////////////////////////////////////////////////////////////////////////
763void t_bncCore::stopPPP() {
764 _pppMain->stop();
765 emit stopRinexPPP();
766}
767
Note: See TracBrowser for help on using the repository browser.