[4757] | 1 |
|
---|
[5719] | 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 | *
|
---|
[5731] | 30 | * Class: t_pppThread, t_pppRun
|
---|
[5719] | 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 |
|
---|
[4757] | 43 | #include <iostream>
|
---|
[4775] | 44 | #include <iomanip>
|
---|
[4757] | 45 | #include <string.h>
|
---|
| 46 |
|
---|
[5680] | 47 | #include "pppThread.h"
|
---|
[5068] | 48 | #include "bnccore.h"
|
---|
[4757] | 49 |
|
---|
[5719] | 50 | using namespace BNC;
|
---|
[4757] | 51 | using namespace std;
|
---|
| 52 |
|
---|
| 53 | // Constructor
|
---|
| 54 | ////////////////////////////////////////////////////////////////////////////
|
---|
[5721] | 55 | t_pppThread::t_pppThread(const t_options* opt) : QThread(0) {
|
---|
[5774] | 56 | _opt = opt;
|
---|
| 57 | _pppRun = 0;
|
---|
[5767] | 58 | connect(this, SIGNAL(newMessage(QByteArray,bool)),
|
---|
| 59 | BNC_CORE, SLOT(slotMessage(const QByteArray,bool)));
|
---|
[4763] | 60 | }
|
---|
| 61 |
|
---|
| 62 | // Destructor
|
---|
| 63 | ////////////////////////////////////////////////////////////////////////////
|
---|
[5680] | 64 | t_pppThread::~t_pppThread() {
|
---|
[5731] | 65 | delete _pppRun;
|
---|
[4763] | 66 | }
|
---|
| 67 |
|
---|
| 68 | // Run (virtual)
|
---|
| 69 | ////////////////////////////////////////////////////////////////////////////
|
---|
[5680] | 70 | void t_pppThread::run() {
|
---|
[5742] | 71 | try {
|
---|
| 72 | _pppRun = new t_pppRun(_opt);
|
---|
| 73 | }
|
---|
[5763] | 74 | catch (pppExcept exc) {
|
---|
[5768] | 75 | _pppRun = 0;
|
---|
[5766] | 76 | emit newMessage(QByteArray(exc.what().c_str()), true);
|
---|
[5742] | 77 | }
|
---|
[5768] | 78 | QThread::exec();
|
---|
[5731] | 79 | }
|
---|
| 80 |
|
---|
[5774] | 81 | //
|
---|
| 82 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 83 | void t_pppThread::stop() {
|
---|
| 84 | this->exit();
|
---|
| 85 | delete _pppRun; _pppRun = 0;
|
---|
| 86 | this->wait(1000);
|
---|
| 87 | this->deleteLater();
|
---|
| 88 | }
|
---|
| 89 |
|
---|
[5731] | 90 | // Constructor
|
---|
| 91 | ////////////////////////////////////////////////////////////////////////////
|
---|
[5736] | 92 | t_pppRun::t_pppRun(const t_options* opt) {
|
---|
[5731] | 93 | _opt = opt;
|
---|
[5767] | 94 | connect(this, SIGNAL(newMessage(QByteArray,bool)),
|
---|
| 95 | BNC_CORE, SLOT(slotMessage(const QByteArray,bool)));
|
---|
[5742] | 96 | if (_opt->_realTime) {
|
---|
[5729] | 97 | connect(BNC_CORE->caster(), SIGNAL(newObs(QByteArray, QList<t_obs>)),
|
---|
| 98 | this, SLOT(slotNewObs(QByteArray, QList<t_obs>)));
|
---|
[4757] | 99 |
|
---|
[5722] | 100 | connect(BNC_CORE, SIGNAL(newEphGPS(gpsephemeris)),
|
---|
| 101 | this, SLOT(slotNewEphGPS(gpsephemeris)));
|
---|
| 102 |
|
---|
| 103 | connect(BNC_CORE, SIGNAL(newEphGlonass(glonassephemeris)),
|
---|
| 104 | this, SLOT(slotNewEphGlonass(glonassephemeris)));
|
---|
| 105 |
|
---|
| 106 | connect(BNC_CORE, SIGNAL(newEphGalileo(galileoephemeris)),
|
---|
| 107 | this, SLOT(slotNewEphGalileo(galileoephemeris)));
|
---|
[4757] | 108 |
|
---|
[5732] | 109 | connect(BNC_CORE, SIGNAL(newCorrections(QStringList)),
|
---|
| 110 | this, SLOT(slotNewCorrections(QStringList)));
|
---|
[5742] | 111 |
|
---|
[5761] | 112 | _pppClient = new t_pppClient(_opt);
|
---|
[5722] | 113 | }
|
---|
[5742] | 114 | else {
|
---|
[5766] | 115 | throw pppExcept("t_pppRun: post-processing not yet implemented");
|
---|
[5742] | 116 | }
|
---|
[5731] | 117 | }
|
---|
[5729] | 118 |
|
---|
[5731] | 119 | // Destructor
|
---|
| 120 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 121 | t_pppRun::~t_pppRun() {
|
---|
[4757] | 122 | }
|
---|
| 123 |
|
---|
| 124 | //
|
---|
| 125 | ////////////////////////////////////////////////////////////////////////////
|
---|
[5731] | 126 | void t_pppRun::slotNewEphGPS(gpsephemeris gpseph) {
|
---|
[4757] | 127 | QMutexLocker locker(&_mutex);
|
---|
[5742] | 128 | t_ephGPS eph;
|
---|
| 129 | eph.set(&gpseph);
|
---|
[5772] | 130 | _pppClient->putEphemeris(&eph);
|
---|
[4757] | 131 | }
|
---|
| 132 |
|
---|
| 133 | //
|
---|
| 134 | ////////////////////////////////////////////////////////////////////////////
|
---|
[5731] | 135 | void t_pppRun::slotNewEphGlonass(glonassephemeris gloeph) {
|
---|
[4757] | 136 | QMutexLocker locker(&_mutex);
|
---|
[5769] | 137 | t_ephGlo eph;
|
---|
| 138 | eph.set(&gloeph);
|
---|
[5772] | 139 | _pppClient->putEphemeris(&eph);
|
---|
[4757] | 140 | }
|
---|
| 141 |
|
---|
| 142 | //
|
---|
| 143 | ////////////////////////////////////////////////////////////////////////////
|
---|
[5769] | 144 | void t_pppRun::slotNewEphGalileo(galileoephemeris galeph) {
|
---|
[5681] | 145 | QMutexLocker locker(&_mutex);
|
---|
[5769] | 146 | t_ephGal eph;
|
---|
| 147 | eph.set(&galeph);
|
---|
[5772] | 148 | _pppClient->putEphemeris(&eph);
|
---|
[4757] | 149 | }
|
---|
| 150 |
|
---|
| 151 | //
|
---|
| 152 | ////////////////////////////////////////////////////////////////////////////
|
---|
[5732] | 153 | void t_pppRun::slotNewCorrections(QStringList corrList) {
|
---|
[4757] | 154 | QMutexLocker locker(&_mutex);
|
---|
[5771] | 155 |
|
---|
| 156 | QStringListIterator it(corrList);
|
---|
| 157 | while (it.hasNext()) {
|
---|
| 158 | }
|
---|
| 159 |
|
---|
[5772] | 160 | // _pppClient->putOrbCorrections(const std::vector<t_orbCorr>& corr);
|
---|
| 161 | // _pppClient->putClkCorrections(const std::vector<t_clkCorr>& corr);
|
---|
| 162 | // _pppClient->putBiases(const std::vector<t_satBiases>& biases);
|
---|
[4757] | 163 | }
|
---|
| 164 | //
|
---|
| 165 | ////////////////////////////////////////////////////////////////////////////
|
---|
[5731] | 166 | void t_pppRun::slotNewObs(QByteArray staID, QList<t_obs> obsList) {
|
---|
[4757] | 167 | QMutexLocker locker(&_mutex);
|
---|
[5766] | 168 |
|
---|
[5772] | 169 |
|
---|
| 170 | vector<t_pppSatObs> satObs;
|
---|
| 171 | t_output output;
|
---|
| 172 |
|
---|
| 173 | _pppClient->processEpoch(satObs, &output);
|
---|
| 174 |
|
---|
| 175 | emit newMessage(QByteArray(output._log.c_str()), true);
|
---|
[5589] | 176 | }
|
---|
[5525] | 177 |
|
---|