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

Last change on this file since 2022 was 2022, checked in by mervart, 15 years ago

* empty log message *

File size: 4.2 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}
70
71//
72////////////////////////////////////////////////////////////////////////////
73void bncPPPthread::terminate() {
74 _isToBeDeleted = true;
75 if (!isRunning()) {
76 delete this;
77 }
78}
79
80// Run
81////////////////////////////////////////////////////////////////////////////
82void bncPPPthread::run() {
83 while (true) {
84 try {
85 if (_isToBeDeleted) {
86 QThread::exit(0);
87 this->deleteLater();
88 return;
89 }
90
91 }
92 catch (...) {
93 emit(newMessage(_staID + "bncPPPthread exception", true));
94 _isToBeDeleted = true;
95 }
96 }
97}
98
99//
100////////////////////////////////////////////////////////////////////////////
101void bncPPPthread::slotNewEpochData(QList<p_obs> obsList) {
102 QMutexLocker locker(&_mutex);
103 QListIterator<p_obs> it(obsList);
104 while (it.hasNext()) {
105 p_obs pp = it.next();
106 t_obsInternal* obs = &(pp->_o);
107 QString staID = QString(obs->StatID);
108 cout << "DATA " << obs->GPSWeek << " " << obs->GPSWeeks << " "
109 << staID.toAscii().data() << " "
110 << obs->satSys << obs->satNum << endl;
111 }
112}
113
114//
115////////////////////////////////////////////////////////////////////////////
116void bncPPPthread::slotNewEphGPS(gpsephemeris gpseph) {
117 QMutexLocker locker(&_mutex);
118
119 QString prn = QString("G%1").arg(gpseph.satellite, 2, 10, QChar('0'));
120
121 if (_eph.contains(prn)) {
122 (static_cast<t_ephGPS*>(_eph.value(prn)))->set(&gpseph);
123 }
124 else {
125 t_ephGPS* ee = new t_ephGPS();
126 ee->set(&gpseph);
127 _eph[prn] = ee;
128 }
129}
130
131//
132////////////////////////////////////////////////////////////////////////////
133void bncPPPthread::slotNewCorrections(QList<QString> corrList) {
134 QMutexLocker locker(&_mutex);
135 QListIterator<QString> it(corrList);
136 while (it.hasNext()) {
137 QTextStream in(it.next().toAscii());
138 int messageType;
139 int updateInterval;
140 int GPSweek;
141 double GPSweeks;
142 QString prn;
143 in >> messageType >> updateInterval >> GPSweek >> GPSweeks >> prn;
144 if ( messageType == COTYPE_GPSCOMBINED ||
145 messageType == COTYPE_GLONASSCOMBINED ) {
146 t_corr* cc = 0;
147 if (_corr.contains(prn)) {
148 cc = _corr.value(prn);
149 }
150 else {
151 cc = new t_corr();
152 _corr[prn] = cc;
153 }
154 in >> cc->iod >> cc->dClk >> cc->rao[0] >> cc->rao[1] >> cc->rao[2];
155 }
156 }
157}
Note: See TracBrowser for help on using the repository browser.