[5714] | 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_pppMain
|
---|
| 31 | *
|
---|
| 32 | * Purpose: Start of the PPP client(s)
|
---|
| 33 | *
|
---|
| 34 | * Author: L. Mervart
|
---|
| 35 | *
|
---|
| 36 | * Created: 29-Jul-2014
|
---|
| 37 | *
|
---|
| 38 | * Changes:
|
---|
| 39 | *
|
---|
| 40 | * -----------------------------------------------------------------------*/
|
---|
| 41 |
|
---|
[5717] | 42 | #include <iostream>
|
---|
| 43 |
|
---|
[5714] | 44 | #include "pppMain.h"
|
---|
[5911] | 45 | #include "pppCrdFile.h"
|
---|
[5714] | 46 | #include "bncsettings.h"
|
---|
| 47 |
|
---|
[5814] | 48 | using namespace BNC_PPP;
|
---|
[5714] | 49 | using namespace std;
|
---|
| 50 |
|
---|
| 51 | // Constructor
|
---|
| 52 | //////////////////////////////////////////////////////////////////////////////
|
---|
| 53 | t_pppMain::t_pppMain() {
|
---|
[5762] | 54 | _running = false;
|
---|
[5714] | 55 | }
|
---|
| 56 |
|
---|
| 57 | // Destructor
|
---|
| 58 | //////////////////////////////////////////////////////////////////////////////
|
---|
| 59 | t_pppMain::~t_pppMain() {
|
---|
[5900] | 60 | stop();
|
---|
[5714] | 61 | }
|
---|
| 62 |
|
---|
| 63 | //
|
---|
| 64 | //////////////////////////////////////////////////////////////////////////////
|
---|
[5905] | 65 | void t_pppMain::start(bool ownThread) {
|
---|
[5719] | 66 | if (_running) {
|
---|
| 67 | return;
|
---|
| 68 | }
|
---|
| 69 |
|
---|
[5764] | 70 | try {
|
---|
| 71 | readOptions();
|
---|
[5719] | 72 |
|
---|
[5810] | 73 | QListIterator<t_pppOptions*> iOpt(_options);
|
---|
[5764] | 74 | while (iOpt.hasNext()) {
|
---|
[5810] | 75 | const t_pppOptions* opt = iOpt.next();
|
---|
[5905] | 76 | t_pppThread* pppThread = new t_pppThread(ownThread, opt);
|
---|
| 77 | if (ownThread) {
|
---|
| 78 | pppThread->start();
|
---|
| 79 | }
|
---|
| 80 | else {
|
---|
| 81 | pppThread->run();
|
---|
| 82 | }
|
---|
[5813] | 83 | _pppThreads << pppThread;
|
---|
[5764] | 84 | _running = true;
|
---|
| 85 | }
|
---|
[5719] | 86 | }
|
---|
[5825] | 87 | catch (t_except exc) {
|
---|
[5765] | 88 | _running = true;
|
---|
[5900] | 89 | stop();
|
---|
[5764] | 90 | }
|
---|
[5716] | 91 | }
|
---|
| 92 |
|
---|
| 93 | //
|
---|
| 94 | //////////////////////////////////////////////////////////////////////////////
|
---|
[5900] | 95 | void t_pppMain::stop() {
|
---|
[5871] | 96 |
|
---|
[5719] | 97 | if (!_running) {
|
---|
| 98 | return;
|
---|
| 99 | }
|
---|
[5730] | 100 |
|
---|
[5813] | 101 | QListIterator<t_pppThread*> it(_pppThreads);
|
---|
[5729] | 102 | while (it.hasNext()) {
|
---|
[5813] | 103 | t_pppThread* pppThread = it.next();
|
---|
| 104 | pppThread->exit();
|
---|
[5729] | 105 | }
|
---|
[5813] | 106 | _pppThreads.clear();
|
---|
[5730] | 107 |
|
---|
[5810] | 108 | QListIterator<t_pppOptions*> iOpt(_options);
|
---|
[5736] | 109 | while (iOpt.hasNext()) {
|
---|
| 110 | delete iOpt.next();
|
---|
| 111 | }
|
---|
| 112 | _options.clear();
|
---|
| 113 |
|
---|
[5719] | 114 | _running = false;
|
---|
[5716] | 115 | }
|
---|
| 116 |
|
---|
| 117 | //
|
---|
| 118 | //////////////////////////////////////////////////////////////////////////////
|
---|
[5714] | 119 | void t_pppMain::readOptions() {
|
---|
| 120 |
|
---|
[5810] | 121 | QListIterator<t_pppOptions*> iOpt(_options);
|
---|
[5736] | 122 | while (iOpt.hasNext()) {
|
---|
| 123 | delete iOpt.next();
|
---|
| 124 | }
|
---|
[5714] | 125 | _options.clear();
|
---|
| 126 |
|
---|
| 127 | bncSettings settings;
|
---|
| 128 |
|
---|
| 129 | _logFile = settings.value("PPP/logFile").toString();
|
---|
| 130 | _nmeaFile = settings.value("PPP/nmeaFile").toString();
|
---|
| 131 | _nmeaPort = settings.value("PPP/nmeaPort").toInt();
|
---|
| 132 |
|
---|
| 133 | bool realTime = false;
|
---|
| 134 | if (settings.value("PPP/dataSource").toString() == "Real-Time Streams") {
|
---|
| 135 | realTime = true;
|
---|
| 136 | }
|
---|
| 137 | else if (settings.value("PPP/dataSource").toString() == "RINEX Files") {
|
---|
| 138 | realTime = false;
|
---|
| 139 | }
|
---|
| 140 | else {
|
---|
| 141 | return;
|
---|
| 142 | }
|
---|
| 143 |
|
---|
[5736] | 144 | QListIterator<QString> iSta(settings.value("PPP/staTable").toStringList());
|
---|
| 145 | while (iSta.hasNext()) {
|
---|
| 146 | QStringList hlp = iSta.next().split(",");
|
---|
[5714] | 147 |
|
---|
| 148 | if (hlp.size() < 9) {
|
---|
[5825] | 149 | throw t_except("pppMain: wrong option staTable");
|
---|
[5714] | 150 | }
|
---|
| 151 |
|
---|
[5810] | 152 | t_pppOptions* opt = new t_pppOptions();
|
---|
[5714] | 153 |
|
---|
| 154 | opt->_realTime = realTime;
|
---|
| 155 | opt->_roverName = hlp[0].toAscii().data();
|
---|
| 156 | opt->_sigCrd[0] = hlp[1].toDouble();
|
---|
| 157 | opt->_sigCrd[1] = hlp[2].toDouble();
|
---|
| 158 | opt->_sigCrd[2] = hlp[3].toDouble();
|
---|
| 159 | opt->_noiseCrd[0] = hlp[4].toDouble();
|
---|
| 160 | opt->_noiseCrd[1] = hlp[5].toDouble();
|
---|
| 161 | opt->_noiseCrd[2] = hlp[6].toDouble();
|
---|
| 162 | opt->_sigTropo = hlp[7].toDouble();
|
---|
| 163 | opt->_noiseTropo = hlp[8].toDouble();
|
---|
| 164 |
|
---|
| 165 | if (realTime) {
|
---|
| 166 | opt->_corrMount = settings.value("PPP/corrMount").toString().toAscii().data();
|
---|
| 167 | }
|
---|
| 168 | else {
|
---|
| 169 | opt->_rinexObs = settings.value("PPP/rinexObs").toString().toAscii().data();
|
---|
| 170 | opt->_rinexNav = settings.value("PPP/rinexNav").toString().toAscii().data();
|
---|
| 171 | opt->_corrFile = settings.value("PPP/corrFile").toString().toAscii().data();
|
---|
| 172 | }
|
---|
| 173 |
|
---|
| 174 | opt->_crdFile = settings.value("PPP/crdFile").toString().toAscii().data();
|
---|
| 175 | opt->_antexFile = settings.value("PPP/antexFile").toString().toAscii().data();
|
---|
| 176 |
|
---|
| 177 | opt->_sigmaC1 = settings.value("PPP/sigmaC1").toDouble();
|
---|
| 178 | opt->_sigmaL1 = settings.value("PPP/sigmaL1").toDouble();
|
---|
| 179 | opt->_corrWaitTime = settings.value("PPP/corrWaitTime").toDouble();
|
---|
| 180 |
|
---|
[5715] | 181 | if (settings.value("PPP/lcGPS").toString() == "P3") {
|
---|
| 182 | opt->_lcGPS.push_back(t_lc::cIF);
|
---|
| 183 | }
|
---|
| 184 | else if (settings.value("PPP/lcGPS").toString() == "L3") {
|
---|
| 185 | opt->_lcGPS.push_back(t_lc::lIF);
|
---|
| 186 | }
|
---|
| 187 | else if (settings.value("PPP/lcGPS").toString() == "P3&L3") {
|
---|
| 188 | opt->_lcGPS.push_back(t_lc::cIF);
|
---|
| 189 | opt->_lcGPS.push_back(t_lc::lIF);
|
---|
| 190 | }
|
---|
| 191 |
|
---|
| 192 | if (settings.value("PPP/lcGLONASS").toString() == "P3") {
|
---|
| 193 | opt->_lcGLONASS.push_back(t_lc::cIF);
|
---|
| 194 | }
|
---|
| 195 | else if (settings.value("PPP/lcGLONASS").toString() == "L3") {
|
---|
| 196 | opt->_lcGLONASS.push_back(t_lc::lIF);
|
---|
| 197 | }
|
---|
| 198 | else if (settings.value("PPP/lcGLONASS").toString() == "P3&L3") {
|
---|
| 199 | opt->_lcGLONASS.push_back(t_lc::cIF);
|
---|
| 200 | opt->_lcGLONASS.push_back(t_lc::lIF);
|
---|
| 201 | }
|
---|
| 202 |
|
---|
| 203 | if (settings.value("PPP/lcGalileo").toString() == "P3") {
|
---|
| 204 | opt->_lcGalileo.push_back(t_lc::cIF);
|
---|
| 205 | }
|
---|
| 206 | else if (settings.value("PPP/lcGalileo").toString() == "L3") {
|
---|
| 207 | opt->_lcGalileo.push_back(t_lc::lIF);
|
---|
| 208 | }
|
---|
| 209 | else if (settings.value("PPP/lcGalileo").toString() == "P3&L3") {
|
---|
| 210 | opt->_lcGalileo.push_back(t_lc::cIF);
|
---|
| 211 | opt->_lcGalileo.push_back(t_lc::lIF);
|
---|
| 212 | }
|
---|
| 213 |
|
---|
[5911] | 214 | // Information from the coordinate file
|
---|
| 215 | // ------------------------------------
|
---|
| 216 | string crdFileName(settings.value("PPP/crdFile").toString().toAscii().data());
|
---|
| 217 | if (!crdFileName.empty()) {
|
---|
| 218 | vector<t_pppCrdFile::t_staInfo> staInfoVec;
|
---|
| 219 | t_pppCrdFile::readCrdFile(crdFileName, staInfoVec);
|
---|
| 220 | for (unsigned ii = 0; ii < staInfoVec.size(); ii++) {
|
---|
| 221 | const t_pppCrdFile::t_staInfo& staInfo = staInfoVec[ii];
|
---|
| 222 | if (staInfo._name == opt->_roverName) {
|
---|
| 223 | opt->_xyzAprRover[0] = staInfo._xyz[0];
|
---|
| 224 | opt->_xyzAprRover[1] = staInfo._xyz[1];
|
---|
| 225 | opt->_xyzAprRover[2] = staInfo._xyz[2];
|
---|
| 226 | opt->_neuEccRover[0] = staInfo._neuAnt[0];
|
---|
| 227 | opt->_neuEccRover[1] = staInfo._neuAnt[1];
|
---|
| 228 | opt->_neuEccRover[2] = staInfo._neuAnt[2];
|
---|
| 229 | opt->_antNameRover = staInfo._antenna;
|
---|
| 230 | break;
|
---|
| 231 | }
|
---|
| 232 | }
|
---|
| 233 | }
|
---|
| 234 |
|
---|
[5793] | 235 | // Some default values
|
---|
| 236 | // -------------------
|
---|
| 237 | opt->_minObs = 4;
|
---|
[5795] | 238 | opt->_minEle = 10.0 * M_PI / 180.0;
|
---|
[5793] | 239 | opt->_maxResC1 = 10.0;
|
---|
| 240 | opt->_maxResL1 = 0.10;
|
---|
| 241 | opt->_eleWgtCode = false;
|
---|
| 242 | opt->_eleWgtPhase = false;
|
---|
| 243 |
|
---|
[5714] | 244 | _options << opt;
|
---|
| 245 | }
|
---|
| 246 | }
|
---|
| 247 |
|
---|