source: ntrip/trunk/BNC/src/RTCM/GPSDecoder.cpp@ 4434

Last change on this file since 4434 was 4434, checked in by mervart, 12 years ago
File size: 3.8 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: GPSDecoder
30 *
31 * Purpose: Decoder Base Class
32 *
33 * Author: L. Mervart
34 *
35 * Created: 16-Dec-2011
36 *
37 * Changes:
38 *
39 * -----------------------------------------------------------------------*/
40
41#include <iomanip>
42#include <cmath>
43
44#include "GPSDecoder.h"
45#include "bncsettings.h"
46
47#include "rtcm3torinexsupport.h"
48
49using namespace std;
50
51// Constructor
52//////////////////////////////////////////////////////////////////////////////
53GPSDecoder::GPSDecoder() {
54 _rnx = 0;
55}
56
57// Initialize RINEX Writer
58//////////////////////////////////////////////////////////////////////////////
59void GPSDecoder::initRinex(const QByteArray& staID, const QUrl& mountPoint,
60 const QByteArray& latitude,
61 const QByteArray& longitude, const QByteArray& nmea,
62 const QByteArray& ntripVersion) {
63 if (_rnx) {
64 return;
65 }
66 bncSettings settings;
67 if ( !settings.value("rnxPath").toString().isEmpty() ) {
68 _rnx = new bncRinex(staID, mountPoint, latitude, longitude,
69 nmea, ntripVersion);
70 }
71}
72
73// Write RINEX Epoch
74//////////////////////////////////////////////////////////////////////////////
75void GPSDecoder::dumpRinexEpoch(const t_obs& obs, const QByteArray& format) {
76 if (_rnx) {
77 long iSec = long(floor(obs.GPSWeeks+0.5));
78 long obsTime = obs.GPSWeek * 7*24*3600 + iSec;
79 if (_rnx->samplingRate() == 0 || iSec % _rnx->samplingRate() == 0) {
80 _rnx->deepCopy(obs);
81 }
82 _rnx->dumpEpoch(format, obsTime);
83 }
84}
85
86// Set RINEX Reconnect Flag
87//////////////////////////////////////////////////////////////////////////////
88void GPSDecoder::setRinexReconnectFlag(bool flag) {
89 if (_rnx) {
90 _rnx->setReconnectFlag(flag);
91 }
92}
93
94//
95//////////////////////////////////////////////////////////////////////////////
96void t_obs::setMeasdata(const QString& rnxStr, float rnxVers, double value) {
97 int ie = iEntry(rnxStr, rnxVers);
98 if (ie != -1) {
99 _measdata[ie] = value;
100 }
101}
102
103//
104//////////////////////////////////////////////////////////////////////////////
105double t_obs::measdata(const QString& rnxStr, float rnxVers) const {
106 int ie = iEntry(rnxStr, rnxVers);
107 if (ie != -1) {
108 return _measdata[ie];
109 }
110 else {
111 return 0.0;
112 }
113}
114
115//
116//////////////////////////////////////////////////////////////////////////////
117int t_obs::iEntry(QString rnxStr, float rnxVers) const {
118
119 if (rnxVers < 3.0) {
120 if (rnxStr == "C1") rnxStr = "C1C";
121 else if (rnxStr == "P1") rnxStr = "C1P";
122 else if (rnxStr == "C2") rnxStr = "C2C";
123 else if (rnxStr == "P2") rnxStr = "C2P";
124 }
125
126 return rrinex3codetoentry(rnxStr.toAscii().data());
127}
Note: See TracBrowser for help on using the repository browser.