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

Last change on this file since 7644 was 7505, checked in by stuerze, 9 years ago

small bug in rinex v3 file name generation fixed

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