source: ntrip/trunk/BNC/bncpostprocess.cpp@ 3689

Last change on this file since 3689 was 3689, checked in by mervart, 12 years ago
File size: 4.6 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: t_postProcessing
30 *
31 * Purpose: Precise Point Positioning in Post-Processing Mode
32 *
33 * Author: L. Mervart
34 *
35 * Created: 22-Jan-2012
36 *
37 * Changes:
38 *
39 * -----------------------------------------------------------------------*/
40
41#include <iostream>
42#include "bncpostprocess.h"
43#include "bncapp.h"
44#include "bncsettings.h"
45#include "pppopt.h"
46#include "bncpppclient.h"
47#include "rnxobsfile.h"
48#include "rnxnavfile.h"
49#include "corrfile.h"
50
51using namespace std;
52
53// Constructor
54////////////////////////////////////////////////////////////////////////////
55t_postProcessing::t_postProcessing(QObject* parent) : QThread(parent) {
56 _opt = new t_pppOpt();
57 _rnxObsFile = 0;
58 _rnxNavFile = 0;
59 _corrFile = 0;
60 _pppClient = 0;
61}
62
63// Destructor
64////////////////////////////////////////////////////////////////////////////
65t_postProcessing::~t_postProcessing() {
66 delete _pppClient;
67 delete _rnxNavFile;
68 delete _rnxObsFile;
69 delete _corrFile;
70 delete _opt;
71}
72
73// Write a Program Message
74////////////////////////////////////////////////////////////////////////////
75void t_postProcessing::slotMessage(QByteArray msg, bool /* showOnScreen */) {
76 ((bncApp*) qApp)->slotMessage(msg, false);
77}
78
79//
80////////////////////////////////////////////////////////////////////////////
81void t_postProcessing::run() {
82
83 if (_pppClient) {
84 return;
85 }
86 else {
87 _rnxObsFile = new t_rnxObsFile(_opt->obsFileName);
88 _rnxNavFile = new t_rnxNavFile(_opt->navFileName);
89 _pppClient = new bncPPPclient("POST", _opt, false);
90
91 if (!_opt->corrFileName.isEmpty()) {
92 _corrFile = new t_corrFile(_opt->corrFileName);
93 connect(_corrFile, SIGNAL(newCorrections(QList<QString>)),
94 _pppClient, SLOT(slotNewCorrections(QList<QString>)));
95 }
96
97 connect(_pppClient, SIGNAL(newMessage(QByteArray,bool)),
98 this, SLOT(slotMessage(const QByteArray,bool)));
99 }
100
101 // Read Ephemerides
102 // ----------------
103 t_eph* eph = 0;
104 while ( (eph = _rnxNavFile->getNextEph()) != 0 ) {
105 if (_pppClient->putNewEph(eph) != success) {
106 delete eph; eph = 0;
107 }
108 }
109
110 // Read/Process Observations
111 // -------------------------
112 int nEpo = 0;
113 const t_rnxObsFile::t_epo* epo = 0;
114 while ( (epo = _rnxObsFile->nextEpoch()) != 0 ) {
115 ++nEpo;
116
117 if (_corrFile) {
118 _corrFile->syncRead(epo->tt);
119 }
120
121 for (int iObs = 0; iObs < epo->satObs.size(); iObs++) {
122 const t_rnxObsFile::t_satObs& satObs = epo->satObs[iObs];
123 t_obs obs;
124 strncpy(obs.StatID, _rnxObsFile->markerName().toAscii().constData(),
125 sizeof(obs.StatID));
126 obs.satSys = satObs.prn.toAscii().data()[0];
127 obs.satNum = satObs.prn.mid(1).toInt();
128 obs.GPSWeek = epo->tt.gpsw();
129 obs.GPSWeeks = epo->tt.gpssec();
130 for (int iType = 0; iType < _rnxObsFile->nTypes(); iType++) {
131 QByteArray type = _rnxObsFile->obsType(iType).toAscii();
132 if (type == "C1") {
133 obs.C1 = satObs[iType];
134 }
135 else if (type == "P1") {
136 obs.P1 = satObs[iType];
137 }
138 else if (type == "L1") {
139 obs.L1C = satObs[iType];
140 }
141 else if (type == "C2") {
142 obs.C2 = satObs[iType];
143 }
144 else if (type == "P2") {
145 obs.P2 = satObs[iType];
146 }
147 else if (type == "L2") {
148 obs.L2C = satObs[iType];
149 }
150 }
151 _pppClient->putNewObs(obs);
152 }
153 if (nEpo % 10 == 0) {
154 emit progress(nEpo);
155 }
156 }
157
158 emit finished();
159 deleteLater();
160}
Note: See TracBrowser for help on using the repository browser.