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 |
|
---|
30 | using namespace std;
|
---|
31 |
|
---|
32 | // Constructor
|
---|
33 | ////////////////////////////////////////////////////////////////////////
|
---|
34 | bncZeroDecoder::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 | reopen();
|
---|
46 | }
|
---|
47 |
|
---|
48 | // Destructor
|
---|
49 | ////////////////////////////////////////////////////////////////////////
|
---|
50 | bncZeroDecoder::~bncZeroDecoder() {
|
---|
51 | _out.close();
|
---|
52 | }
|
---|
53 |
|
---|
54 | // Reopen Output File
|
---|
55 | ////////////////////////////////////////////////////////////////////////
|
---|
56 | void bncZeroDecoder::reopen() {
|
---|
57 | QDate currDate = QDate::currentDate();
|
---|
58 | if (!_fileDate.isValid() || _fileDate != currDate) {
|
---|
59 | _out.close();
|
---|
60 | _out.open( (_fileName + "_" + currDate.toString("yyMMdd")).toAscii().data());
|
---|
61 | _fileDate = currDate;
|
---|
62 | }
|
---|
63 | }
|
---|
64 |
|
---|
65 | // Decode Method
|
---|
66 | ////////////////////////////////////////////////////////////////////////
|
---|
67 | void bncZeroDecoder::Decode(char* buffer, int bufLen) {
|
---|
68 | reopen();
|
---|
69 | _out.write(buffer, bufLen);
|
---|
70 | _out.flush();
|
---|
71 | }
|
---|
72 |
|
---|