source: ntrip/trunk/BNC/bncpppthread.cpp@ 2023

Last change on this file since 2023 was 2023, checked in by mervart, 14 years ago

* empty log message *

File size: 4.3 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: bncPPPthread
30 *
31 * Purpose: Precise Point Positioning
32 *
33 * Author: L. Mervart
34 *
35 * Created: 21-Nov-2009
36 *
37 * Changes:
38 *
39 * -----------------------------------------------------------------------*/
40
41#include <iomanip>
42
43#include "bncpppthread.h"
44
45extern "C" {
46#include "clock_orbit_rtcm.h"
47}
48
49using namespace std;
50
51// Constructor
52////////////////////////////////////////////////////////////////////////////
53bncPPPthread::bncPPPthread(QByteArray staID) {
54 _staID = staID;
55 _isToBeDeleted = false;
56}
57
58// Destructor
59////////////////////////////////////////////////////////////////////////////
60bncPPPthread::~bncPPPthread() {
61 if (isRunning()) {
62 wait();
63 }
64 QMapIterator<QString, t_eph*> it(_eph);
65 while (it.hasNext()) {
66 it.next();
67 delete it.value();
68 }
69 QMapIterator<QString, t_corr*> ic(_corr);
70 while (ic.hasNext()) {
71 ic.next();
72 delete ic.value();
73 }
74}
75
76//
77////////////////////////////////////////////////////////////////////////////
78void bncPPPthread::terminate() {
79 _isToBeDeleted = true;
80 if (!isRunning()) {
81 delete this;
82 }
83}
84
85// Run
86////////////////////////////////////////////////////////////////////////////
87void bncPPPthread::run() {
88 while (true) {
89 try {
90 if (_isToBeDeleted) {
91 QThread::exit(0);
92 this->deleteLater();
93 return;
94 }
95
96 }
97 catch (...) {
98 emit(newMessage(_staID + "bncPPPthread exception", true));
99 _isToBeDeleted = true;
100 }
101 }
102}
103
104//
105////////////////////////////////////////////////////////////////////////////
106void bncPPPthread::slotNewEpochData(QList<p_obs> obsList) {
107 QMutexLocker locker(&_mutex);
108 QListIterator<p_obs> it(obsList);
109 while (it.hasNext()) {
110 p_obs pp = it.next();
111 t_obsInternal* obs = &(pp->_o);
112 QByteArray staID = QByteArray(obs->StatID);
113 cout << "DATA " << obs->GPSWeek << " " << obs->GPSWeeks << " "
114 << staID.data() << " "
115 << obs->satSys << obs->satNum << endl;
116 }
117}
118
119//
120////////////////////////////////////////////////////////////////////////////
121void bncPPPthread::slotNewEphGPS(gpsephemeris gpseph) {
122 QMutexLocker locker(&_mutex);
123
124 QString prn = QString("G%1").arg(gpseph.satellite, 2, 10, QChar('0'));
125
126 if (_eph.contains(prn)) {
127 (static_cast<t_ephGPS*>(_eph.value(prn)))->set(&gpseph);
128 }
129 else {
130 t_ephGPS* ee = new t_ephGPS();
131 ee->set(&gpseph);
132 _eph[prn] = ee;
133 }
134}
135
136//
137////////////////////////////////////////////////////////////////////////////
138void bncPPPthread::slotNewCorrections(QList<QString> corrList) {
139 QMutexLocker locker(&_mutex);
140 QListIterator<QString> it(corrList);
141 while (it.hasNext()) {
142 QTextStream in(it.next().toAscii());
143 int messageType;
144 int updateInterval;
145 int GPSweek;
146 double GPSweeks;
147 QString prn;
148 in >> messageType >> updateInterval >> GPSweek >> GPSweeks >> prn;
149 if ( messageType == COTYPE_GPSCOMBINED ||
150 messageType == COTYPE_GLONASSCOMBINED ) {
151 t_corr* cc = 0;
152 if (_corr.contains(prn)) {
153 cc = _corr.value(prn);
154 }
155 else {
156 cc = new t_corr();
157 _corr[prn] = cc;
158 }
159 in >> cc->iod >> cc->dClk >> cc->rao[0] >> cc->rao[1] >> cc->rao[2];
160 }
161 }
162}
Note: See TracBrowser for help on using the repository browser.