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

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

* empty log message *

File size: 3.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: 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
45using namespace std;
46
47// Constructor
48////////////////////////////////////////////////////////////////////////////
49bncPPPthread::bncPPPthread(QByteArray staID) {
50 _staID = staID;
51 _isToBeDeleted = false;
52 cout << "PPP Client " << _staID.data() << " constructor\n";
53}
54
55// Destructor
56////////////////////////////////////////////////////////////////////////////
57bncPPPthread::~bncPPPthread() {
58 if (isRunning()) {
59 wait();
60 }
61 QMapIterator<QString, t_eph*> it(_eph);
62 while (it.hasNext()) {
63 it.next();
64 delete it.value();
65 }
66}
67
68//
69////////////////////////////////////////////////////////////////////////////
70void bncPPPthread::terminate() {
71 _isToBeDeleted = true;
72 if (!isRunning()) {
73 delete this;
74 }
75}
76
77// Run
78////////////////////////////////////////////////////////////////////////////
79void bncPPPthread::run() {
80 while (true) {
81 try {
82 if (_isToBeDeleted) {
83 QThread::exit(0);
84 this->deleteLater();
85 return;
86 }
87
88 }
89 catch (...) {
90 emit(newMessage(_staID + "bncPPPthread exception", true));
91 _isToBeDeleted = true;
92 }
93 }
94}
95
96//
97////////////////////////////////////////////////////////////////////////////
98void bncPPPthread::slotNewEpochData(QList<p_obs> obsList) {
99 QMutexLocker locker(&_mutex);
100 QListIterator<p_obs> it(obsList);
101 while (it.hasNext()) {
102 p_obs pp = it.next();
103 t_obsInternal* obs = &(pp->_o);
104 QString staID = QString(obs->StatID);
105 cout << obs->GPSWeek << " " << obs->GPSWeeks << " "
106 << staID.toAscii().data() << " " << obs->satSys << obs->satNum << endl;
107 }
108}
109
110//
111////////////////////////////////////////////////////////////////////////////
112void bncPPPthread::slotNewEphGPS(gpsephemeris gpseph) {
113 QMutexLocker locker(&_mutex);
114
115 QString prn = QString("G%1").arg(gpseph.satellite, 2, 10, QChar('0'));
116
117 if (_eph.contains(prn)) {
118 (static_cast<t_ephGPS*>(_eph.value(prn)))->set(&gpseph);
119 }
120 else {
121 t_ephGPS* ee = new t_ephGPS();
122 ee->set(&gpseph);
123 _eph[prn] = ee;
124 }
125}
126
127//
128////////////////////////////////////////////////////////////////////////////
129void bncPPPthread::slotNewCorrections(QList<QString> corrList) {
130 QMutexLocker locker(&_mutex);
131 cout << "PPP Client: new corrections " << corrList.size() << endl;
132}
Note: See TracBrowser for help on using the repository browser.