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

Last change on this file since 3688 was 3688, checked in by mervart, 12 years ago
File size: 4.5 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 for (int iObs = 0; iObs < epo->satObs.size(); iObs++) {
117 const t_rnxObsFile::t_satObs& satObs = epo->satObs[iObs];
118 t_obs obs;
119 strncpy(obs.StatID, _rnxObsFile->markerName().toAscii().constData(),
120 sizeof(obs.StatID));
121 obs.satSys = satObs.prn.toAscii().data()[0];
122 obs.satNum = satObs.prn.mid(1).toInt();
123 obs.GPSWeek = epo->tt.gpsw();
124 obs.GPSWeeks = epo->tt.gpssec();
125 for (int iType = 0; iType < _rnxObsFile->nTypes(); iType++) {
126 QByteArray type = _rnxObsFile->obsType(iType).toAscii();
127 if (type == "C1") {
128 obs.C1 = satObs[iType];
129 }
130 else if (type == "P1") {
131 obs.P1 = satObs[iType];
132 }
133 else if (type == "L1") {
134 obs.L1C = satObs[iType];
135 }
136 else if (type == "C2") {
137 obs.C2 = satObs[iType];
138 }
139 else if (type == "P2") {
140 obs.P2 = satObs[iType];
141 }
142 else if (type == "L2") {
143 obs.L2C = satObs[iType];
144 }
145 }
146 _pppClient->putNewObs(obs);
147 }
148 if (nEpo % 10 == 0) {
149 emit progress(nEpo);
150 }
151 }
152
153 emit finished();
154 deleteLater();
155}
Note: See TracBrowser for help on using the repository browser.