[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 |
|
---|
| 41 | #include <iostream>
|
---|
[149] | 42 | #include <QSettings>
|
---|
[150] | 43 | #include <QMessageBox>
|
---|
[82] | 44 |
|
---|
| 45 | #include "bncapp.h"
|
---|
[151] | 46 | #include "bncutils.h"
|
---|
[82] | 47 |
|
---|
| 48 | using namespace std;
|
---|
| 49 |
|
---|
| 50 | // Constructor
|
---|
| 51 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 52 | bncApp::bncApp(int argc, char* argv[], bool GUIenabled) :
|
---|
| 53 | QApplication(argc, argv, GUIenabled) {
|
---|
[109] | 54 |
|
---|
[150] | 55 | _logFileFlag = 0;
|
---|
| 56 | _logFile = 0;
|
---|
| 57 | _logStream = 0;
|
---|
[152] | 58 |
|
---|
[476] | 59 | _bncVersion = "BNC 1.4";
|
---|
[82] | 60 | }
|
---|
| 61 |
|
---|
| 62 | // Destructor
|
---|
| 63 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 64 | bncApp::~bncApp() {
|
---|
[109] | 65 | delete _logStream;
|
---|
| 66 | delete _logFile;
|
---|
[82] | 67 | }
|
---|
| 68 |
|
---|
| 69 | // Write a Program Message
|
---|
| 70 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 71 | void bncApp::slotMessage(const QByteArray msg) {
|
---|
[150] | 72 |
|
---|
[243] | 73 | QMutexLocker locker(&_mutex);
|
---|
| 74 |
|
---|
[150] | 75 | // First time resolve the log file name
|
---|
| 76 | // ------------------------------------
|
---|
| 77 | if (_logFileFlag == 0) {
|
---|
| 78 | _logFileFlag = 1;
|
---|
| 79 | QSettings settings;
|
---|
| 80 | QString logFileName = settings.value("logFile").toString();
|
---|
| 81 | if ( !logFileName.isEmpty() ) {
|
---|
[151] | 82 | expandEnvVar(logFileName);
|
---|
[150] | 83 | _logFile = new QFile(logFileName);
|
---|
[275] | 84 | if ( Qt::CheckState(settings.value("rnxAppend").toInt()) == Qt::Checked) {
|
---|
| 85 | _logFile->open(QIODevice::WriteOnly | QIODevice::Append);
|
---|
| 86 | }
|
---|
| 87 | else {
|
---|
| 88 | _logFile->open(QIODevice::WriteOnly);
|
---|
| 89 | }
|
---|
[150] | 90 | _logStream = new QTextStream();
|
---|
| 91 | _logStream->setDevice(_logFile);
|
---|
| 92 | }
|
---|
| 93 | }
|
---|
| 94 |
|
---|
[109] | 95 | if (_logStream) {
|
---|
[335] | 96 | *_logStream << QDate::currentDate().toString("yy-MM-dd ").toAscii().data();
|
---|
[199] | 97 | *_logStream << QTime::currentTime().toString("hh:mm:ss ").toAscii().data();
|
---|
[109] | 98 | *_logStream << msg.data() << endl;
|
---|
| 99 | _logStream->flush();
|
---|
[82] | 100 | }
|
---|
| 101 | }
|
---|
[511] | 102 |
|
---|
| 103 | //
|
---|
| 104 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 105 | void bncApp::slotNewGPSEph(gpsephemeris* gpseph) {
|
---|
[512] | 106 | cout << "GPS: " << gpseph->satellite << endl;
|
---|
| 107 | delete gpseph;
|
---|
[511] | 108 | }
|
---|
| 109 |
|
---|
| 110 | //
|
---|
| 111 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 112 | void bncApp::slotNewGlonassEph(glonassephemeris* glonasseph) {
|
---|
[512] | 113 | cout << "GLONASS: " << glonasseph->almanac_number << endl;
|
---|
| 114 | delete glonasseph;
|
---|
[511] | 115 | }
|
---|
| 116 |
|
---|