source: ntrip/trunk/BNC/bncapp.cpp@ 512

Last change on this file since 512 was 512, checked in by mervart, 15 years ago

* empty log message *

File size: 3.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: 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>
42#include <QSettings>
43#include <QMessageBox>
44
45#include "bncapp.h"
46#include "bncutils.h"
47
48using namespace std;
49
50// Constructor
51////////////////////////////////////////////////////////////////////////////
52bncApp::bncApp(int argc, char* argv[], bool GUIenabled) :
53 QApplication(argc, argv, GUIenabled) {
54
55 _logFileFlag = 0;
56 _logFile = 0;
57 _logStream = 0;
58
59 _bncVersion = "BNC 1.4";
60}
61
62// Destructor
63////////////////////////////////////////////////////////////////////////////
64bncApp::~bncApp() {
65 delete _logStream;
66 delete _logFile;
67}
68
69// Write a Program Message
70////////////////////////////////////////////////////////////////////////////
71void bncApp::slotMessage(const QByteArray msg) {
72
73 QMutexLocker locker(&_mutex);
74
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() ) {
82 expandEnvVar(logFileName);
83 _logFile = new QFile(logFileName);
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 }
90 _logStream = new QTextStream();
91 _logStream->setDevice(_logFile);
92 }
93 }
94
95 if (_logStream) {
96 *_logStream << QDate::currentDate().toString("yy-MM-dd ").toAscii().data();
97 *_logStream << QTime::currentTime().toString("hh:mm:ss ").toAscii().data();
98 *_logStream << msg.data() << endl;
99 _logStream->flush();
100 }
101}
102
103//
104////////////////////////////////////////////////////////////////////////////
105void bncApp::slotNewGPSEph(gpsephemeris* gpseph) {
106 cout << "GPS: " << gpseph->satellite << endl;
107 delete gpseph;
108}
109
110//
111////////////////////////////////////////////////////////////////////////////
112void bncApp::slotNewGlonassEph(glonassephemeris* glonasseph) {
113 cout << "GLONASS: " << glonasseph->almanac_number << endl;
114 delete glonasseph;
115}
116
Note: See TracBrowser for help on using the repository browser.