source: ntrip/trunk/BNC/bnczerodecoder.cpp@ 427

Last change on this file since 427 was 427, checked in by mervart, 17 years ago

* empty log message *

File size: 2.2 KB
Line 
1// Part of BNC, a utility for retrieving decoding and
2// converting GNSS data streams from NTRIP broadcasters,
3// written by Leos Mervart.
4//
5// Copyright (C) 2006
6// German Federal Agency for Cartography and Geodesy (BKG)
7// http://www.bkg.bund.de
8// Czech Technical University Prague, Department of Advanced Geodesy
9// http://www.fsv.cvut.cz
10//
11// Email: euref-ip@bkg.bund.de
12//
13// This program is free software; you can redistribute it and/or
14// modify it under the terms of the GNU General Public License
15// as published by the Free Software Foundation, version 2.
16//
17// This program is distributed in the hope that it will be useful,
18// but WITHOUT ANY WARRANTY; without even the implied warranty of
19// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20// GNU General Public License for more details.
21//
22// You should have received a copy of the GNU General Public License
23// along with this program; if not, write to the Free Software
24// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
25
26#include <iostream>
27#include "bnczerodecoder.h"
28#include "bncutils.h"
29
30using namespace std;
31
32// Constructor
33////////////////////////////////////////////////////////////////////////
34bncZeroDecoder::bncZeroDecoder(const QString& fileName) {
35 QSettings settings;
36 QString path = settings.value("rnxPath").toString();
37 expandEnvVar(path);
38
39 if ( path.length() > 0 && path[path.length()-1] != QDir::separator() ) {
40 path += QDir::separator();
41 }
42
43 _fileName = path + fileName;
44
45 _out = 0;
46 reopen();
47}
48
49// Destructor
50////////////////////////////////////////////////////////////////////////
51bncZeroDecoder::~bncZeroDecoder() {
52 delete _out;
53}
54
55// Reopen Output File
56////////////////////////////////////////////////////////////////////////
57void bncZeroDecoder::reopen() {
58 QDate currDate = QDate::currentDate();
59 if (!_out || _fileDate != currDate) {
60 delete _out;
61 _out = new ofstream( (_fileName + "_" +
62 currDate.toString("yyMMdd")).toAscii().data() );
63 _fileDate = currDate;
64 }
65}
66
67// Decode Method
68////////////////////////////////////////////////////////////////////////
69void bncZeroDecoder::Decode(char* buffer, int bufLen) {
70 reopen();
71 _out->write(buffer, bufLen);
72 _out->flush();
73}
74
Note: See TracBrowser for help on using the repository browser.