[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) {
|
---|
[5736] | 56 | _opt = opt;
|
---|
[5767] | 57 | connect(this, SIGNAL(newMessage(QByteArray,bool)),
|
---|
| 58 | BNC_CORE, SLOT(slotMessage(const QByteArray,bool)));
|
---|
[4763] | 59 | }
|
---|
| 60 |
|
---|
| 61 | // Destructor
|
---|
| 62 | ////////////////////////////////////////////////////////////////////////////
|
---|
[5680] | 63 | t_pppThread::~t_pppThread() {
|
---|
[5731] | 64 | delete _pppRun;
|
---|
[4763] | 65 | }
|
---|
| 66 |
|
---|
| 67 | // Run (virtual)
|
---|
| 68 | ////////////////////////////////////////////////////////////////////////////
|
---|
[5680] | 69 | void t_pppThread::run() {
|
---|
[5742] | 70 | try {
|
---|
| 71 | _pppRun = new t_pppRun(_opt);
|
---|
| 72 | QThread::exec();
|
---|
| 73 | }
|
---|
[5763] | 74 | catch (pppExcept exc) {
|
---|
[5766] | 75 | emit newMessage(QByteArray(exc.what().c_str()), true);
|
---|
[5742] | 76 | }
|
---|
[5731] | 77 | }
|
---|
| 78 |
|
---|
| 79 | // Constructor
|
---|
| 80 | ////////////////////////////////////////////////////////////////////////////
|
---|
[5736] | 81 | t_pppRun::t_pppRun(const t_options* opt) {
|
---|
[5731] | 82 | _opt = opt;
|
---|
[5767] | 83 | connect(this, SIGNAL(newMessage(QByteArray,bool)),
|
---|
| 84 | BNC_CORE, SLOT(slotMessage(const QByteArray,bool)));
|
---|
[5742] | 85 | if (_opt->_realTime) {
|
---|
[5729] | 86 | connect(BNC_CORE->caster(), SIGNAL(newObs(QByteArray, QList<t_obs>)),
|
---|
| 87 | this, SLOT(slotNewObs(QByteArray, QList<t_obs>)));
|
---|
[4757] | 88 |
|
---|
[5722] | 89 | connect(BNC_CORE, SIGNAL(newEphGPS(gpsephemeris)),
|
---|
| 90 | this, SLOT(slotNewEphGPS(gpsephemeris)));
|
---|
| 91 |
|
---|
| 92 | connect(BNC_CORE, SIGNAL(newEphGlonass(glonassephemeris)),
|
---|
| 93 | this, SLOT(slotNewEphGlonass(glonassephemeris)));
|
---|
| 94 |
|
---|
| 95 | connect(BNC_CORE, SIGNAL(newEphGalileo(galileoephemeris)),
|
---|
| 96 | this, SLOT(slotNewEphGalileo(galileoephemeris)));
|
---|
[4757] | 97 |
|
---|
[5732] | 98 | connect(BNC_CORE, SIGNAL(newCorrections(QStringList)),
|
---|
| 99 | this, SLOT(slotNewCorrections(QStringList)));
|
---|
[5742] | 100 |
|
---|
[5761] | 101 | _pppClient = new t_pppClient(_opt);
|
---|
[5722] | 102 | }
|
---|
[5742] | 103 | else {
|
---|
[5766] | 104 | throw pppExcept("t_pppRun: post-processing not yet implemented");
|
---|
[5742] | 105 | }
|
---|
[5731] | 106 | }
|
---|
[5729] | 107 |
|
---|
[5731] | 108 | // Destructor
|
---|
| 109 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 110 | t_pppRun::~t_pppRun() {
|
---|
[4757] | 111 | }
|
---|
| 112 |
|
---|
| 113 | //
|
---|
| 114 | ////////////////////////////////////////////////////////////////////////////
|
---|
[5731] | 115 | void t_pppRun::slotNewEphGPS(gpsephemeris gpseph) {
|
---|
[4757] | 116 | QMutexLocker locker(&_mutex);
|
---|
[5742] | 117 | t_ephGPS eph;
|
---|
| 118 | eph.set(&gpseph);
|
---|
| 119 | _pppClient->putGPSEphemeris(&eph);
|
---|
[4757] | 120 | }
|
---|
| 121 |
|
---|
| 122 | //
|
---|
| 123 | ////////////////////////////////////////////////////////////////////////////
|
---|
[5731] | 124 | void t_pppRun::slotNewEphGlonass(glonassephemeris gloeph) {
|
---|
[4757] | 125 | QMutexLocker locker(&_mutex);
|
---|
| 126 | }
|
---|
| 127 |
|
---|
| 128 | //
|
---|
| 129 | ////////////////////////////////////////////////////////////////////////////
|
---|
[5731] | 130 | void t_pppRun::slotNewEphGalileo(galileoephemeris /* galeph */) {
|
---|
[5681] | 131 | QMutexLocker locker(&_mutex);
|
---|
[4757] | 132 | }
|
---|
| 133 |
|
---|
| 134 | //
|
---|
| 135 | ////////////////////////////////////////////////////////////////////////////
|
---|
[5732] | 136 | void t_pppRun::slotNewCorrections(QStringList corrList) {
|
---|
[4757] | 137 | QMutexLocker locker(&_mutex);
|
---|
| 138 | }
|
---|
| 139 | //
|
---|
| 140 | ////////////////////////////////////////////////////////////////////////////
|
---|
[5731] | 141 | void t_pppRun::slotNewObs(QByteArray staID, QList<t_obs> obsList) {
|
---|
[4757] | 142 | QMutexLocker locker(&_mutex);
|
---|
[5766] | 143 |
|
---|
| 144 | QByteArray msg = "slotNewObs";
|
---|
| 145 | emit newMessage(msg, true);
|
---|
[5589] | 146 | }
|
---|
[5525] | 147 |
|
---|