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

Last change on this file since 9955 was 9955, checked in by stuerze, 15 months ago

minor changes

File size: 28.3 KB
Line 
1// Part of BNC, a utility for retrieving decoding and
2// converting GNSS data streams from NTRIP broadcasters.
3//
4// Copyright (C) 2007
5// German Federal Agency for Cartography and Geodesy (BKG)
6// http://www.bkg.bund.de
7// Czech Technical University Prague, Department of Geodesy
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.
24
25/* -------------------------------------------------------------------------
26 * BKG NTRIP Client
27 * -------------------------------------------------------------------------
28 *
29 * Class: main
30 *
31 * Purpose: Application starts here
32 *
33 * Author: L. Mervart
34 *
35 * Created: 24-Dec-2005
36 *
37 * Changes:
38 *
39 * -----------------------------------------------------------------------*/
40
41#ifndef WIN32
42#include <unistd.h>
43#else
44#include <windows.h>
45#include <direct.h>
46#include <stdlib.h>
47#include <stdio.h>
48#endif
49#include <signal.h>
50#include <QApplication>
51#include <QFile>
52#include <iostream>
53#include <QNetworkProxyFactory>
54
55#include "app.h"
56#include "bnccore.h"
57#include "bncwindow.h"
58#include "bncsettings.h"
59#include "bncversion.h"
60#include "upload/bncephuploadcaster.h"
61#include "rinex/reqcedit.h"
62#include "rinex/reqcanalyze.h"
63#include "orbComp/sp3Comp.h"
64
65using namespace std;
66
67
68void catch_SIGINT(int) {
69 cout << "Program Interrupted by Ctrl-C" << endl;
70 BNC_CORE->sigintReceived = 1;
71 BNC_CORE->stopPPP();
72 BNC_CORE->stopCombination();
73 sleep(2);
74 ::exit(99);
75}
76
77void catch_SIGPIPE(int signum) {
78 cout << "Caught signal SIGPIPE " << signum << endl;
79}
80
81// Main Program
82/////////////////////////////////////////////////////////////////////////////
83int main(int argc, char* argv[]) {
84
85 bool interactive = true;
86#ifdef WIN32
87 bool displaySet = true;
88#else
89 bool displaySet = false;
90#endif
91 QByteArray rawFileName;
92 QString confFileName;
93
94 bncWindow* bncWin = 0;
95 t_reqcEdit* reqcEdit = 0;
96 t_reqcAnalyze* reqcAnalyze = 0;
97 t_sp3Comp* sp3Comp = 0;
98 bncEphUploadCaster* casterEph = 0;
99 bncCaster* caster = 0;
100 bncRawFile* rawFile = 0;
101 bncGetThread* getThread = 0;
102
103 QByteArray printHelp =
104 "Usage:\n"
105 " bnc --help (MS Windows: bnc.exe --help | more)\n"
106 " --nw\n"
107 " --version (MS Windows: bnc.exe --version | more)\n"
108 " --display {name}\n"
109 " --conf {confFileName}\n"
110 " --file {rawFileName}\n"
111 " --key {keyName} {keyValue}\n"
112 "\n"
113 "Network Panel keys:\n"
114 " proxyHost {Proxy host, name or IP address [character string]}\n"
115 " proxyPort {Proxy port [integer number]}\n"
116 " sslCaCertPath {Full path to SSL certificates [character string]}\n"
117 " sslClientCertPath {Full path to client SSL certificates [character string]}\n"
118 " sslIgnoreErrors {Ignore SSL authorization errors [integer number: 0=no,2=yes]}\n"
119 "\n"
120 "General Panel keys:\n"
121 " logFile {Logfile, full path [character string]}\n"
122 " rnxAppend {Append files [integer number: 0=no,2=yes]}\n"
123 " onTheFlyInterval {Configuration reload interval [character string: no|1 day|1 hour|5 min|1 min]}\n"
124 " autoStart {Auto start [integer number: 0=no,2=yes]}\n"
125 " rawOutFile {Raw output file, full path [character string]}\n"
126 "\n"
127 "RINEX Observations Panel keys:\n"
128 " rnxPath {Directory for RINEX files [character string]}\n"
129 " rnxIntr {File interval [character string: 1 min|2 min|5 min|10 min|15 min|30 min|1 hour|1 day]}\n"
130 " rnxSampl {File sampling rate [character string: 0.1 sec|1 sec|5 sec|10 sec|15 sec|30 sec|60 sec]}\n"
131 " rnxSkel {RINEX skeleton file extension [character string: skl|SKL]}\n"
132 " rnxSkelPath {Directory for local skeleton files [character string]}\n"
133 " rnxOnlyWithSKL {Using RINEX skeleton file is mandatory [integer number: 0=no,2=yes]}\n"
134 " rnxScript {File upload script, full path [character string]}\n"
135 " rnxVersion {Specifies the RINEX version of the file contents [integer number: 2|3|4]}\n"
136 " rnxV2Priority {Priority of signal attributes for RINEX version 2 [character string, list separated by blank character,\n"
137 " example: G:12&PWCSLX G:5&IQX R:12&PC R:3&IQX R:46&ABX E:16&BCXZ E:578&IQX J:1&SLXCZ J:26&SLX J:5&IQX C:267&IQX C:18&DPX I:ABCX S:1&C S:5&IQX]}\n"
138 "\n"
139 "RINEX Ephemeris Panel keys:\n"
140 " ephPath {Directory [character string]}\n"
141 " ephIntr {File interval [character string: 1 min|2 min|5 min|10 min|15 min|30 min|1 hour|1 day]}\n"
142 " ephOutPort {Output port [integer number]}\n"
143 " ephVersion {Specifies the RINEX version of the file contents [integer number: 2|3|4]}\n"
144 "\n"
145 "RINEX Editing and QC Panel keys:\n"
146 " reqcAction {Action specification [character string: Blank|Edit/Concatenate|Analyze]}\n"
147 " reqcObsFile {Input observations file(s), full path [character string, comma separated list in quotation marks]}\n"
148 " reqcNavFile {Input navigation file(s), full path [character string, comma separated list in quotation marks]}\n"
149 " reqcOutObsFile {Output observations file, full path [character string]}\n"
150 " reqcOutNavFile {Output navigation file, full path [character string]}\n"
151 " reqcOutLogFile {Output logfile, full path [character string]}\n"
152 " reqcLogSummaryOnly {Output only summary of logfile [integer number: 0=no,2=yes]}\n"
153 " reqcSkyPlotSignals {Observation signals [character string, list separated by blank character,\n"
154 " example: G:1&2&5 R:1&2&3 E:1&7 C:2&6 J:1&2 I:5&9 S:1&5]}\n"
155 " reqcPlotDir {QC plots directory [character string]}\n"
156 " reqcRnxVersion {RINEX version [integer number: 2|3|4]}\n"
157 " reqcSampling {RINEX output file sampling rate [character string: 0.1 sec|1 sec|5 sec|10 sec|15 sec|30 sec|60 sec]}\n"
158 " reqcV2Priority {Version 2 priority of signal attributes [character string, list separated by blank character,\n"
159 " example: G:12&PWCSLX G:5&IQX R:12&PC R:3&IQX R:46&ABX E:16&BCXZ E:578&IQX J:1&SLXCZ J:26&SLX J:5&IQX C:267&IQX C:18&DPX I:ABCX S:1&C S:5&IQX]}\n"
160 " reqcStartDateTime {Start time [character string, example: 1967-11-02T00:00:00]}\n"
161 " reqcEndDateTime {Stop time [character string, example: 2099-01-01T00:00:00]}\n"
162 " reqcRunBy {Operators name [character string]}\n"
163 " reqcUseObsTypes {Use observation types [character string, list separated by blank character, example: G:C1C G:L1C R:C1C RC1P]}\n"
164 " reqcComment {Additional comments [character string]}\n"
165 " reqcOldMarkerName {Old marker name [character string]}\n"
166 " reqcNewMarkerName {New marker name [character string]}\n"
167 " reqcOldAntennaName {Old antenna name [character string]}\n"
168 " reqcNewAntennaName {New antenna name [character string]}\n"
169 " reqcOldAntennaNumber {Old antenna number [character string]}\n"
170 " reqcNewAntennaNumber {New antenna number [character string]}\n"
171 " reqcOldAntennadN {Old north eccentricity [character string]}\n"
172 " reqcNewAntennadN {New north eccentricity [character string]}\n"
173 " reqcOldAntennadE {Old east eccentricity [character string]}\n"
174 " reqcNewAntennadE {New east eccentricity [character string]}\n"
175 " reqcOldAntennadU {Old up eccentricity [character string]}\n"
176 " reqcNewAntennadU {New up eccentricity [character string]}\n"
177 " reqcOldReceiverName {Old receiver name [character string]}\n"
178 " reqcNewReceiverName {New receiver name [character string]}\n"
179 " reqcOldReceiverNumber {Old receiver number [character string]}\n"
180 " reqcNewReceiverNumber {New receiver number [character string]}\n"
181 "\n"
182 "SP3 Comparison Panel keys:\n"
183 " sp3CompFile {SP3 input files, full path [character string, comma separated list in quotation marks]}\n"
184 " sp3CompExclude {Satellite exclusion list [character string, comma separated list in quotation marks, example: G04,G31,R]}\n"
185 " sp3CompOutLogFile {Output logfile, full path [character string]}\n"
186 "\n"
187 "Broadcast Corrections Panel keys:\n"
188 " corrPath {Directory for saving files in ASCII format [character string]}\n"
189 " corrIntr {File interval [character string: 1 min|2 min|5 min|10 min|15 min|30 min|1 hour|1 day]}\n"
190 " corrPort {Output port [integer number]}\n"
191 "\n"
192 "Feed Engine Panel keys:\n"
193 " outPort {Output port, synchronized [integer number]}\n"
194 " outWait {Wait for full observation epoch [integer number of seconds: 1-30]}\n"
195 " outSampl {Sampling rate [character string: 0.1 sec|1 sec|5 sec|10 sec|15 sec|30 sec|60 sec]}\n"
196 " outFile {Output file, full path [character string]}\n"
197 " outUPort {Output port, unsynchronized [integer number]}\n"
198 "\n"
199 "Serial Output Panel:\n"
200 " serialMountPoint {Mountpoint [character string]}\n"
201 " serialPortName {Port name [character string]}\n"
202 " serialBaudRate {Baud rate [integer number: 110|300|600|1200|2400|4800|9600|19200|38400|57600|115200]}\n"
203 " serialFlowControl {Flow control [character string: OFF|XONXOFF|HARDWARE}\n"
204 " serialDataBits {Data bits [integer number: 5|6|7|8]}\n"
205 " serialParity {Parity [character string: NONE|ODD|EVEN|SPACE]}\n"
206 " serialStopBits {Stop bits [integer number: 1|2]}\n"
207 " serialAutoNMEA {NMEA specification [character string: no|Auto|Manual GPGGA|Manual GNGGA]}\n"
208 " serialFileNMEA {NMEA filename, full path [character string]}\n"
209 " serialHeightNMEA {Height [floating-point number]}\n"
210 " serialHeightNMEASampling {Sampling rate [integer number of seconds: 0|10|20|30|...|280|290|300]}\n"
211 "\n"
212 "Outages Panel keys:\n"
213 " adviseObsRate {Stream observation rate [character string: 0.1 Hz|0.2 Hz|0.5 Hz|1 Hz|5 Hz]} \n"
214 " adviseFail {Failure threshold [integer number of minutes: 0-60]}\n"
215 " adviseReco {Recovery threshold [integer number of minutes: 0-60]}\n"
216 " adviseScript {Advisory script, full path [character string]}\n"
217 "\n"
218 "Miscellaneous Panel keys:\n"
219 " miscMount {Mountpoint [character string]}\n"
220 " miscIntr {Interval for logging latency [character string: Blank|2 sec|10 sec|1 min|5 min|15 min|1 hour|6 hours|1 day]}\n"
221 " miscScanRTCM {Scan for RTCM message numbers [integer number: 0=no,2=yes]}\n"
222 " miscPort {Output port [integer number]}\n"
223 "\n"
224 "PPP Client Panel 1 keys:\n"
225 " PPP/dataSource {Data source [character string: Blank|Real-Time Streams|RINEX Files]}\n"
226 " PPP/rinexObs {RINEX observation file, full path [character string]}\n"
227 " PPP/rinexNav {RINEX navigation file, full path [character string]}\n"
228 " PPP/corrMount {Corrections mountpoint [character string]}\n"
229 " PPP/corrFile {Corrections file, full path [character string]}\n"
230 " PPP/crdFile {Coordinates file, full path [character string]}\n"
231 " PPP/logPath {Directory for PPP log files [character string]}\n"
232 " PPP/antexFile {ANTEX file, full path [character string]}\n"
233#ifdef USE_PPP
234 " PPP/blqFile {BLQ file, full path [character string]}\n"
235 " PPP/ionoMount {VTEC mountpoint, [char string]}\n"
236 " PPP/ionoFile {VTEC file, full path [char string]}\n"
237#endif
238 " PPP/nmeaPath {Directory for NMEA output files [character string]}\n"
239 " PPP/snxtroPath {Directory for SINEX troposphere output files [character string]}\n"
240 " PPP/snxtroIntr {SINEX troposphere file interval [character string: 1 min|2 min|5 min|10 min|15 min|30 min|1 hour|1 day]}\n"
241 " PPP/snxtroSampl {SINEX troposphere file sampling rate [character string: 1 sec|5 sec|10 sec|30 sec|60 sec|300 sec]}\n"
242 " PPP/snxtroAc {SINEX troposphere Analysis Center [3-char string]}\n"
243 " PPP/snxtroSol {SINEX troposphere solution ID [1-char]}\n"
244 "\n"
245 "PPP Client Panel 2 keys:\n"
246 " PPP/lcGPS {Select observations from GPS code and/or phase data [character string; Pi&Li|Pi|Li|no]}\n"
247 " PPP/lcGLONASS {Select observations from GLONASS code and/or phase data [character string: Pi&Li|Pi|Li|no]}\n"
248 " PPP/lcGalileo {Select observations from Galileo code and/or phase data [character string: Pi&Li|Pi|Li|no]}\n"
249 " PPP/lcBDS {Select observations from BDS code and/or phase data [character string: Pi&Li|Pi|Li|no]}\n"
250 " PPP/modelObs {select observation model [character string: Uncombined PPP|Ionosphere-free PPP|DCM with Code Biases|DCM with Phase Biases]}\n"
251 " PPP/sigmaC1 {Sigma for code observations in meters [floating-point number]}\n"
252 " PPP/sigmaL1 {Sigma for phase observations in meters [floating-point number]}\n"
253 " PPP/maxResC1 {Maximal residuum for code observations in meters [floating-point number]}\n"
254 " PPP/maxResL1 {Maximal residuum for phase observations in meters [floating-point number]}\n"
255 " PPP/eleWgtCode {Elevation dependent waiting of code observations [integer number: 0=no,2=yes]}\n"
256 " PPP/eleWgtPhase {Elevation dependent waiting of phase observations [integer number: 0=no,2=yes]}\n"
257 " PPP/minObs {Minimum number of observations [integer number: 4|5|6]}\n"
258 " PPP/minEle {Minimum satellite elevation in degrees [integer number: 0-20]}\n"
259 " PPP/corrWaitTime {Wait for clock corrections [integer number of seconds: 0-20]}\n"
260 " PPP/seedingTime {Seeding time span for Quick Start [integer number of seconds]}\n"
261#ifdef USE_PPP
262 " PPP/pseudoOb {Select pseudo observations [character string: no|Ionosphere]}\n"
263 " PPP/sigmaGIM {Sigma for GIM pseudo observations in meters [floating-point number]}\n"
264 " PPP/maxResGIM {Maximal residuum for GIM pseudo observations in meters [floating-point number]}\n"
265#endif
266 "\n"
267 "PPP Client Panel 3 keys:\n"
268 " PPP/staTable {Station specifications table [character string, semicolon separated list, each element in quotaion marks, example:\n"
269 " \"WTZR00DEU0,100.0,100.0,100.0,100.0,100.0,100.0,0.1,3e-6,0,G:12&CWPSLX R:12&CP E:1&CBX E:5&QIX C:26&IQX;\n"
270 " FFMJ00DEU0,100.0,100.0,100.0,100.0,100.0,100.0,0.1,3e-6,0,G:12&CWPSLX R:12&CP E:1&CBX E:5&QIX C:26&IQX\"]}\n"
271 "\n"
272 "PPP Client Panel 4 keys:\n"
273 " PPP/plotCoordinates {Mountpoint for time series plot [character string]}\n"
274 " PPP/audioResponse {Audio response threshold in meters [floating-point number]}\n"
275 " PPP/mapWinDotSize {Size of dots on map [integer number: 0-10]}\n"
276 " PPP/mapWinDotColor {Color of dots and cross hair on map [character string: red|yellow]}\n"
277 " PPP/mapSpeedSlider {Off-line processing speed for mapping [integer number: 1-100]}\n"
278 "\n"
279 "Combine Corrections Panel keys:\n"
280 " cmbStreams {Correction streams table [character string, semicolon separated list, each element in quotation marks, example:\n"
281 " \"SSRA00ESA0 ESA 1.0;SSRA00BKG BKG 1.0\"]}\n"
282 " cmbMethodFilter {Combination approach [character string: Single-Epoch|Filter]}\n"
283 " cmbBsxFile {SINEX Bias file, full path [char string]}\n"
284 " cmbMaxres {Clock outlier residuum threshold in meters [floating-point number]\n"
285 " cmbSampl {Clock sampling rate [integer number of seconds: 0|10|20|30|40|50|60]}\n"
286 " cmbGps {GPS correction usage [integer number: 0=no,2=yes]}\n"
287 " cmbGlo {GLONASS correction usage [integer number: 0=no,2=yes]}\n"
288 " cmbGal {Galileo correction usage [integer number: 0=no,2=yes]}\n"
289 " cmbBds {Beidou correction usage [integer number: 0=no,2=yes]}\n"
290 " cmbQzss {QZSS correction usage [integer number: 0=no,2=yes]}\n"
291 " cmbSbas {SBAS correction usage [integer number: 0=no,2=yes]}\n"
292 " cmbIrnss {IRNSS correction usage [integer number: 0=no,2=yes]}\n"
293 "\n"
294 "Upload Corrections Panel keys:\n"
295 " uploadMountpointsOut {Upload corrections table [character string, semicolon separated list, each element in quotation marks, example:\n"
296 " \"products.igs-ip.net,2101,SSRA02IGS1,2,usr,pass,IGS20,IGS-SSR,0,/home/user/BKG0MGXRTS${V3PROD}.SP3,/home/user/BKG0MGXRTS${V3PROD}.CLK,/home/user/BKG0MGXRTS${V3PROD}.BIA,258,1,0;\n"
297 " euref-ip.net,2101,SSRA02IGS1_EUREF,2,usr,pass,ETRF2000,RTCM-SSR,0,,,,258,2,0\"]}\n"
298 " uploadIntr {Length of SP3, Clock RINEX and Bias SINEX file interval [character string: 1 min|2 min|5 min|10 min|15 min|30 min|1 hour|1 day]}\n"
299 " uploadSamplRtcmEphCorr {Orbit corrections stream sampling rate [integer number of seconds: 0|5|10|15|20|25|30|35|40|45|50|55|60]}\n"
300 " uploadSamplSp3 {SP3 file sampling rate [integer number of minutes: 0-15]}\n"
301 " uploadSamplClkRnx {Clock RINEX file sampling rate [integer number of seconds: 0|5|10|15|20|25|30|35|40|45|50|55|60]}\n"
302 " uploadSamplBiaSnx {SINEX Bias file sampling rate [integer number of seconds: 0|5|10|15|20|25|30|35|40|45|50|55|60]}\n"
303 "\n"
304 "Custom Trafo keys:\n"
305 " trafo_dx {Translation X in meters [floating-point number]\n"
306 " trafo_dy {Translation Y in meters [floating-point number]\n"
307 " trafo_dz {Translation Z in meters [floating-point number]\n"
308 " trafo_dxr {Translation change X in meters per year [floating-point number]\n"
309 " trafo_dyr {Translation change Y in meters per year [floating-point number]\n"
310 " trafo_dzr {Translation change Z in meters per year [floating-point number]\n"
311 " trafo_ox {Rotation X in arcsec [floating-point number]}\n"
312 " trafo_oy {Rotation Y in arcsec [floating-point number]}\n"
313 " trafo_oz {Rotation Z in arcsec [floating-point number]}\n"
314 " trafo_oxr {Rotation change X in arcsec per year [floating-point number]}\n"
315 " trafo_oyr {Rotation change Y in arcsec per year [floating-point number]}\n"
316 " trafo_ozr {Rotation change Z in arcsec per year [floating-point number]}\n"
317 " trafo_sc {Scale [10^-9, floating-point number]}\n"
318 " trafo_scr {Scale change [10^-9 per year, floating-point number]}\n"
319 " trafo_t0 {Reference year [integer number]}\n"
320 "\n"
321 "Upload Ephemeris Panel keys:\n"
322 " uploadEphMountpointsOut {Upload corrections table [character string, semicolon separated list, each element in quotation marks, example:\n"
323 " \"products.igs-ip.net,443,BCEP00BKG0,2s,usr,pass,ALL;products.igs-ip.net,443,BCEP01BKG0,2s,usr,pass,G\"]}\n"
324 " uploadSamplRtcmEph {Stream upload sampling rate [integer number of seconds: 0|5|10|15|20|25|30|35|40|45|50|55|60]}\n"
325 "\n"
326 "Add Stream keys:\n"
327 " mountPoints {Mountpoints [character string, semicolon separated list, example:\n"
328 " \"//user:pass@igs-ip.net:2101/FFMJ00DEU0 RTCM_3.3 DEU 50.09 8.66 no 2;//user:pass@mgex.igs-ip.net:2101/CUT000AUS0 RTCM_3.0 ETH 9.03 38.74 no 2\"}\n"
329 " ntripVersion {Ntrip Version [character string: 1|2|2s|R|U]}\n"
330 " casterUrlList {Visited Broadcasters [character string, comma separated list]}\n"
331 "\n"
332 "Appearance keys:\n"
333 " startTab {Index of top panel to be presented at start time [integer number: 0-17]}\n"
334 " statusTab {Index of bottom panel to be presented at start time [integer number: 0-3]}\n"
335 " font {Font specification [character string in quotation marks, example: \"Helvetica,14,-1,5,50,0,0,0,0,0\"]}\n"
336 "\n"
337 "Note:\n"
338 "The syntax of some command line configuration options slightly differs from that\n"
339 "used in configuration files: Configuration file options which contain one or more blank\n"
340 "characters or contain a semicolon separated parameter list must be enclosed by quotation\n"
341 "marks when specified on command line.\n"
342 "\n"
343 "Examples command lines:\n"
344 "(1) /home/weber/bin/bnc\n"
345 "(2) /Applications/bnc.app/Contents/MacOS/bnc\n"
346 "(3) /home/userName/bin/bnc --conf /home/userName/MyConfigFile.bnc\n"
347 "(4) bnc --conf /Users/userName/.config/BKG/BNC.bnc -nw\n"
348 "(5) bnc --conf /dev/null --key startTab 4 --key reqcAction Edit/Concatenate"
349 " --key reqcObsFile BRUX00BEL_S_20211251100_15M_01S_MO.rnx --key reqcOutObsFile BRUX00BEL_S_20211251100_15M_01S_MO_OUT.rnx"
350 " --key reqcRnxVersion 2 --key reqcSampling \"30 sec\" --key reqcV2Priority \"G:12&PWCSLX G:5&IQX\"\n"
351 "(6) bnc --conf /dev/null --key mountPoints \"//user:pass@mgex.igs-ip.net:2101/CUT000AUS0 RTCM_3.0 ETH 9.03 38.74 no 2;"
352 "//user:pass@igs-ip.net:2101/FFMJ00DEU1 RTCM_3.1 DEU 50.09 8.66 no 2\"\n"
353 "(7) bnc --conf /dev/null --key startTab 15 --key cmbStreams \"SSRA00BKG1 BKG 1.0;SSRA00CNE1 CNES 1.0\"\n"
354 "(8) bnc --conf /dev/null --key startTab 16 --key uploadMountpointsOut \"products.igs-ip.net,2101,SSRC00BKG1,2,usr,pass,IGS20,RTCM-SSR,2,/Users/userName/BKG0MGXRTS${V3PROD}.SP3,,,33,3,2;"
355 "euref-ip.net,443,SSRA00BKG1_EUREF,2s,usr,pass,ETRF2000,IGS-SSR,0,,,,33,5,5\"\n"
356 "(9) bnc --conf /dev/null --key startTab 13 --key PPP/dataSource \"Real-Time Streams\" --key PPP/staTable \"FFMJ00DEU1,100.0,100.0,100.0,100.0,100.0,100.0,0.1,3e-6,7777,G:12&CWPSLX R:12&CP E:1&CBX E:5&QIX C:26&IQX;"
357 "CUT000AUS0,100.0,100.0,100.0,100.0,100.0,100.0,0.1,3e-6,7778,G:12&CWPSLX R:12&CP E:1&CBX E:5&QIX C:26&IQX\"\n";
358
359
360 for (int ii = 1; ii < argc; ii++) {
361 if (QRegExp("--?help").exactMatch(argv[ii])) {
362 cout << printHelp.data();
363 exit(1);
364 }
365 if (QRegExp("--?nw").exactMatch(argv[ii])) {
366 interactive = false;
367 }
368 if (QRegExp("--?version").exactMatch(argv[ii])) {
369 cout << BNCPGMNAME << endl;
370 exit(2);
371 }
372 if (QRegExp("--?display").exactMatch(argv[ii])) {
373 displaySet = true;
374 strcpy(argv[ii], "-display"); // make it "-display" not "--display"
375 }
376 if (ii + 1 < argc) {
377 if (QRegExp("--?conf").exactMatch(argv[ii])) {
378 confFileName = QString(argv[ii+1]);
379 }
380 if (QRegExp("--?file").exactMatch(argv[ii])) {
381 interactive = false;
382 rawFileName = QByteArray(argv[ii+1]);
383 }
384 }
385 }
386
387#ifdef Q_OS_MAC
388 if (argc== 3 && interactive) {
389 confFileName = QString(argv[2]);
390 }
391#else
392 if (argc == 2 && interactive) {
393 confFileName = QString(argv[1]);
394 }
395#endif
396
397#ifdef Q_OS_MACX
398 if ( QSysInfo::MacintoshVersion > QSysInfo::MV_10_8 )
399 {
400 // fix Mac OS X 10.9 (mavericks) font issue
401 // https://bugreports.qt-project.org/browse/QTBUG-32789
402 QFont::insertSubstitution(".Lucida Grande UI", "Lucida Grande");
403 }
404#endif
405
406 bool GUIenabled = interactive || displaySet;
407 QScopedPointer<QCoreApplication> app(createApplication(argc, argv, GUIenabled));
408
409 if (qobject_cast<QApplication *>(app.data())) { // start GUI version
410 app->setApplicationName("BNC");
411 app->setOrganizationName("BKG");
412 app->setOrganizationDomain("www.bkg.bund.de");
413 //app->setWindowIcon(QPixmap(":ntrip-logo.png"));
414 BNC_CORE->setGUIenabled(GUIenabled);
415 }
416
417 BNC_CORE->setConfFileName( confFileName );
418
419 bncSettings settings;
420
421 // Proxy Settings
422 // --------------
423 QString proxyHost = settings.value("proxyHost").toString();
424 int proxyPort = settings.value("proxyPort").toInt();
425 if (!proxyHost.isEmpty()) {
426 QNetworkProxy proxy;
427 proxy.setType(QNetworkProxy::HttpProxy);
428 proxy.setHostName(proxyHost);
429 proxy.setPort(proxyPort);
430 QNetworkProxy::setApplicationProxy(proxy);
431 }
432 else {
433 QNetworkProxyFactory::setUseSystemConfiguration(true);
434 }
435
436 for (int ii = 1; ii < argc - 2; ii++) {
437 if (QRegExp("--?key").exactMatch(argv[ii])) {
438 QString key(argv[ii+1]);
439 QString val(argv[ii+2]);
440 if (val.indexOf(";") != -1) {
441 settings.setValue(key, val.split(";", QString::SkipEmptyParts));
442 }
443 else {
444 settings.setValue(key, val);
445 }
446 }
447 }
448
449
450
451#ifndef WIN32
452 signal(SIGPIPE, catch_SIGPIPE);
453#endif
454
455 // Interactive Mode - open the main window
456 // -----------------------------------------
457 if (interactive) {
458
459 BNC_CORE->setMode(t_bncCore::interactive);
460
461 QString fontString = settings.value("font").toString();
462 if ( !fontString.isEmpty() ) {
463 QFont newFont;
464 if (newFont.fromString(fontString)) {
465 QApplication::setFont(newFont);
466 }
467 }
468
469 bncWin = new bncWindow();
470 BNC_CORE->setMainWindow(bncWin);
471 bncWin->show();
472 }
473
474 // Post-Processing PPP
475 // -------------------
476 else if (settings.value("PPP/dataSource").toString() == "RINEX Files") {
477 caster = new bncCaster();
478 BNC_CORE->setCaster(caster);
479 BNC_CORE->setMode(t_bncCore::batchPostProcessing);
480 BNC_CORE->startPPP();
481 }
482
483 // Post-Processing reqc edit
484 // -------------------------
485 else if (settings.value("reqcAction").toString() == "Edit/Concatenate") {
486 BNC_CORE->setMode(t_bncCore::batchPostProcessing);
487 reqcEdit = new t_reqcEdit(0);
488 reqcEdit->start();
489 }
490
491 // Post-Processing reqc analyze
492 // ----------------------------
493 else if (settings.value("reqcAction").toString() == "Analyze") {
494 BNC_CORE->setMode(t_bncCore::batchPostProcessing);
495 reqcAnalyze = new t_reqcAnalyze(0);
496 reqcAnalyze->start();
497 }
498
499 // SP3 Files Comparison
500 // --------------------
501 else if (!settings.value("sp3CompFile").toString().isEmpty()) {
502 BNC_CORE->setMode(t_bncCore::batchPostProcessing);
503 sp3Comp = new t_sp3Comp(0);
504 sp3Comp->start();
505 }
506
507 // Non-Interactive (data gathering)
508 // --------------------------------
509 else {
510
511 signal(SIGINT, catch_SIGINT);
512
513 BNC_CORE->sigintReceived = 0;
514
515 casterEph = new bncEphUploadCaster(); (void) casterEph;
516
517 caster = new bncCaster();
518
519 BNC_CORE->setCaster(caster);
520 BNC_CORE->setPortEph(settings.value("ephOutPort").toInt());
521 BNC_CORE->setPortCorr(settings.value("corrPort").toInt());
522 BNC_CORE->initCombination();
523
524 BNC_CORE->connect(caster, SIGNAL(getThreadsFinished()), app->instance(), SLOT(quit()));
525
526// BNC_CORE->connect (caster, SIGNAL(mountPointsRead(QList<bncGetThread*>)), app->instance(), SLOT(slotMountPointsRead(QList<bncGetThread*>)));
527
528
529 BNC_CORE->slotMessage("========== Start BNC v" BNCVERSION " (" BNC_OS ") ==========", true);
530
531
532 // Normal case - data from Internet
533 // --------------------------------
534 if ( rawFileName.isEmpty() ) {
535 BNC_CORE->setMode(t_bncCore::nonInteractive);
536 BNC_CORE->startPPP();
537
538 caster->readMountPoints();
539 if (caster->numStations() == 0) {
540 BNC_CORE->slotMessage("bncMain: number of caster stations: 0 => exit" , true);
541 exit(3);
542 }
543 }
544
545 // Special case - data from file
546 // -----------------------------
547 else {
548 BNC_CORE->setMode(t_bncCore::batchPostProcessing);
549 BNC_CORE->startPPP();
550
551 rawFile = new bncRawFile(rawFileName, "", bncRawFile::input);
552 getThread = new bncGetThread(rawFile);
553 caster->addGetThread(getThread, true);
554 }
555 }
556
557 // Start the application
558 // ---------------------
559 app->exec();
560
561 // End of application
562 // ------------------
563 if (interactive) {
564 delete bncWin;
565 }
566 else {
567 BNC_CORE->stopPPP();
568 BNC_CORE->stopCombination();
569 }
570 if (caster) {
571 delete caster; caster = 0; BNC_CORE->setCaster(0);
572 }
573 if (casterEph) {
574 delete casterEph; casterEph = 0;
575 }
576 if (rawFile) {
577 delete rawFile;
578 }
579
580 return 0;
581}
Note: See TracBrowser for help on using the repository browser.