source: ntrip/trunk/BNC/src/PPP/pppThread.cpp@ 5771

Last change on this file since 5771 was 5771, checked in by mervart, 10 years ago
File size: 4.8 KB
Line 
1
2// Part of BNC, a utility for retrieving decoding and
3// converting GNSS data streams from NTRIP broadcasters.
4//
5// Copyright (C) 2007
6// German Federal Agency for Cartography and Geodesy (BKG)
7// http://www.bkg.bund.de
8// Czech Technical University Prague, Department of Geodesy
9// http://www.fsv.cvut.cz
10//
11// Email: euref-ip@bkg.bund.de
12//
13// This program is free software; you can redistribute it and/or
14// modify it under the terms of the GNU General Public License
15// as published by the Free Software Foundation, version 2.
16//
17// This program is distributed in the hope that it will be useful,
18// but WITHOUT ANY WARRANTY; without even the implied warranty of
19// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20// GNU General Public License for more details.
21//
22// You should have received a copy of the GNU General Public License
23// along with this program; if not, write to the Free Software
24// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
25
26/* -------------------------------------------------------------------------
27 * BKG NTRIP Client
28 * -------------------------------------------------------------------------
29 *
30 * Class: t_pppThread, t_pppRun
31 *
32 * Purpose: Single PPP Client (running in its own thread)
33 *
34 * Author: L. Mervart
35 *
36 * Created: 29-Jul-2014
37 *
38 * Changes:
39 *
40 * -----------------------------------------------------------------------*/
41
42
43#include <iostream>
44#include <iomanip>
45#include <string.h>
46
47#include "pppThread.h"
48#include "bnccore.h"
49
50using namespace BNC;
51using namespace std;
52
53// Constructor
54////////////////////////////////////////////////////////////////////////////
55t_pppThread::t_pppThread(const t_options* opt) : QThread(0) {
56 _opt = opt;
57 connect(this, SIGNAL(newMessage(QByteArray,bool)),
58 BNC_CORE, SLOT(slotMessage(const QByteArray,bool)));
59}
60
61// Destructor
62////////////////////////////////////////////////////////////////////////////
63t_pppThread::~t_pppThread() {
64 delete _pppRun;
65}
66
67// Run (virtual)
68////////////////////////////////////////////////////////////////////////////
69void t_pppThread::run() {
70 try {
71 _pppRun = new t_pppRun(_opt);
72 }
73 catch (pppExcept exc) {
74 _pppRun = 0;
75 emit newMessage(QByteArray(exc.what().c_str()), true);
76 }
77 QThread::exec();
78}
79
80// Constructor
81////////////////////////////////////////////////////////////////////////////
82t_pppRun::t_pppRun(const t_options* opt) {
83 _opt = opt;
84 connect(this, SIGNAL(newMessage(QByteArray,bool)),
85 BNC_CORE, SLOT(slotMessage(const QByteArray,bool)));
86 if (_opt->_realTime) {
87 connect(BNC_CORE->caster(), SIGNAL(newObs(QByteArray, QList<t_obs>)),
88 this, SLOT(slotNewObs(QByteArray, QList<t_obs>)));
89
90 connect(BNC_CORE, SIGNAL(newEphGPS(gpsephemeris)),
91 this, SLOT(slotNewEphGPS(gpsephemeris)));
92
93 connect(BNC_CORE, SIGNAL(newEphGlonass(glonassephemeris)),
94 this, SLOT(slotNewEphGlonass(glonassephemeris)));
95
96 connect(BNC_CORE, SIGNAL(newEphGalileo(galileoephemeris)),
97 this, SLOT(slotNewEphGalileo(galileoephemeris)));
98
99 connect(BNC_CORE, SIGNAL(newCorrections(QStringList)),
100 this, SLOT(slotNewCorrections(QStringList)));
101
102 _pppClient = new t_pppClient(_opt);
103 }
104 else {
105 throw pppExcept("t_pppRun: post-processing not yet implemented");
106 }
107}
108
109// Destructor
110////////////////////////////////////////////////////////////////////////////
111t_pppRun::~t_pppRun() {
112}
113
114//
115////////////////////////////////////////////////////////////////////////////
116void t_pppRun::slotNewEphGPS(gpsephemeris gpseph) {
117 QMutexLocker locker(&_mutex);
118 t_ephGPS eph;
119 eph.set(&gpseph);
120 _pppClient->putGPSEphemeris(&eph);
121}
122
123//
124////////////////////////////////////////////////////////////////////////////
125void t_pppRun::slotNewEphGlonass(glonassephemeris gloeph) {
126 QMutexLocker locker(&_mutex);
127 t_ephGlo eph;
128 eph.set(&gloeph);
129 _pppClient->putGloEphemeris(&eph);
130}
131
132//
133////////////////////////////////////////////////////////////////////////////
134void t_pppRun::slotNewEphGalileo(galileoephemeris galeph) {
135 QMutexLocker locker(&_mutex);
136 t_ephGal eph;
137 eph.set(&galeph);
138 _pppClient->putGalEphemeris(&eph);
139}
140
141//
142////////////////////////////////////////////////////////////////////////////
143void t_pppRun::slotNewCorrections(QStringList corrList) {
144 QMutexLocker locker(&_mutex);
145
146 QStringListIterator it(corrList);
147 while (it.hasNext()) {
148 }
149
150 // _pppClient->putOrbCorrections(int numCorr, const t_orbCorr* corr);
151 // _pppClient->putClkCorrections(int numCorr, const t_clkCorr* corr);
152 // _pppClient->putBiases(int numBiases, const t_satBiases* biases);
153}
154//
155////////////////////////////////////////////////////////////////////////////
156void t_pppRun::slotNewObs(QByteArray staID, QList<t_obs> obsList) {
157 QMutexLocker locker(&_mutex);
158
159 QByteArray msg = "slotNewObs";
160 emit newMessage(msg, true);
161}
162
Note: See TracBrowser for help on using the repository browser.