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