source: ntrip/trunk/BNC/src/bnczerodecoder.cpp@ 10548

Last change on this file since 10548 was 10503, checked in by stuerze, 5 months ago

add an docoder-string ZERO2FILE

File size: 3.0 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: bncZeroDecoder
30 *
31 * Purpose: Implementation of zero decoder to by-pass decoding algorithm
32 *
33 * Author: L. Mervart
34 *
35 * Created: 24-Apr-2007
36 *
37 * Changes:
38 *
39 * -----------------------------------------------------------------------*/
40
41#include <iostream>
42#include "bnczerodecoder.h"
43#include "bncutils.h"
44#include "bncsettings.h"
45
46using namespace std;
47
48// Constructor
49////////////////////////////////////////////////////////////////////////
50bncZeroDecoder::bncZeroDecoder(const QString& fileName, bool writeFile) {
51 _writeFile = writeFile;
52
53 if (_writeFile) {
54 bncSettings settings;
55 QString path = settings.value("rnxPath").toString();
56 expandEnvVar(path);
57
58 if ( path.length() > 0 && path[path.length()-1] != QDir::separator() ) {
59 path += QDir::separator();
60 }
61
62 _fileName = path + fileName;
63 }
64
65 _out = 0;
66}
67
68// Destructor
69////////////////////////////////////////////////////////////////////////
70bncZeroDecoder::~bncZeroDecoder() {
71 delete _out;
72}
73
74// Reopen Output File
75////////////////////////////////////////////////////////////////////////
76void bncZeroDecoder::reopen() {
77 QDate currDate = currentDateAndTimeGPS().date();
78 if (!_out || _fileDate != currDate) {
79 delete _out;
80 QByteArray fileName =
81 (_fileName + "_" + currDate.toString("yyMMdd")).toLatin1();
82 bncSettings settings;
83 if (Qt::CheckState(settings.value("rnxAppend").toInt()) == Qt::Checked) {
84 _out = new ofstream(fileName.data(), ios::out | ios::app);
85 }
86 else {
87 _out = new ofstream(fileName.data());
88 }
89 _fileDate = currDate;
90 }
91}
92
93// Decode Method
94////////////////////////////////////////////////////////////////////////
95t_irc bncZeroDecoder::Decode(char* buffer, int bufLen, vector<string>& errmsg) {
96 errmsg.clear();
97 if (_writeFile) {
98 reopen();
99 _out->write(buffer, bufLen);
100 _out->flush();
101 }
102 return success;
103}
104
Note: See TracBrowser for help on using the repository browser.