[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 | //////////////////////////////////////////////////////////////////////////////
|
---|
[5946] | 65 | void t_pppMain::start() {
|
---|
[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();
|
---|
[5946] | 76 | t_pppThread* pppThread = new t_pppThread(opt);
|
---|
| 77 | pppThread->start();
|
---|
[5813] | 78 | _pppThreads << pppThread;
|
---|
[5764] | 79 | _running = true;
|
---|
| 80 | }
|
---|
[5719] | 81 | }
|
---|
[5825] | 82 | catch (t_except exc) {
|
---|
[5765] | 83 | _running = true;
|
---|
[5900] | 84 | stop();
|
---|
[5764] | 85 | }
|
---|
[5716] | 86 | }
|
---|
| 87 |
|
---|
| 88 | //
|
---|
| 89 | //////////////////////////////////////////////////////////////////////////////
|
---|
[5900] | 90 | void t_pppMain::stop() {
|
---|
[5871] | 91 |
|
---|
[5719] | 92 | if (!_running) {
|
---|
| 93 | return;
|
---|
| 94 | }
|
---|
[5730] | 95 |
|
---|
[5971] | 96 | if (!_realTime) {
|
---|
| 97 | cout << "t_pppMain::stop RINEX" << endl;
|
---|
| 98 | return;
|
---|
| 99 | }
|
---|
| 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 |
|
---|
[5971] | 133 | _realTime = false;
|
---|
[5714] | 134 | if (settings.value("PPP/dataSource").toString() == "Real-Time Streams") {
|
---|
[5971] | 135 | _realTime = true;
|
---|
[5714] | 136 | }
|
---|
| 137 | else if (settings.value("PPP/dataSource").toString() == "RINEX Files") {
|
---|
[5971] | 138 | _realTime = false;
|
---|
[5714] | 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 |
|
---|
[5971] | 154 | opt->_realTime = _realTime;
|
---|
[5913] | 155 | opt->_roverName = hlp[0].toAscii().data();
|
---|
| 156 | opt->_aprSigCrd[0] = hlp[1].toDouble();
|
---|
| 157 | opt->_aprSigCrd[1] = hlp[2].toDouble();
|
---|
| 158 | opt->_aprSigCrd[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->_aprSigTrp = hlp[7].toDouble();
|
---|
| 163 | opt->_noiseTrp = hlp[8].toDouble();
|
---|
[5714] | 164 |
|
---|
[5971] | 165 | if (_realTime) {
|
---|
[5714] | 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 |
|
---|
[5913] | 174 | opt->_crdFile = settings.value("PPP/crdFile").toString().toAscii().data();
|
---|
| 175 | opt->_antexFileName = settings.value("PPP/antexFile").toString().toAscii().data();
|
---|
[5714] | 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") {
|
---|
[5913] | 182 | opt->_LCsGPS.push_back(t_lc::cIF);
|
---|
[5715] | 183 | }
|
---|
| 184 | else if (settings.value("PPP/lcGPS").toString() == "L3") {
|
---|
[5913] | 185 | opt->_LCsGPS.push_back(t_lc::lIF);
|
---|
[5715] | 186 | }
|
---|
| 187 | else if (settings.value("PPP/lcGPS").toString() == "P3&L3") {
|
---|
[5913] | 188 | opt->_LCsGPS.push_back(t_lc::cIF);
|
---|
| 189 | opt->_LCsGPS.push_back(t_lc::lIF);
|
---|
[5715] | 190 | }
|
---|
| 191 |
|
---|
| 192 | if (settings.value("PPP/lcGLONASS").toString() == "P3") {
|
---|
[5913] | 193 | opt->_LCsGLONASS.push_back(t_lc::cIF);
|
---|
[5715] | 194 | }
|
---|
| 195 | else if (settings.value("PPP/lcGLONASS").toString() == "L3") {
|
---|
[5913] | 196 | opt->_LCsGLONASS.push_back(t_lc::lIF);
|
---|
[5715] | 197 | }
|
---|
| 198 | else if (settings.value("PPP/lcGLONASS").toString() == "P3&L3") {
|
---|
[5913] | 199 | opt->_LCsGLONASS.push_back(t_lc::cIF);
|
---|
| 200 | opt->_LCsGLONASS.push_back(t_lc::lIF);
|
---|
[5715] | 201 | }
|
---|
| 202 |
|
---|
| 203 | if (settings.value("PPP/lcGalileo").toString() == "P3") {
|
---|
[5913] | 204 | opt->_LCsGalileo.push_back(t_lc::cIF);
|
---|
[5715] | 205 | }
|
---|
| 206 | else if (settings.value("PPP/lcGalileo").toString() == "L3") {
|
---|
[5913] | 207 | opt->_LCsGalileo.push_back(t_lc::lIF);
|
---|
[5715] | 208 | }
|
---|
| 209 | else if (settings.value("PPP/lcGalileo").toString() == "P3&L3") {
|
---|
[5913] | 210 | opt->_LCsGalileo.push_back(t_lc::cIF);
|
---|
| 211 | opt->_LCsGalileo.push_back(t_lc::lIF);
|
---|
[5715] | 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 |
|
---|
[5959] | 235 | opt->_minObs = settings.value("PPP/minObs").toInt();
|
---|
| 236 | opt->_minEle = settings.value("PPP/minEle").toDouble() * M_PI / 180.0;
|
---|
| 237 | opt->_maxResC1 = settings.value("PPP/maxResC1").toDouble();
|
---|
| 238 | opt->_maxResL1 = settings.value("PPP/maxResL1").toDouble();
|
---|
| 239 | opt->_eleWgtCode = (settings.value("PPP/eleWgtCode").toInt() != 0);
|
---|
| 240 | opt->_eleWgtPhase = (settings.value("PPP/eleWgtPhase").toInt() != 0);
|
---|
| 241 | opt->_seedingTime = settings.value("PPP/seedingTime").toDouble();
|
---|
| 242 |
|
---|
[5793] | 243 | // Some default values
|
---|
| 244 | // -------------------
|
---|
[5919] | 245 | opt->_aprSigAmb = 100.0;
|
---|
[5920] | 246 | opt->_noiseClk = 1000.0;
|
---|
[5793] | 247 |
|
---|
[5714] | 248 | _options << opt;
|
---|
| 249 | }
|
---|
| 250 | }
|
---|
| 251 |
|
---|