source: ntrip/trunk/BNC/src/bncmain.cpp@ 7281

Last change on this file since 7281 was 7281, checked in by weber, 9 years ago

Documentation completed

File size: 18.0 KB
RevLine 
[280]1// Part of BNC, a utility for retrieving decoding and
[464]2// converting GNSS data streams from NTRIP broadcasters.
[280]3//
[464]4// Copyright (C) 2007
[280]5// German Federal Agency for Cartography and Geodesy (BKG)
6// http://www.bkg.bund.de
[464]7// Czech Technical University Prague, Department of Geodesy
[280]8// http://www.fsv.cvut.cz
9//
10// Email: euref-ip@bkg.bund.de
11//
12// This program is free software; you can redistribute it and/or
13// modify it under the terms of the GNU General Public License
14// as published by the Free Software Foundation, version 2.
15//
16// This program is distributed in the hope that it will be useful,
17// but WITHOUT ANY WARRANTY; without even the implied warranty of
18// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19// GNU General Public License for more details.
20//
21// You should have received a copy of the GNU General Public License
22// along with this program; if not, write to the Free Software
23// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
[35]24
25/* -------------------------------------------------------------------------
[93]26 * BKG NTRIP Client
[35]27 * -------------------------------------------------------------------------
28 *
29 * Class: main
30 *
31 * Purpose: Application starts here
32 *
33 * Author: L. Mervart
34 *
35 * Created: 24-Dec-2005
36 *
[7268]37 * Changes:
[35]38 *
39 * -----------------------------------------------------------------------*/
40
[274]41#include <unistd.h>
[603]42#include <signal.h>
[35]43#include <QApplication>
44#include <QFile>
45#include <iostream>
46
[5066]47#include "app.h"
[5070]48#include "bnccore.h"
[35]49#include "bncwindow.h"
[1535]50#include "bncsettings.h"
[2012]51#include "bncversion.h"
[3251]52#include "upload/bncephuploadcaster.h"
[5887]53#include "rinex/reqcedit.h"
54#include "rinex/reqcanalyze.h"
[6343]55#include "orbComp/sp3Comp.h"
[35]56
57using namespace std;
58
[603]59void catch_signal(int) {
60 cout << "Program Interrupted by Ctrl-C" << endl;
[3005]61 exit(0);
[603]62}
63
[82]64// Main Program
65/////////////////////////////////////////////////////////////////////////////
[4490]66int main(int argc, char* argv[]) {
[35]67
[4446]68 bool interactive = true;
[4716]69#ifdef WIN32
70 bool displaySet = true;
71#else
[4490]72 bool displaySet = false;
[4716]73#endif
[1552]74 QByteArray rawFileName;
[1501]75 QString confFileName;
[1146]76
[7273]77 QByteArray printHelp =
78 "Usage: bnc --nw \n"
79 " --version \n"
80 " --display <XXX> \n"
81 " --conf <confFileName> \n"
82 " --file <rawFileName> \n"
83 " --key <keyName> <keyValue>\n"
84 "\n"
85 "Internal keys:\n"
86 " --startTab <Top panel index number>\n"
87 " --statusTab <Bottom panel index number>\n"
88 " --font <Used font>\n"
89 " --casterUrlList <Visited URLs>\n"
90 "\n"
91 "Network Panel keys:\n"
92 " --proxyHost <Proxy host>\n"
93 " --proxyPort <Proxy port>\n"
94 " --sslCaCertPath <Path to SSL certificates>\n"
[7281]95 " --ignoreSslErrors <Ignore SSL authorization errors, 0=no, 2=yes>\n"
[7273]96 "\n"
97 "General Panel keys:\n"
[7281]98 " --logFile <Logfile, full path>\n"
[7276]99 " --rnxAppend <Append files, 0=no, 2=yes>\n"
100 " --onTheFlyInterval <Reread configuration, interval>\n"
101 " --autoStart <Auto start, 0=no, 2=yes>\n"
102 " --rawOutFile <Raw output file, full path>\n"
[7273]103 "\n"
104 "RINEX Observations Panel keys:\n"
105 " --rnxPath <Directory>\n"
106 " --rnxIntr <Interval>\n"
[7276]107 " --rnxSample <Sampling [sec]> \n"
108 " --rnxSkel <Skeleton file extension>\n"
109 " --rnxOnlyWithSKL <Skeleton is mandatory, 0=no, 2=yes>\n"
[7281]110 " --rnxScript <File upload script>\n"
[7273]111 " --rnxV2Priority <Signal priority>\n"
[7281]112 " --rnxV3 <Produce version 3 file contents, 0=no, 2=yes>\n"
113 " --rnxV3filenames <Produce version 3 filenames, 0=no, 2=yes>\n"
[7273]114 "\n"
115 "RINEX Ephemeris Panel keys:\n"
116 " --ephPath <Directory>\n"
117 " --ephIntr <Interval>\n"
118 " --outEphPort <Port>\n"
[7281]119 " --ephV3 <Produce version 3 file contents, 0=no, 2=yes>\n"
120 " --ephV3filenames <Produde version 3 filenames, 0=no, 2=yes>\n"
[7273]121 "\n"
122 "RINEX Editing and QC Panel keys:\n"
[7281]123 " --reqcAction <Action, Edit/Concatenate|Analyze>\n"
124 " --reqcObsFile <Input observations file(s)>\n"
125 " --reqcNavFile <Input navigation file(s)>\n"
[7273]126 " --reqcOutObsFile <Output observations file>\n"
127 " --reqcOutNavFile <Output navigation file>\n"
128 " --reqcOutLogFile <Output logfile>\n"
[7281]129 " --reqcLogSummaryOnly <Only summary output logfile, 0=no, 2=yes>\n"
[7276]130 " --reqcSkyPlotSignals <Plots for signals list>\n"
[7273]131 " --reqcPlotDir <QC plots directory>\n"
[7281]132 " --reqcRnxVersion <RINEX version, 2|3>\n"
133 " --reqcSampling <RINEX sampling [sec]>\n"
[7276]134 " --reqcV2Priority <Version 2 signal priority list>\n"
[7273]135 " --reqcStartDateTime <Start time>\n"
136 " --reqcEndDateTime <Stop time>\n"
137 " --reqcRunBy <Operators name>\n"
[7276]138 " --reqcUseObsTypes <Use observation types list>\n"
[7273]139 " --reqcComment <Additional comments>\n"
140 " --reqcOldMarkerName <Old marker name>\n"
141 " --reqcNewMarkerName <New marker name>\n"
142 " --reqcOldAntennaName <Old antenna name>\n"
143 " --reqcNewAntennaName <New antenna name>\n"
144 " --reqcOldAntennaNumber <Old antenna number>\n"
145 " --reqcNewAntennaNumber <New antenna number>\n"
146 " --reqcOldAntennadN <Old north eccentritity>\n"
147 " --reqcNewAntennadN <New north eccentricity>\n"
148 " --reqcOldAntennadE <Old east eccentricity>\n"
149 " --reqcNewAntennadE <New east eccentricity>\n"
150 " --reqcOldAntennadU <Old up eccentritity>\n"
151 " --reqcNewAntennadU <New up eccentricity>\n"
152 " --reqcOldReceiverName <Old receiver name>\n"
153 " --reqcNewReceiverName <New receiver name>\n"
154 " --reqcOldReceiverNumber <Old receiver number>\n"
155 " --reqcNewReceiverNumber <New receiver number>\n"
156 "\n"
157 "SP3 Comparison Panel keys:\n"
[7276]158 " --sp3CompFile <SP3 input files, full path>\n"
[7273]159 " --sp3CompExclude <Satellite exclusion list>\n"
160 " --sp3CompOutLogFile <Output logfile>\n"
161 "\n"
162 "Broadcast Corrections Panel keys:\n"
[7281]163 " --corrPath <Directory for saving files in ASCII format>\n"
[7273]164 " --corrIntr <Interval>\n"
165 " --corrPort <Port>\n"
166 "\n"
167 "Feed Engine Panel keys:\n"
168 " --outPort <Port>\n"
[7281]169 " --waitTime <Wait for full obs epoch [sec]>\n"
170 " --binSampl <Sampling [sec]>\n"
[7276]171 " --outFile <File, full path>\n"
172 " --outUPort <Port, unsynchronized output)>\n"
[7273]173 "\n"
174 "Serial Output Panel:\n"
[7276]175 " --serialMountPoint <Mountpoint>\n"
176 " --serialPortName <Port name>\n"
[7281]177 " --serialBaudRate <Baud rate, 110|300|600|1200|2400|4800|9600|...>\n"
178 " --serialFlowControl <Flow control, OFF|XONXOFF|HARDWARE>\n"
179 " --serialDataBits <Data bits, 5|6|7|8>\n"
180 " --serialParity <Parity, NONE|ODD|EVEN|SPACE>\n"
181 " --serialStopBits <Stop bits, 1|2>\n"
[7276]182 " --serialAutoNMEA <NMEA, no|Auto|Manual GPGGA|Manual GNGGA>\n"
183 " --serialFileNMEA <NMEA filename>\n"
184 " --serialHeightNMEA <Height>\n"
[7281]185 " --serialHeightNMEASampling <Sampling [sec]>\n"
[7273]186 "\n"
187 "Outages Panel keys:\n"
[7281]188 " --obsRate <Observation rate, 0.1 Hz|0.2 Hz|0.5 Hz|1 Hz|5 Hz> \n"
[7276]189 " --adviseFail <Failure threshold [min]>\n"
190 " --adviseReco <Recovery threshold [min]>\n"
191 " --adviseScript <Script, full path>\n"
[7273]192 "\n"
193 "Miscellaneous Panel keys:\n"
194 " --miscMount <Mountpoint>\n"
[7281]195 " --perfIntr <Log latency, interval>\n"
[7276]196 " --scanRTCM <Scan for RTCM message numbers, 0=no, 2=yes>\n"
197 " --miscPort <Port output>\n"
[7273]198 "\n"
199 "PPP Client Panel 1 keys:\n"
[7281]200 " --dataSource <Data source, Real-Time Streams| RINEX Files>\n"
[7273]201 " --rinexObs <RINEX observation file>\n"
202 " --rinexNav <RINEX navigation file>\n"
203 " --corrMount <Corrections mountpoint>\n"
204 " --corrFile <Corrections file>\n"
205 " --crdFile <Coordinates file>\n"
206 " --logFilePPP <PPP logfile>\n"
207 " --antexFile <ANTEX file>\n"
208 " --nmeaFile <NMEA output file>\n"
209 " --snxtroFile <SINEX troposphere output filename>\n"
[7281]210 " --snxtroSampl <SINEX troposphere sampling rate [sec]>\n"
[7273]211 "\n"
212 "PPP Client Panel 2 keys:\n"
213 " --staTable <Stations table>\n"
214 "\n"
215 "PPP Client Panel 3 keys:\n"
[7281]216 " --lcGPS <Select linear combination from GPS code or phase data>\n"
217 " --lcGLONASS <Select linear combination from GLONASS code or phase data>\n"
218 " --lcGalileo <Select linear combination from Galileo code or phase data>\n"
219 " --lcBDS <Select linear combination from BDS code or phase data>\n"
[7276]220 " --sigmaC1 <Sigma for code observations [m]>\n"
221 " --sigmaL1 <Sigma for phase observations [m]>\n"
222 " --maxResC1 <Maximal residuum for code observations [m]>\n"
223 " --maxResL1 <Maximal residuum for phase observations [m]>\n"
224 " --eleWgtCode <Elevation dependent waiting of code observations, 0=no, 2=yes>\n"
225 " --eleWgtPhase <Elevation dependent waiting of phase observations, 0=no, 2=yes>\n"
[7273]226 " --minObs <Minimum number of observations>\n"
[7281]227 " --minEle <Minimum elevation [deg]>\n"
[7276]228 " --corrWaitTime <Wait for clock corrections [sec]>\n"
229 " --seedingTime <Seeding time span for Quick Start [sec]>\n"
[7273]230 "\n"
231 "PPP Client Panel 4 keys:\n"
232 " --plotCoordinates <Mountpoint for time series plot>\n"
[7281]233 " --audioResponse <Audio response threshold [m]>\n"
234 " --useOpenStreetMap <OSM track map, true|false>\n"
235 " --useGoogleMap <Google track map, true|false>\n"
[7273]236 " --mapWinDotSize <Size of dots on map>\n"
[7281]237 " --mapWinDotColor <Color of dots and cross hair on map, red|yellow>\n"
[7276]238 " --mapSpeedSlider <Offline processing speed for mapping, 1-100>\n"
[7273]239 "\n"
240 "Combine Corrections Panel keys:\n"
241 " --combineStreams <Table of correction streams\n"
[7276]242 " --cmbMethodFilter <Approach, Single-Epoch|Filter\n"
243 " --cmbMaxres <Clock outlier threshold [m]\n"
244 " --cmbSampl <Orbit and clock sampling [m]\n"
245 " --cmbUseGlonass <Use GLONASS in combination, 0=no, 2=yes\n"
[7273]246 "\n"
247 "Upload Corrections Panel keys:\n"
248 " --uploadMountpointsOut <Upload corrections table>\n"
[7281]249 " --uploadIntr <File interval, length of SP3 and Clock RINEX files>\n"
250 " --uploadSamplRtcmEphCorr <Orbit corrections sampling interval [sec]>\n"
251 " --uploadSamplSp3 <SP3 file sampling [min]>\n"
252 " --uploadSamplClkRnx <Clock RINEX file sampling [sec]>\n"
[7273]253 "\n"
254 "Custom Trafo keys:\n"
[7276]255 " --trafo_dx <Translation X [m]>\n"
256 " --trafo_dy <Translation Y [m]>\n"
257 " --trafo_dz <Translation Z [m]>\n"
258 " --trafo_dxr <Translation change X [m/y]>\n"
259 " --trafo_dyr <Translation change Y [m/y]>\n"
260 " --trafo_dzr <Translation change Z [m/y]>\n"
261 " --trafo_ox <Rotation X [as]>\n"
262 " --trafo_oy <Rotation Y [as]>\n"
263 " --trafo_oz <Rotation Z [as]>\n"
264 " --trafo_oxr <Rotation change X [as/y]>\n"
265 " --trafo_oyr <Rotation change Y [as/y]>\n"
266 " --trafo_ozr <Rotation change Z [as/y]>\n"
267 " --trafo_sc <Scale [10^-9]>\n"
268 " --trafo_scr <Scale change [10^-9/y]>\n"
269 " --trafo_t0 <Reference year [y]>\n"
[7273]270 "\n"
271 "Upload Ephemeris Panel keys:\n"
272 " --uploadEphHost <Host>\n"
273 " --uploadEphPort <Port>\n"
274 " --uploadEphMountpoint <Mountpoint>\n"
275 " --uploadEphPassword <Password>\n"
[7281]276 " --uploadEphSample <Sampling interval [sec]>\n"
[7273]277 "\n"
278 "Add Stream keys:\n"
[7276]279 " --mountPoints <Mountpoints list>\n"
[7273]280 " --ntripVersion <Ntrip Version>\n";
[3977]281
[100]282 for (int ii = 1; ii < argc; ii++) {
[3977]283 if (QRegExp("--?help").exactMatch(argv[ii])) {
284 cout << printHelp.data();
285 exit(0);
286 }
287 if (QRegExp("--?nw").exactMatch(argv[ii])) {
[4446]288 interactive = false;
[100]289 }
[7268]290 if (QRegExp("--?version").exactMatch(argv[ii])) {
291 cout << BNCPGMNAME << endl;
292 exit(0);
293 }
[4490]294 if (QRegExp("--?display").exactMatch(argv[ii])) {
295 displaySet = true;
[4492]296 strcpy(argv[ii], "-display"); // make it "-display" not "--display"
[4490]297 }
[1552]298 if (ii + 1 < argc) {
[3977]299 if (QRegExp("--?conf").exactMatch(argv[ii])) {
[1552]300 confFileName = QString(argv[ii+1]);
[1146]301 }
[3977]302 if (QRegExp("--?file").exactMatch(argv[ii])) {
[4446]303 interactive = false;
[1553]304 rawFileName = QByteArray(argv[ii+1]);
[1552]305 }
[1156]306 }
[1146]307 }
308
[4162]309#ifdef Q_OS_MAC
[4446]310 if (argc== 3 && interactive) {
[4162]311 confFileName = QString(argv[2]);
312 }
313#else
[4446]314 if (argc == 2 && interactive) {
[1585]315 confFileName = QString(argv[1]);
316 }
[4162]317#endif
[1585]318
[6548]319#ifdef Q_OS_MACX
320 if ( QSysInfo::MacintoshVersion > QSysInfo::MV_10_8 )
321 {
322 // fix Mac OS X 10.9 (mavericks) font issue
323 // https://bugreports.qt-project.org/browse/QTBUG-32789
324 QFont::insertSubstitution(".Lucida Grande UI", "Lucida Grande");
325 }
326#endif
327
[4491]328 bool GUIenabled = interactive || displaySet;
[5066]329 t_app app(argc, argv, GUIenabled);
[1516]330
[1538]331 app.setApplicationName("BNC");
332 app.setOrganizationName("BKG");
333 app.setOrganizationDomain("www.bkg.bund.de");
[5084]334
335 BNC_CORE->setGUIenabled(GUIenabled);
[5068]336 BNC_CORE->setConfFileName( confFileName );
[1538]337
[1535]338 bncSettings settings;
[1503]339
[3976]340 for (int ii = 1; ii < argc - 2; ii++) {
[3978]341 if (QRegExp("--?key").exactMatch(argv[ii])) {
[3976]342 QString key(argv[ii+1]);
343 QString val(argv[ii+2]);
344 settings.setValue(key, val);
345 }
346 }
347
[180]348 // Interactive Mode - open the main window
349 // ---------------------------------------
[4446]350 if (interactive) {
[113]351
[5072]352 BNC_CORE->setMode(t_bncCore::interactive);
[3280]353
[113]354 QString fontString = settings.value("font").toString();
355 if ( !fontString.isEmpty() ) {
356 QFont newFont;
357 if (newFont.fromString(fontString)) {
358 QApplication::setFont(newFont);
359 }
360 }
[7268]361
[173]362 app.setWindowIcon(QPixmap(":ntrip-logo.png"));
[113]363
[82]364 bncWindow* bncWin = new bncWindow();
[5068]365 BNC_CORE->setMainWindow(bncWin);
[35]366 bncWin->show();
367 }
[180]368
[7268]369 // Post-Processing PPP
[6343]370 // -------------------
371 else if (settings.value("PPP/dataSource").toString() == "RINEX Files") {
372 bncCaster* caster = new bncCaster();
373 BNC_CORE->setCaster(caster);
374 BNC_CORE->setMode(t_bncCore::batchPostProcessing);
375 BNC_CORE->startPPP();
376 }
377
[3974]378 // Post-Processing reqc edit
379 // -------------------------
[5864]380 else if (settings.value("reqcAction").toString() == "Edit/Concatenate") {
[5072]381 BNC_CORE->setMode(t_bncCore::batchPostProcessing);
[3974]382 t_reqcEdit* reqcEdit = new t_reqcEdit(0);
383 reqcEdit->start();
384 }
385
[3975]386 // Post-Processing reqc analyze
387 // ----------------------------
388 else if (settings.value("reqcAction").toString() == "Analyze") {
[5072]389 BNC_CORE->setMode(t_bncCore::batchPostProcessing);
[3975]390 t_reqcAnalyze* reqcAnalyze = new t_reqcAnalyze(0);
391 reqcAnalyze->start();
392 }
393
[6343]394 // SP3 Files Comparison
395 // --------------------
396 else if (!settings.value("sp3CompFile").toString().isEmpty()) {
[5926]397 BNC_CORE->setMode(t_bncCore::batchPostProcessing);
[6343]398 t_sp3Comp* sp3Comp = new t_sp3Comp(0);
399 sp3Comp->start();
[5926]400 }
401
[3974]402 // Non-Interactive (data gathering)
403 // --------------------------------
[35]404 else {
[621]405
[1138]406 signal(SIGINT, catch_signal);
407
[3251]408 bncEphUploadCaster* casterEph = new bncEphUploadCaster(); (void) casterEph;
[7268]409
[5729]410 bncCaster* caster = new bncCaster();
[7268]411
[5068]412 BNC_CORE->setCaster(caster);
[6451]413 BNC_CORE->setPortEph(settings.value("outEphPort").toInt());
[5068]414 BNC_CORE->setPortCorr(settings.value("corrPort").toInt());
415 BNC_CORE->initCombination();
[7268]416
[5729]417 BNC_CORE->connect(caster, SIGNAL(getThreadsFinished()), &app, SLOT(quit()));
[7268]418
[6569]419 BNC_CORE->slotMessage("========== Start BNC v" BNCVERSION " ("BNC_OS") ==========", true);
[5845]420
[1170]421 // Normal case - data from Internet
422 // --------------------------------
[3974]423 if ( rawFileName.isEmpty() ) {
[5072]424 BNC_CORE->setMode(t_bncCore::nonInteractive);
[5946]425 BNC_CORE->startPPP();
[5905]426
[4250]427 caster->readMountPoints();
[1170]428 if (caster->numStations() == 0) {
[1552]429 exit(0);
[1170]430 }
431 }
[7268]432
[1170]433 // Special case - data from file
434 // -----------------------------
435 else {
[5072]436 BNC_CORE->setMode(t_bncCore::batchPostProcessing);
[5946]437 BNC_CORE->startPPP();
[5905]438
439 bncRawFile* rawFile = new bncRawFile(rawFileName, "", bncRawFile::input);
[2519]440 bncGetThread* getThread = new bncGetThread(rawFile);
[2528]441 caster->addGetThread(getThread, true);
[35]442 }
443 }
[180]444
445 // Start the application
446 // ---------------------
[35]447 return app.exec();
448}
Note: See TracBrowser for help on using the repository browser.