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

Last change on this file since 7971 was 7856, checked in by stuerze, 9 years ago

minor changes to allow a clean end of program

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