source: ntrip/trunk/BNC/bncwindow.cpp@ 1989

Last change on this file since 1989 was 1989, checked in by weber, 14 years ago

* empty log message *

File size: 74.6 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: bncWindow
30 *
31 * Purpose: This class implements the main application window.
32 *
33 * Author: L. Mervart
34 *
35 * Created: 24-Dec-2005
36 *
37 * Changes:
38 *
39 * -----------------------------------------------------------------------*/
40
41#include <iostream>
42
43#include <unistd.h>
44#include "bncwindow.h"
45#include "bncapp.h"
46#include "bncgetthread.h"
47#include "bnctabledlg.h"
48#include "bncipport.h"
49#include "bncudpport.h"
50#include "bncserialport.h"
51#include "bnchlpdlg.h"
52#include "bnchtml.h"
53#include "bnctableitem.h"
54#include "bncsettings.h"
55#include "bncfigure.h"
56#include "bncfigurelate.h"
57
58using namespace std;
59
60// Constructor
61////////////////////////////////////////////////////////////////////////////
62bncWindow::bncWindow() {
63
64 _caster = 0;
65
66 _bncFigure = new bncFigure(this);
67 _bncFigureLate = new bncFigureLate(this);
68
69 int ww = QFontMetrics(this->font()).width('w');
70
71 static const QStringList labels = QString("account, Streams: resource loader / mountpoint,decoder,lat,long,nmea,ntrip,bytes").split(",");
72
73 setMinimumSize(85*ww, 65*ww);
74
75 setWindowTitle(tr("BKG Ntrip Client (BNC) Version 1.7"));
76
77 connect((bncApp*)qApp, SIGNAL(newMessage(QByteArray,bool)),
78 this, SLOT(slotWindowMessage(QByteArray,bool)));
79
80 QPalette palette;
81 QColor lightGray(230, 230, 230);
82
83 // Create Actions
84 // --------------
85 _actHelp = new QAction(tr("&Help Contents"),this);
86 connect(_actHelp, SIGNAL(triggered()), SLOT(slotHelp()));
87
88 _actAbout = new QAction(tr("&About BNC"),this);
89 connect(_actAbout, SIGNAL(triggered()), SLOT(slotAbout()));
90
91 _actFlowchart = new QAction(tr("&Flow Chart"),this);
92 connect(_actFlowchart, SIGNAL(triggered()), SLOT(slotFlowchart()));
93
94 _actFontSel = new QAction(tr("Select &Font"),this);
95 connect(_actFontSel, SIGNAL(triggered()), SLOT(slotFontSel()));
96
97 _actSaveOpt = new QAction(tr("&Save && Reread Configuration"),this);
98 connect(_actSaveOpt, SIGNAL(triggered()), SLOT(slotSaveOptions()));
99
100 _actQuit = new QAction(tr("&Quit"),this);
101 connect(_actQuit, SIGNAL(triggered()), SLOT(close()));
102
103 _actAddMountPoints = new QAction(tr("Add &Stream"),this);
104 connect(_actAddMountPoints, SIGNAL(triggered()), SLOT(slotAddMountPoints()));
105
106 _actDeleteMountPoints = new QAction(tr("&Delete Stream"),this);
107 connect(_actDeleteMountPoints, SIGNAL(triggered()), SLOT(slotDeleteMountPoints()));
108 _actDeleteMountPoints->setEnabled(false);
109
110 _actGetData = new QAction(tr("Sta&rt"),this);
111 connect(_actGetData, SIGNAL(triggered()), SLOT(slotGetData()));
112
113 _actStop = new QAction(tr("Sto&p"),this);
114 connect(_actStop, SIGNAL(triggered()), SLOT(slotStop()));
115 _actStop->setEnabled(false);
116
117 _actwhatsthis= new QAction(tr("Help=Shift+F1"),this);
118 connect(_actwhatsthis, SIGNAL(triggered()), SLOT(slotWhatsThis()));
119
120 CreateMenu();
121 AddToolbar();
122
123 bncSettings settings;
124
125 // Proxy Options
126 // -------------
127 _proxyHostLineEdit = new QLineEdit(settings.value("proxyHost").toString());
128 _proxyPortLineEdit = new QLineEdit(settings.value("proxyPort").toString());
129
130 // General Options
131 // ---------------
132 _logFileLineEdit = new QLineEdit(settings.value("logFile").toString());
133 _rnxAppendCheckBox = new QCheckBox();
134 _rnxAppendCheckBox->setCheckState(Qt::CheckState(
135 settings.value("rnxAppend").toInt()));
136 _onTheFlyComboBox = new QComboBox();
137 _onTheFlyComboBox->setEditable(false);
138 _onTheFlyComboBox->addItems(QString("1 day,1 hour,1 min").split(","));
139 int ii = _onTheFlyComboBox->findText(settings.value("onTheFlyInterval").toString());
140 if (ii != -1) {
141 _onTheFlyComboBox->setCurrentIndex(ii);
142 }
143 _autoStartCheckBox = new QCheckBox();
144 _autoStartCheckBox->setCheckState(Qt::CheckState(
145 settings.value("autoStart").toInt()));
146
147 // RINEX Observations Options
148 // --------------------------
149 _rnxPathLineEdit = new QLineEdit(settings.value("rnxPath").toString());
150 _rnxIntrComboBox = new QComboBox();
151 _rnxIntrComboBox->setEditable(false);
152 _rnxIntrComboBox->addItems(QString("1 min,2 min,5 min,10 min,15 min,30 min,1 hour,1 day").split(","));
153 ii = _rnxIntrComboBox->findText(settings.value("rnxIntr").toString());
154 if (ii != -1) {
155 _rnxIntrComboBox->setCurrentIndex(ii);
156 }
157 _rnxSamplSpinBox = new QSpinBox();
158 _rnxSamplSpinBox->setMinimum(0);
159 _rnxSamplSpinBox->setMaximum(60);
160 _rnxSamplSpinBox->setSingleStep(5);
161 _rnxSamplSpinBox->setValue(settings.value("rnxSampl").toInt());
162 _rnxSamplSpinBox->setSuffix(" sec");
163 _rnxSkelLineEdit = new QLineEdit(settings.value("rnxSkel").toString());
164 _rnxSkelLineEdit->setMaximumWidth(5*ww);
165 _rnxScrpLineEdit = new QLineEdit(settings.value("rnxScript").toString());
166 _rnxV3CheckBox = new QCheckBox();
167 _rnxV3CheckBox->setCheckState(Qt::CheckState(settings.value("rnxV3").toInt()));
168
169 // RINEX Ephemeris Options
170 // -----------------------
171 _ephPathLineEdit = new QLineEdit(settings.value("ephPath").toString());
172 _ephIntrComboBox = new QComboBox();
173 _ephIntrComboBox->setEditable(false);
174 _ephIntrComboBox->addItems(QString("1 min,2 min,5 min,10 min,15 min,30 min,1 hour,1 day").split(","));
175 int jj = _ephIntrComboBox->findText(settings.value("ephIntr").toString());
176 if (jj != -1) {
177 _ephIntrComboBox->setCurrentIndex(jj);
178 }
179 _outEphPortLineEdit = new QLineEdit(settings.value("outEphPort").toString());
180 _ephV3CheckBox = new QCheckBox();
181 _ephV3CheckBox->setCheckState(Qt::CheckState(settings.value("ephV3").toInt()));
182
183 // Broadcast Corrections Options
184 // -----------------------------
185 _corrPathLineEdit = new QLineEdit(settings.value("corrPath").toString());
186 _corrIntrComboBox = new QComboBox();
187 _corrIntrComboBox->setEditable(false);
188 _corrIntrComboBox->addItems(QString("1 min,2 min,5 min,10 min,15 min,30 min,1 hour,1 day").split(","));
189 int mm = _corrIntrComboBox->findText(settings.value("corrIntr").toString());
190 if (mm != -1) {
191 _corrIntrComboBox->setCurrentIndex(mm);
192 }
193 _corrPortLineEdit = new QLineEdit(settings.value("corrPort").toString());
194 _corrTimeSpinBox = new QSpinBox();
195 _corrTimeSpinBox->setMinimum(1);
196 _corrTimeSpinBox->setMaximum(30);
197 _corrTimeSpinBox->setSingleStep(1);
198 _corrTimeSpinBox->setSuffix(" sec");
199 _corrTimeSpinBox->setValue(settings.value("corrTime").toInt());
200
201 // Feed Engine Options
202 // -------------------
203 _outPortLineEdit = new QLineEdit(settings.value("outPort").toString());
204 _waitTimeSpinBox = new QSpinBox();
205 _waitTimeSpinBox->setMinimum(1);
206 _waitTimeSpinBox->setMaximum(30);
207 _waitTimeSpinBox->setSingleStep(1);
208 _waitTimeSpinBox->setSuffix(" sec");
209 _waitTimeSpinBox->setValue(settings.value("waitTime").toInt());
210 _binSamplSpinBox = new QSpinBox();
211 _binSamplSpinBox->setMinimum(0);
212 _binSamplSpinBox->setMaximum(60);
213 _binSamplSpinBox->setSingleStep(5);
214 _binSamplSpinBox->setValue(settings.value("binSampl").toInt());
215 _binSamplSpinBox->setSuffix(" sec");
216 _outFileLineEdit = new QLineEdit(settings.value("outFile").toString());
217 _outUPortLineEdit = new QLineEdit(settings.value("outUPort").toString());
218
219 // Serial Output Options
220 // ---------------------
221 _serialMountPointLineEdit = new QLineEdit(settings.value("serialMountPoint").toString());
222 _serialPortNameLineEdit = new QLineEdit(settings.value("serialPortName").toString());
223 _serialBaudRateComboBox = new QComboBox();
224 _serialBaudRateComboBox->addItems(QString("110,300,600,"
225 "1200,2400,4800,9600,19200,38400,57600,115200").split(","));
226 int kk = _serialBaudRateComboBox->findText(settings.value("serialBaudRate").toString());
227 if (kk != -1) {
228 _serialBaudRateComboBox->setCurrentIndex(kk);
229 }
230 _serialFlowControlComboBox = new QComboBox();
231 _serialFlowControlComboBox->addItems(QString("OFF,XONXOFF,HARDWARE").split(","));
232 kk = _serialFlowControlComboBox->findText(settings.value("serialFlowControl").toString());
233 if (kk != -1) {
234 _serialFlowControlComboBox->setCurrentIndex(kk);
235 }
236 _serialDataBitsComboBox = new QComboBox();
237 _serialDataBitsComboBox->addItems(QString("5,6,7,8").split(","));
238 kk = _serialDataBitsComboBox->findText(settings.value("serialDataBits").toString());
239 if (kk != -1) {
240 _serialDataBitsComboBox->setCurrentIndex(kk);
241 }
242 _serialParityComboBox = new QComboBox();
243 _serialParityComboBox->addItems(QString("NONE,ODD,EVEN,SPACE").split(","));
244 kk = _serialParityComboBox->findText(settings.value("serialParity").toString());
245 if (kk != -1) {
246 _serialParityComboBox->setCurrentIndex(kk);
247 }
248 _serialStopBitsComboBox = new QComboBox();
249 _serialStopBitsComboBox->addItems(QString("1,2").split(","));
250 kk = _serialStopBitsComboBox->findText(settings.value("serialStopBits").toString());
251 if (kk != -1) {
252 _serialStopBitsComboBox->setCurrentIndex(kk);
253 }
254 _serialAutoNMEAComboBox = new QComboBox();
255 _serialAutoNMEAComboBox->addItems(QString("Auto,Manual").split(","));
256 kk = _serialAutoNMEAComboBox->findText(settings.value("serialAutoNMEA").toString());
257 if (kk != -1) {
258 _serialAutoNMEAComboBox->setCurrentIndex(kk);
259 }
260 _serialFileNMEALineEdit = new QLineEdit(settings.value("serialFileNMEA").toString());
261 _serialHeightNMEALineEdit = new QLineEdit(settings.value("serialHeightNMEA").toString());
262
263 // Outages Options
264 // ---------------
265 _obsRateComboBox = new QComboBox();
266 _obsRateComboBox->setEditable(false);
267 _obsRateComboBox->addItems(QString(",0.1 Hz,0.2 Hz,0.5 Hz,1 Hz,5 Hz").split(","));
268 kk = _obsRateComboBox->findText(settings.value("obsRate").toString());
269 if (kk != -1) {
270 _obsRateComboBox->setCurrentIndex(kk);
271 }
272 _adviseFailSpinBox = new QSpinBox();
273 _adviseFailSpinBox->setMinimum(0);
274 _adviseFailSpinBox->setMaximum(60);
275 _adviseFailSpinBox->setSingleStep(1);
276 _adviseFailSpinBox->setSuffix(" min");
277 _adviseFailSpinBox->setValue(settings.value("adviseFail").toInt());
278 _adviseRecoSpinBox = new QSpinBox();
279 _adviseRecoSpinBox->setMinimum(0);
280 _adviseRecoSpinBox->setMaximum(60);
281 _adviseRecoSpinBox->setSingleStep(1);
282 _adviseRecoSpinBox->setSuffix(" min");
283 _adviseRecoSpinBox->setValue(settings.value("adviseReco").toInt());
284 _adviseScriptLineEdit = new QLineEdit(settings.value("adviseScript").toString());
285
286 // Miscellaneous Options
287 // ---------------------
288 _miscMountLineEdit = new QLineEdit(settings.value("miscMount").toString());
289 _perfIntrComboBox = new QComboBox();
290 _perfIntrComboBox->setEditable(false);
291 _perfIntrComboBox->addItems(QString(",2 sec, 10 sec,1 min,5 min,15 min,1 hour,6 hours,1 day").split(","));
292 int ll = _perfIntrComboBox->findText(settings.value("perfIntr").toString());
293 if (ll != -1) {
294 _perfIntrComboBox->setCurrentIndex(ll);
295 }
296 _scanRTCMCheckBox = new QCheckBox();
297 _scanRTCMCheckBox->setCheckState(Qt::CheckState(
298 settings.value("scanRTCM").toInt()));
299
300 // Streams
301 // -------
302 _mountPointsTable = new QTableWidget(0,8);
303
304 _mountPointsTable->horizontalHeader()->resizeSection(1,34*ww);
305 _mountPointsTable->horizontalHeader()->resizeSection(2,9*ww);
306 _mountPointsTable->horizontalHeader()->resizeSection(3,7*ww);
307 _mountPointsTable->horizontalHeader()->resizeSection(4,7*ww);
308 _mountPointsTable->horizontalHeader()->resizeSection(5,5*ww);
309 _mountPointsTable->horizontalHeader()->resizeSection(6,5*ww);
310 _mountPointsTable->horizontalHeader()->setResizeMode(QHeaderView::Interactive);
311 _mountPointsTable->horizontalHeader()->setStretchLastSection(true);
312 _mountPointsTable->setHorizontalHeaderLabels(labels);
313 _mountPointsTable->setGridStyle(Qt::NoPen);
314 _mountPointsTable->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
315 _mountPointsTable->setSelectionMode(QAbstractItemView::ExtendedSelection);
316 _mountPointsTable->setSelectionBehavior(QAbstractItemView::SelectRows);
317 _mountPointsTable->hideColumn(0);
318 connect(_mountPointsTable, SIGNAL(itemSelectionChanged()),
319 SLOT(slotSelectionChanged()));
320 populateMountPointsTable();
321
322 _log = new QTextBrowser();
323 _log->setReadOnly(true);
324
325 // WhatsThis
326 // ---------
327 _proxyHostLineEdit->setWhatsThis(tr("<p>If you are running BNC within a protected Local Area Network (LAN), you might need to use a proxy server to access the Internet. Enter your proxy server IP and port number in case one is operated in front of BNC. If you do not know the IP and port of your proxy server, check the proxy server settings in your Internet browser or ask your network administrator.</p><p>Note that IP streaming is sometimes not allowed in a LAN. In this case you need to ask your network administrator for an appropriate modification of the local security policy or for the installation of a TCP relay to the NTRIP broadcasters. If these are not possible, you might need to run BNC outside your LAN on a network that has unobstructed connection to the Internet.</p>"));
328 _proxyPortLineEdit->setWhatsThis(tr("<p>Enter your proxy server port number in case a proxy is operated in front of BNC.</p>"));
329 _waitTimeSpinBox->setWhatsThis(tr("<p>When feeding a real-time GNSS network engine waiting for synchronized input epoch by epoch, BNC drops whatever is received later than 'Wait for full epoch' seconds. A value of 3 to 5 seconds is recommended, depending on the latency of the incoming streams and the delay acceptable to your real-time GNSS network engine or products.</p>"));
330 _outFileLineEdit->setWhatsThis(tr("Specify the full path to a file where synchronized observations are saved in plain ASCII format. Beware that the size of this file can rapidly increase depending on the number of incoming streams."));
331 _outPortLineEdit->setWhatsThis(tr("BNC can produce synchronized observations in binary format on your local host through an IP port. Specify a port number here to activate this function."));
332 _outUPortLineEdit->setWhatsThis(tr("BNC can produce unsynchronized observations in binary format on your local host through an IP port. Specify a port number here to activate this function."));
333 _outEphPortLineEdit->setWhatsThis(tr("BNC can produce ephemeris data in RINEX ASCII format on your local host through an IP port. Specify a port number here to activate this function."));
334 _corrPortLineEdit->setWhatsThis(tr("BNC can produce Broadcast Ephemeris Corrections on your local host through an IP port. Specify a port number here to activate this function."));
335 _corrTimeSpinBox->setWhatsThis(tr("Concerning output through IP port, BNC drops Broadcast Ephemeris Corrections received later than 'Wait for full epoch' seconds. A value of 2 to 5 seconds is recommended, depending on the latency of the incoming correction stream(s) and the delay acceptable to your real-time application."));
336 _rnxPathLineEdit->setWhatsThis(tr("Here you specify the path to where the RINEX Observation files will be stored. If the specified directory does not exist, BNC will not create RINEX Observation files."));
337 _ephPathLineEdit->setWhatsThis(tr("Specify the path for saving Broadcast Ephemeris data as RINEX Navigation files. If the specified directory does not exist, BNC will not create RINEX Navigation files."));
338 _corrPathLineEdit->setWhatsThis(tr("Specify a directory for saving Broadcast Ephemeris Correction files. If the specified directory does not exist, BNC will not create the files."));
339 _rnxScrpLineEdit->setWhatsThis(tr("<p>Whenever a RINEX Observation file is saved, you might want to compress, copy or upload it immediately via FTP. BNC allows you to execute a script/batch file to carry out these operations. To do that specify the full path of the script/batch file here. BNC will pass the full RINEX Observation file path to the script as a command line parameter (%1 on Windows systems, $1 onUnix/Linux systems).</p>"));
340 _rnxSkelLineEdit->setWhatsThis(tr("<p>BNC allows using personal skeleton files that contain the header records you would like to include. You can derive a personal RINEX header skeleton file from the information given in an up to date sitelog.</p><p>A file in the RINEX Observations 'Directory' with a 'Skeleton extension' suffix is interpreted by BNC as a personal RINEX header skeleton file for the corresponding stream.</p>"));
341 _rnxAppendCheckBox->setWhatsThis(tr("<p>When BNC is started, new files are created by default and any existing files with the same name will be overwritten. However, users might want to append already existing files following a restart of BNC, a system crash or when BNC crashed. Tick 'Append files' to continue with existing files and keep what has been recorded so far.</p>"));
342 _autoStartCheckBox->setWhatsThis(tr("<p>Tick 'Auto start' for auto-start of BNC at startup time in window mode with preassigned processing options.</p>"));
343 _onTheFlyComboBox->setWhatsThis(tr("<p>When operating BNC online in 'no window' mode, some configuration parameters can be changed on-the-fly without interrupting the running process. For that BNC rereads parts of its configuration in pre-defined intervals.<p></p>Select '1 min', '1 hour', or '1 day' to force BNC to reread its configuration every full minute, hour, or day and let in between edited configuration options become effective on-the-fly without terminating uninvolved threads.</p><p>Note that when operating BNC in window mode, on-the-fly changeable configuration options become effective immediately through 'Save & Reread Configuration'.</p>"));
344 _rnxIntrComboBox->setWhatsThis(tr("<p>Select the length of the RINEX Observation file.</p>"));
345 _ephIntrComboBox->setWhatsThis(tr("<p>Select the length of the RINEX Navigation file.</p>"));
346 _corrIntrComboBox->setWhatsThis(tr("<p>Select the length of the Broadcast Ephemeris Correction files.</p>"));
347 _rnxSamplSpinBox->setWhatsThis(tr("<p>Select the RINEX Observation sampling interval in seconds. A value of zero '0' tells BNC to store all received epochs into RINEX.</p>"));
348 _binSamplSpinBox->setWhatsThis(tr("<p>Select the synchronized observation sampling interval in seconds. A value of zero '0' tells BNC to send/store all received epochs.</p>"));
349 _obsRateComboBox->setWhatsThis(tr("<p>BNC can collect all returns (success or failure) coming from a decoder within a certain short time span to then decide whether a stream has an outage or its content is corrupted. The procedure needs a rough estimate of the expected 'Observation rate' of the incoming streams. When a continuous problem is detected, BNC can inform its operator about this event through an advisory note.</p>"));
350 _adviseRecoSpinBox->setWhatsThis(tr("<p>Following a stream outage or a longer series of bad observations, an advisory note is generated when valid observations are received again throughout the 'Recovery threshold' time span. A value of about 5min (default) is recommended.</p><p>A value of zero '0' means that for any stream recovery, however short, BNC immediately generates an advisory note.</p>"));
351 _adviseFailSpinBox->setWhatsThis(tr("<p>An advisory note is generated when no (or only corrupted) observations are seen throughout the 'Failure threshold' time span. A value of 15 min (default) is recommended.</p><p>A value of zero '0' means that for any stream failure, however short, BNC immediately generates an advisory note.</p>"));
352 _logFileLineEdit->setWhatsThis(tr("<p>Records of BNC's activities are shown in the 'Log' tab on the bottom of this window. They can be saved into a file when a valid path is specified in the 'Logfile (full path)' field.</p><p>The logfile name will automatically be extended by a string '_YYMMDD' carrying the current date."));
353 _adviseScriptLineEdit->setWhatsThis(tr("<p>Specify the full path to a script or batch file to handle advisory notes generated in the event of corrupted streams or stream outages. The affected mountpoint and one of the comments 'Begin_Outage', 'End_Outage', 'Begin_Corrupted', or 'End_Corrupted' are passed on to the script as command line parameters.</p><p>The script may have the task to send the advisory notes by email to BNC's operator and/or to the affected stream provider. An empty option field (default) or invalid path means that you don't want to use this option.</p>"));
354 _perfIntrComboBox->setWhatsThis(tr("<p>BNC can average latencies per stream over a certain period of GPS time. The resulting mean latencies are recorded in the 'Log' tab at the end of each 'Log latency' interval together with results of a statistical evaluation (approximate number of covered epochs, data gaps).</p><p>Select a 'Log latency' interval or select the empty option field if you do not want BNC to log latencies and statistical information.</p>"));
355 _mountPointsTable->setWhatsThis(tr("<p>Streams selected for retrieval are listed in the 'Streams' section. Clicking on 'Add Stream' button will open a window that allows the user to select data streams from an NTRIP broadcaster according to their mountpoints. To remove a stream from the 'Streams' list, highlight it by clicking on it and hit the 'Delete Stream' button. You can also remove multiple streams by highlighting them using +Shift and +Ctrl.</p><p>BNC automatically allocates one of its internal decoders to a stream based on the stream's 'format' as given in the sourcetable. BNC allows users to change this selection by editing the decoder string. Double click on the 'decoder' field, enter your preferred decoder and then hit Enter. The accepted decoder strings are 'RTCM_2.x', 'RTCM_3.x', and 'RTIGS'.</p><p>In case you need to log the raw data as is, BNC allows users to by-pass its decoders and and directly save the input in daily log files. To do this specify the decoder string as 'ZERO'.</p><p>BNC can also retrieve streams from virtual reference stations (VRS). VRS streams are indicated by a 'yes' in the 'nmea' column. To initiate these streams, the approximate latitude/longitude rover position is sent to the NTRIP broadcaster. The default values can be change according to your requirement. Double click on 'lat' and 'long' fields, enter the values you wish to send and then hit Enter.</p>"));
356 _log->setWhatsThis(tr("Records of BNC's activities are shown in the 'Log' tab. The message log covers the communication status between BNC and the NTRIP broadcaster as well as any problems that occur in the communication link, stream availability, stream delay, stream conversion etc."));
357 _bncFigure->setWhatsThis(tr("The bandwidth consumtion per stream is shown in the 'Throughput' tab in bits per second (bps) or kilo bits per second (kbps)."));
358 _bncFigureLate->setWhatsThis(tr("The individual latency of observations in each incoming stream is shown in the 'Latency' tab in milliseconds. Streams not carrying observations (i.e. those providing only broadcast ephemeris messages) are not considered here. Note that the calculation of correct latencies requires the clock of the host computer to be properly synchronized."));
359 _ephV3CheckBox->setWhatsThis(tr("The default format for output of RINEX Navigation data containing Broadcast Ephemeris is RINEX Version 2.11. Select 'Version 3' if you want to output the ephemeris in RINEX Version 3 format."));
360 _rnxV3CheckBox->setWhatsThis(tr("The default format for RINEX Observation files is RINEX Version 2.11. Select 'Version 3' if you want to save the observations in RINEX Version 3 format."));
361 _miscMountLineEdit->setWhatsThis(tr("<p>Specify a mountpoint to apply any of the options shown below. Enter 'ALL' if you want to apply these options to all configured streams.</p><p>An empty option field (default) means that you don't want BNC to apply any of these options.</p>"));
362 _scanRTCMCheckBox->setWhatsThis(tr("<p>Tick 'Scan RTCM' to log the numbers of incomming message types as well as contained antenna coordinates, antenna heigt, and antenna descriptor.</p>"));
363 _serialMountPointLineEdit->setWhatsThis(tr("<p>Enter a 'Mountpoint' to forward the corresponding stream to a serial connected receiver.</p>"));
364 _serialPortNameLineEdit->setWhatsThis(tr("<p>Enter the serial 'Port name' selected for communication with your serial connected receiver. Valid port names are</p><pre>Windows: COM1, COM2<br>Linux: /dev/ttyS0, /dev/ttyS1<br>FreeBSD: /dev/ttyd0, /dev/ttyd1<br>Digital Unix: /dev/tty01, /dev/tty02<br>HP-UX: /dev/tty1p0, /dev/tty2p0<br>SGI/IRIX: /dev/ttyf1, /dev/ttyf2<br>SunOS/Solaris: /dev/ttya, /dev/ttyb</pre><p>Note that you must plug a serial cable in the port defined here before you start BNC.</p>"));
365 _serialBaudRateComboBox->setWhatsThis(tr("<p>Select a 'Baud rate' for the serial output link.</p><p>Note that your selection must equal the baud rate configured to the serial connected receiver. Note further that using a high baud rate is recommended.</p>"));
366 _serialParityComboBox->setWhatsThis(tr("<p>Select the 'Parity' for the serial output link.</p><p>Note that your selection must equal the parity selection configured to the serial connected receiver. Note further that parity is often set to 'NONE'.</p>"));
367 _serialDataBitsComboBox->setWhatsThis(tr("<p>Select the number of 'Data bits' for the serial output link.</p><p>Note that your selection must equal the number of data bits configured to the serial connected receiver. Note further that often 8 data bits are used.</p>"));
368 _serialStopBitsComboBox->setWhatsThis(tr("<p>Select the number of 'Stop bits' for the serial output link.</p><p>Note that your selection must equal the number of stop bits configured to the serial connected receiver. Note further that often 1 stop bit is used.</p>"));
369 _serialFlowControlComboBox->setWhatsThis(tr("<p>Select a 'Flow control' for the serial output link.</p><p>Note that your selection must equal the flow control configured to the serial connected receiver. Select 'OFF' if you don't know better.</p>"));
370 _serialAutoNMEAComboBox->setWhatsThis(tr("<p>Select 'Auto' to automatically forward NMEA-GGA messages coming from your serial connected receiver to the NTRIP broadcaster and/or save them in a file.</p><p>Select 'Manual' only when handling a VRS stream and your serial connected receiver doesn't generate NMEA-GGA messages.</p>"));
371 _serialFileNMEALineEdit->setWhatsThis(tr("<p>Specify the full path to a file where NMEA messages coming from your serial connected receiver are saved.</p>"));
372 _serialHeightNMEALineEdit->setWhatsThis(tr("<p>Specify an approximate 'Height' above mean sea level in meter for your VRS to simulate an inital NMEA-GGA message.</p><p>The setting of this option is ignored in case of streams coming from physical reference stations.</p>"));
373
374 // Canvas with Editable Fields
375 // ---------------------------
376 _canvas = new QWidget;
377 setCentralWidget(_canvas);
378
379 _aogroup = new QTabWidget();
380 QWidget* pgroup = new QWidget();
381 QWidget* ggroup = new QWidget();
382 QWidget* sgroup = new QWidget();
383 QWidget* egroup = new QWidget();
384 QWidget* agroup = new QWidget();
385 QWidget* cgroup = new QWidget();
386 QWidget* ogroup = new QWidget();
387 QWidget* rgroup = new QWidget();
388 QWidget* sergroup = new QWidget();
389 _aogroup->addTab(pgroup,tr("Proxy"));
390 _aogroup->addTab(ggroup,tr("General"));
391 _aogroup->addTab(ogroup,tr("RINEX Observations"));
392 _aogroup->addTab(egroup,tr("RINEX Ephemeris"));
393 _aogroup->addTab(cgroup,tr("Broadcast Corrections"));
394 _aogroup->addTab(sgroup,tr("Feed Engine"));
395 _aogroup->addTab(sergroup,tr("Serial Output"));
396 _aogroup->addTab(agroup,tr("Outages"));
397 _aogroup->addTab(rgroup,tr("Miscellaneous"));
398
399 // Log Tab
400 // -------
401 _loggroup = new QTabWidget();
402 _loggroup->addTab(_log,tr("Log"));
403 _loggroup->addTab(_bncFigure,tr("Throughput"));
404 _loggroup->addTab(_bncFigureLate,tr("Latency"));
405
406 // Proxy Tab
407 // ---------
408 QGridLayout* pLayout = new QGridLayout;
409 pLayout->setColumnMinimumWidth(0,13*ww);
410 _proxyPortLineEdit->setMaximumWidth(9*ww);
411
412 pLayout->addWidget(new QLabel("Proxy host"), 0, 0);
413 pLayout->addWidget(_proxyHostLineEdit, 0, 1, 1,10);
414 pLayout->addWidget(new QLabel("Proxy port"), 1, 0);
415 pLayout->addWidget(_proxyPortLineEdit, 1, 1);
416 pLayout->addWidget(new QLabel("Settings for proxy in protected networks, leave boxes blank if none."),2, 0, 1, 50, Qt::AlignLeft);
417 pLayout->addWidget(new QLabel(" "),3,0);
418 pLayout->addWidget(new QLabel(" "),4,0);
419 pLayout->addWidget(new QLabel(" "),5,0);
420 pgroup->setLayout(pLayout);
421
422
423 connect(_proxyHostLineEdit, SIGNAL(textChanged(const QString &)),
424 this, SLOT(bncText(const QString &)));
425 if (_proxyHostLineEdit->text().isEmpty()) {
426 _proxyPortLineEdit->setStyleSheet("background-color: lightGray");
427 _proxyPortLineEdit->setEnabled(false);
428 }
429
430 // General Tab
431 // -----------
432 QGridLayout* gLayout = new QGridLayout;
433 gLayout->setColumnMinimumWidth(0,14*ww);
434 _onTheFlyComboBox->setMaximumWidth(9*ww);
435
436 gLayout->addWidget(new QLabel("Logfile (full path)"), 0, 0);
437 gLayout->addWidget(_logFileLineEdit, 0, 1, 1,30); // 1
438 gLayout->addWidget(new QLabel("Append files"), 1, 0);
439 gLayout->addWidget(_rnxAppendCheckBox, 1, 1);
440 gLayout->addWidget(new QLabel("Reread configuration"), 2, 0);
441 gLayout->addWidget(_onTheFlyComboBox, 2, 1);
442 gLayout->addWidget(new QLabel("Auto start"), 3, 0);
443 gLayout->addWidget(_autoStartCheckBox, 3, 1);
444 gLayout->addWidget(new QLabel("General settings for logfile, file handling, configuration on-the-fly, and auto-start."),4, 0, 1, 50, Qt::AlignLeft); // 2
445 gLayout->addWidget(new QLabel(" "),5,0);
446 ggroup->setLayout(gLayout);
447
448 // RINEX Observations
449 // ------------------
450 QGridLayout* oLayout = new QGridLayout;
451 oLayout->setColumnMinimumWidth(0,14*ww);
452 _rnxIntrComboBox->setMaximumWidth(9*ww);
453 _rnxSamplSpinBox->setMaximumWidth(9*ww);
454
455 oLayout->addWidget(new QLabel("Directory"), 0, 0);
456 oLayout->addWidget(_rnxPathLineEdit, 0, 1,1,24);
457 oLayout->addWidget(new QLabel("Interval"), 1, 0);
458 oLayout->addWidget(_rnxIntrComboBox, 1, 1);
459 oLayout->addWidget(new QLabel(" Sampling"), 1, 2, Qt::AlignRight);
460 oLayout->addWidget(_rnxSamplSpinBox, 1, 3, Qt::AlignLeft);
461 oLayout->addWidget(new QLabel("Skeleton extension"), 2, 0);
462 oLayout->addWidget(_rnxSkelLineEdit, 2, 1,1,1, Qt::AlignLeft);
463 oLayout->addWidget(new QLabel("Script (full path)"), 3, 0);
464 oLayout->addWidget(_rnxScrpLineEdit, 3, 1,1,24);
465 oLayout->addWidget(new QLabel("Version 3"), 4, 0);
466 oLayout->addWidget(_rnxV3CheckBox, 4, 1);
467 oLayout->addWidget(new QLabel("Saving RINEX observation files."),5,0,1,50, Qt::AlignLeft);
468 ogroup->setLayout(oLayout);
469
470 connect(_rnxPathLineEdit, SIGNAL(textChanged(const QString &)),
471 this, SLOT(bncText(const QString &)));
472 if (_rnxPathLineEdit->text().isEmpty()) {
473 _rnxIntrComboBox->setStyleSheet("background-color: lightGray");
474 _rnxSamplSpinBox->setStyleSheet("background-color: lightGray");
475 _rnxSkelLineEdit->setStyleSheet("background-color: lightGray");
476 _rnxScrpLineEdit->setStyleSheet("background-color: lightGray");
477 palette.setColor(_rnxV3CheckBox->backgroundRole(), lightGray);
478 _rnxV3CheckBox->setPalette(palette);
479 _rnxIntrComboBox->setEnabled(false);
480 _rnxSamplSpinBox->setEnabled(false);
481 _rnxSkelLineEdit->setEnabled(false);
482 _rnxScrpLineEdit->setEnabled(false);
483 _rnxV3CheckBox->setEnabled(false);
484 }
485
486 // RINEX Ephemeris
487 // ---------------
488 QGridLayout* eLayout = new QGridLayout;
489 eLayout->setColumnMinimumWidth(0,14*ww);
490 _ephIntrComboBox->setMaximumWidth(9*ww);
491 _outEphPortLineEdit->setMaximumWidth(9*ww);
492
493 eLayout->addWidget(new QLabel("Directory"), 0, 0);
494 eLayout->addWidget(_ephPathLineEdit, 0, 1, 1,30);
495 eLayout->addWidget(new QLabel("Interval"), 1, 0);
496 eLayout->addWidget(_ephIntrComboBox, 1, 1);
497 eLayout->addWidget(new QLabel("Port"), 2, 0);
498 eLayout->addWidget(_outEphPortLineEdit, 2, 1);
499 eLayout->addWidget(new QLabel("Version 3"), 3, 0);
500 eLayout->addWidget(_ephV3CheckBox, 3, 1);
501 eLayout->addWidget(new QLabel("Saving RINEX ephemeris files and ephemeris output through IP port."),4,0,1,50,Qt::AlignLeft);
502 eLayout->addWidget(new QLabel(" "),5,0);
503 egroup->setLayout(eLayout);
504
505 connect(_ephPathLineEdit, SIGNAL(textChanged(const QString &)),
506 this, SLOT(bncText(const QString &)));
507 connect(_outEphPortLineEdit, SIGNAL(textChanged(const QString &)),
508 this, SLOT(bncText(const QString &)));
509
510 if (_ephPathLineEdit->text().isEmpty() && _outEphPortLineEdit->text().isEmpty()) {
511 _ephIntrComboBox->setStyleSheet("background-color: lightGray");
512 palette.setColor(_ephV3CheckBox->backgroundRole(), lightGray);
513 _ephV3CheckBox->setPalette(palette);
514 _ephIntrComboBox->setEnabled(false);
515 _ephV3CheckBox->setEnabled(false);
516 }
517 if (_ephPathLineEdit->text().isEmpty() && !_outEphPortLineEdit->text().isEmpty()) {
518 _ephIntrComboBox->setStyleSheet("background-color: lightGray");
519 _ephIntrComboBox->setEnabled(false);
520 }
521
522 // Broadcast Corrections
523 // ---------------------
524 QGridLayout* cLayout = new QGridLayout;
525 cLayout->setColumnMinimumWidth(0,14*ww);
526 _corrIntrComboBox->setMaximumWidth(9*ww);
527 _corrPortLineEdit->setMaximumWidth(9*ww);
528 _corrTimeSpinBox->setMaximumWidth(9*ww);
529
530 cLayout->addWidget(new QLabel("Directory"), 0, 0);
531 cLayout->addWidget(_corrPathLineEdit, 0, 1,1,20);
532 cLayout->addWidget(new QLabel("Interval"), 1, 0);
533 cLayout->addWidget(_corrIntrComboBox, 1, 1);
534 cLayout->addWidget(new QLabel("Port"), 2, 0);
535 cLayout->addWidget(_corrPortLineEdit, 2, 1);
536 cLayout->addWidget(new QLabel(" Wait for full epoch"), 2, 2, Qt::AlignRight);
537 cLayout->addWidget(_corrTimeSpinBox, 2, 3, Qt::AlignLeft);
538 cLayout->addWidget(new QLabel("Saving Broadcast Ephemeris correction files and correction output through IP port."),3,0,1,50);
539 cLayout->addWidget(new QLabel(" "),4,0);
540 cLayout->addWidget(new QLabel(" "),5,0);
541 cgroup->setLayout(cLayout);
542
543 connect(_corrPathLineEdit, SIGNAL(textChanged(const QString &)),
544 this, SLOT(bncText(const QString &)));
545 connect(_corrPortLineEdit, SIGNAL(textChanged(const QString &)),
546 this, SLOT(bncText(const QString &)));
547 if (_corrPathLineEdit->text().isEmpty()) {
548 _corrIntrComboBox->setStyleSheet("background-color: lightGray");
549 _corrIntrComboBox->setEnabled(false);
550 }
551 if (_corrPortLineEdit->text().isEmpty()) {
552 _corrTimeSpinBox->setStyleSheet("background-color: lightGray");
553 _corrTimeSpinBox->setEnabled(false);
554 }
555
556 // Feed Engine
557 // -----------
558 QGridLayout* sLayout = new QGridLayout;
559 sLayout->setColumnMinimumWidth(0,14*ww);
560 _outPortLineEdit->setMaximumWidth(9*ww);
561 _waitTimeSpinBox->setMaximumWidth(9*ww);
562 _binSamplSpinBox->setMaximumWidth(9*ww);
563 _outUPortLineEdit->setMaximumWidth(9*ww);
564
565 sLayout->addWidget(new QLabel("Port"), 0, 0);
566 sLayout->addWidget(_outPortLineEdit, 0, 1);
567 sLayout->addWidget(new QLabel("Wait for full epoch"), 0, 2, Qt::AlignRight);
568 sLayout->addWidget(_waitTimeSpinBox, 0, 3, Qt::AlignLeft);
569 sLayout->addWidget(new QLabel("Sampling"), 1, 0);
570 sLayout->addWidget(_binSamplSpinBox, 1, 1, Qt::AlignLeft);
571 sLayout->addWidget(new QLabel("File (full path)"), 2, 0);
572 sLayout->addWidget(_outFileLineEdit, 2, 1, 1, 20);
573 sLayout->addWidget(new QLabel("Port (unsynchronized)"), 3, 0);
574 sLayout->addWidget(_outUPortLineEdit, 3, 1);
575 sLayout->addWidget(new QLabel("Output decoded observations in a binary format to feed a real-time GNSS network engine."),4,0,1,50);
576 sLayout->addWidget(new QLabel(" "),5,0);
577 sgroup->setLayout(sLayout);
578
579 connect(_outPortLineEdit, SIGNAL(textChanged(const QString &)),
580 this, SLOT(bncText(const QString &)));
581 connect(_outFileLineEdit, SIGNAL(textChanged(const QString &)),
582 this, SLOT(bncText(const QString &)));
583 if (_outPortLineEdit->text().isEmpty() && _outFileLineEdit->text().isEmpty()) {
584 _waitTimeSpinBox->setStyleSheet("background-color: lightGray");
585 _binSamplSpinBox->setStyleSheet("background-color: lightGray");
586 _waitTimeSpinBox->setEnabled(false);
587 _binSamplSpinBox->setEnabled(false);
588 }
589
590 // Serial Output
591 // -------------
592 QGridLayout* serLayout = new QGridLayout;
593 serLayout->setColumnMinimumWidth(0,14*ww);
594 _serialBaudRateComboBox->setMaximumWidth(9*ww);
595 _serialFlowControlComboBox->setMaximumWidth(11*ww);
596 _serialDataBitsComboBox->setMaximumWidth(5*ww);
597 _serialParityComboBox->setMaximumWidth(9*ww);
598 _serialStopBitsComboBox->setMaximumWidth(5*ww);
599 _serialAutoNMEAComboBox->setMaximumWidth(9*ww);
600 _serialHeightNMEALineEdit->setMaximumWidth(8*ww);
601
602 serLayout->addWidget(new QLabel("Mountpoint"), 0,0, Qt::AlignLeft);
603 serLayout->addWidget(_serialMountPointLineEdit, 0,1,1,2);
604 serLayout->addWidget(new QLabel("Port name"), 1,0, Qt::AlignLeft);
605 serLayout->addWidget(_serialPortNameLineEdit, 1,1,1,2);
606 serLayout->addWidget(new QLabel("Baud rate"), 2,0, Qt::AlignLeft);
607 serLayout->addWidget(_serialBaudRateComboBox, 2,1);
608 serLayout->addWidget(new QLabel("Flow control"), 2,2, Qt::AlignRight);
609 serLayout->addWidget(_serialFlowControlComboBox, 2,3);
610 serLayout->addWidget(new QLabel("Data bits"), 3,0, Qt::AlignLeft);
611 serLayout->addWidget(_serialDataBitsComboBox, 3,1);
612 serLayout->addWidget(new QLabel("Parity"), 3,2, Qt::AlignRight);
613 serLayout->addWidget(_serialParityComboBox, 3,3);
614 serLayout->addWidget(new QLabel(" Stop bits"), 3,4, Qt::AlignRight);
615 serLayout->addWidget(_serialStopBitsComboBox, 3,5);
616 serLayout->addWidget(new QLabel("NMEA"), 4,0);
617 serLayout->addWidget(_serialAutoNMEAComboBox, 4,1);
618 serLayout->addWidget(new QLabel(" File (full path)"), 4,2, Qt::AlignRight);
619 serLayout->addWidget(_serialFileNMEALineEdit, 4,3,1,15);
620 serLayout->addWidget(new QLabel("Height"), 4,20, Qt::AlignRight);
621 serLayout->addWidget(_serialHeightNMEALineEdit, 4,21,1,11);
622 serLayout->addWidget(new QLabel("Port settings to feed a serial connected receiver."),5,0,1,30);
623
624 connect(_serialMountPointLineEdit, SIGNAL(textChanged(const QString &)),
625 this, SLOT(bncText(const QString &)));
626 connect(_serialAutoNMEAComboBox, SIGNAL(currentIndexChanged(const QString &)),
627 this, SLOT(bncText(const QString)));
628 if (_serialMountPointLineEdit->text().isEmpty()) {
629 _serialPortNameLineEdit->setStyleSheet("background-color: lightGray");
630 _serialBaudRateComboBox->setStyleSheet("background-color: lightGray");
631 _serialParityComboBox->setStyleSheet("background-color: lightGray");
632 _serialDataBitsComboBox->setStyleSheet("background-color: lightGray");
633 _serialStopBitsComboBox->setStyleSheet("background-color: lightGray");
634 _serialFlowControlComboBox->setStyleSheet("background-color: lightGray");
635 _serialAutoNMEAComboBox->setStyleSheet("background-color: lightGray");
636 _serialFileNMEALineEdit->setStyleSheet("background-color: lightGray");
637 _serialHeightNMEALineEdit->setStyleSheet("background-color: lightGray");
638 _serialPortNameLineEdit->setEnabled(false);
639 _serialBaudRateComboBox->setEnabled(false);
640 _serialParityComboBox->setEnabled(false);
641 _serialDataBitsComboBox->setEnabled(false);
642 _serialStopBitsComboBox->setEnabled(false);
643 _serialFlowControlComboBox->setEnabled(false);
644 _serialAutoNMEAComboBox->setEnabled(false);
645 _serialFileNMEALineEdit->setEnabled(false);
646 _serialHeightNMEALineEdit->setEnabled(false);
647 } else {
648 if (_serialAutoNMEAComboBox->currentText() == "Auto" ) {
649 _serialHeightNMEALineEdit->setStyleSheet("background-color: lightGray");
650 _serialHeightNMEALineEdit->setEnabled(false);
651 }
652 if (_serialAutoNMEAComboBox->currentText() != "Auto" ) {
653 _serialFileNMEALineEdit->setStyleSheet("background-color: lightGray");
654 _serialFileNMEALineEdit->setEnabled(false);
655 }
656 }
657
658 sergroup->setLayout(serLayout);
659
660 // Outages
661 // -------
662 QGridLayout* aLayout = new QGridLayout;
663 aLayout->setColumnMinimumWidth(0,14*ww);
664 _obsRateComboBox->setMaximumWidth(9*ww);
665 _adviseFailSpinBox->setMaximumWidth(9*ww);
666 _adviseRecoSpinBox->setMaximumWidth(9*ww);
667
668 aLayout->addWidget(new QLabel("Observation rate"), 0, 0);
669 aLayout->addWidget(_obsRateComboBox, 0, 1);
670 aLayout->addWidget(new QLabel("Failure threshold"), 1, 0);
671 aLayout->addWidget(_adviseFailSpinBox, 1, 1);
672 aLayout->addWidget(new QLabel("Recovery threshold"), 2, 0);
673 aLayout->addWidget(_adviseRecoSpinBox, 2, 1);
674 aLayout->addWidget(new QLabel("Script (full path)"), 3, 0);
675 aLayout->addWidget(_adviseScriptLineEdit, 3, 1,1,30);
676 aLayout->addWidget(new QLabel("Failure and recovery reports, advisory notes."),5,0,1,50,Qt::AlignLeft);
677 agroup->setLayout(aLayout);
678
679 connect(_obsRateComboBox, SIGNAL(currentIndexChanged(const QString &)),
680 this, SLOT(bncText(const QString)));
681 if (_obsRateComboBox->currentText().isEmpty()) {
682 _adviseFailSpinBox->setStyleSheet("background-color: lightGray");
683 _adviseRecoSpinBox->setStyleSheet("background-color: lightGray");
684 _adviseScriptLineEdit->setStyleSheet("background-color: lightGray");
685 _adviseFailSpinBox->setEnabled(false);
686 _adviseRecoSpinBox->setEnabled(false);
687 _adviseScriptLineEdit->setEnabled(false);
688 }
689
690 // Miscellaneous
691 // -------------
692 QGridLayout* rLayout = new QGridLayout;
693 rLayout->setColumnMinimumWidth(0,14*ww);
694 _perfIntrComboBox->setMaximumWidth(9*ww);
695
696 rLayout->addWidget(new QLabel("Mountpoint"), 0, 0);
697 rLayout->addWidget(_miscMountLineEdit, 0, 1, 1,7);
698 rLayout->addWidget(new QLabel("Log latency"), 1, 0);
699 rLayout->addWidget(_perfIntrComboBox, 1, 1);
700 rLayout->addWidget(new QLabel("Scan RTCM"), 2, 0);
701 rLayout->addWidget(_scanRTCMCheckBox, 2, 1);
702 rLayout->addWidget(new QLabel("Log latencies or scan RTCM streams for numbers of message types and antenna information."),3, 0,1,30);
703 rLayout->addWidget(new QLabel(" "), 4, 0);
704 rLayout->addWidget(new QLabel(" "), 5, 0);
705 rgroup->setLayout(rLayout);
706
707 connect(_miscMountLineEdit, SIGNAL(textChanged(const QString &)),
708 this, SLOT(bncText(const QString &)));
709 if (_miscMountLineEdit->text().isEmpty()) {
710 _perfIntrComboBox->setStyleSheet("background-color: lightGray");
711 palette.setColor(_scanRTCMCheckBox->backgroundRole(), lightGray);
712 _scanRTCMCheckBox->setPalette(palette);
713 _perfIntrComboBox->setEnabled(false);
714 _scanRTCMCheckBox->setEnabled(false);
715 }
716
717 // Main Layout
718 // -----------
719
720 QGridLayout* mLayout = new QGridLayout;
721 _aogroup->setCurrentIndex(settings.value("startTab").toInt());
722 mLayout->addWidget(_aogroup, 0,0);
723 mLayout->addWidget(_mountPointsTable, 1,0);
724 _loggroup->setCurrentIndex(settings.value("statusTab").toInt());
725 mLayout->addWidget(_loggroup, 2,0);
726
727 _canvas->setLayout(mLayout);
728
729 // Auto start
730 // ----------
731 if ( Qt::CheckState(settings.value("autoStart").toInt()) == Qt::Checked) {
732 slotGetData();
733 }
734}
735
736// Destructor
737////////////////////////////////////////////////////////////////////////////
738bncWindow::~bncWindow() {
739 delete _caster;
740}
741
742//
743////////////////////////////////////////////////////////////////////////////
744void bncWindow::populateMountPointsTable() {
745
746 for (int iRow = _mountPointsTable->rowCount()-1; iRow >=0; iRow--) {
747 _mountPointsTable->removeRow(iRow);
748 }
749
750 bncSettings settings;
751
752 QListIterator<QString> it(settings.value("mountPoints").toStringList());
753 if (!it.hasNext()) {
754 _actGetData->setEnabled(false);
755 }
756 int iRow = 0;
757 while (it.hasNext()) {
758 QStringList hlp = it.next().split(" ");
759 if (hlp.size() < 5) continue;
760 _mountPointsTable->insertRow(iRow);
761
762 QUrl url(hlp[0]);
763
764 QString fullPath = url.host() + QString(":%1").arg(url.port()) + url.path();
765 QString format(hlp[1]); QString latitude(hlp[2]); QString longitude(hlp[3]);
766 QString nmea(hlp[4]);
767 if (hlp[5] == "S") {
768 fullPath = hlp[0].replace(0,2,"");
769 }
770 QString ntripVersion = "1";
771 if (hlp.size() >= 6) {
772 ntripVersion = (hlp[5]);
773 }
774
775 QTableWidgetItem* it;
776 it = new QTableWidgetItem(url.userInfo());
777 it->setFlags(it->flags() & ~Qt::ItemIsEditable);
778 _mountPointsTable->setItem(iRow, 0, it);
779
780 it = new QTableWidgetItem(fullPath);
781 it->setFlags(it->flags() & ~Qt::ItemIsEditable);
782 _mountPointsTable->setItem(iRow, 1, it);
783
784 it = new QTableWidgetItem(format);
785 _mountPointsTable->setItem(iRow, 2, it);
786
787 if (nmea == "yes") {
788 it = new QTableWidgetItem(latitude);
789 _mountPointsTable->setItem(iRow, 3, it);
790 it = new QTableWidgetItem(longitude);
791 _mountPointsTable->setItem(iRow, 4, it);
792 } else {
793 it = new QTableWidgetItem(latitude);
794 it->setFlags(it->flags() & ~Qt::ItemIsEditable);
795 _mountPointsTable->setItem(iRow, 3, it);
796 it = new QTableWidgetItem(longitude);
797 it->setFlags(it->flags() & ~Qt::ItemIsEditable);
798 _mountPointsTable->setItem(iRow, 4, it);
799 }
800
801 it = new QTableWidgetItem(nmea);
802 it->setFlags(it->flags() & ~Qt::ItemIsEditable);
803 _mountPointsTable->setItem(iRow, 5, it);
804
805 it = new QTableWidgetItem(ntripVersion);
806 //// it->setFlags(it->flags() & ~Qt::ItemIsEditable);
807 _mountPointsTable->setItem(iRow, 6, it);
808
809 bncTableItem* bncIt = new bncTableItem();
810 bncIt->setFlags(bncIt->flags() & ~Qt::ItemIsEditable);
811 _mountPointsTable->setItem(iRow, 7, bncIt);
812
813 iRow++;
814 }
815
816 _mountPointsTable->sortItems(1);
817}
818
819// Retrieve Table
820////////////////////////////////////////////////////////////////////////////
821void bncWindow::slotAddMountPoints() {
822
823 bncSettings settings;
824 QString proxyHost = settings.value("proxyHost").toString();
825 int proxyPort = settings.value("proxyPort").toInt();
826 if (proxyHost != _proxyHostLineEdit->text() ||
827 proxyPort != _proxyPortLineEdit->text().toInt()) {
828 int iRet = QMessageBox::question(this, "Question", "Proxy options "
829 "changed. Use the new ones?",
830 QMessageBox::Yes, QMessageBox::No,
831 QMessageBox::NoButton);
832 if (iRet == QMessageBox::Yes) {
833 settings.setValue("proxyHost", _proxyHostLineEdit->text());
834 settings.setValue("proxyPort", _proxyPortLineEdit->text());
835 settings.sync();
836 }
837 }
838
839 QMessageBox msgBox;
840 msgBox.setIcon(QMessageBox::Question);
841 msgBox.setWindowTitle("Add Stream");
842 msgBox.setText("Add stream(s) coming from:");
843
844 QPushButton* buttonNtrip = msgBox.addButton(tr("Caster"), QMessageBox::ActionRole);
845 QPushButton* buttonIP = msgBox.addButton(tr("TCP/IP port"), QMessageBox::ActionRole);
846 QPushButton* buttonUDP = msgBox.addButton(tr("UDP port"), QMessageBox::ActionRole);
847 QPushButton* buttonSerial = msgBox.addButton(tr("Serial port"), QMessageBox::ActionRole);
848 QPushButton* buttonCancel = msgBox.addButton(tr("Cancel"), QMessageBox::ActionRole);
849
850 msgBox.exec();
851
852 if (msgBox.clickedButton() == buttonNtrip) {
853 bncTableDlg* dlg = new bncTableDlg(this);
854 dlg->move(this->pos().x()+50, this->pos().y()+50);
855 connect(dlg, SIGNAL(newMountPoints(QStringList*)),
856 this, SLOT(slotNewMountPoints(QStringList*)));
857 dlg->exec();
858 delete dlg;
859 } else if (msgBox.clickedButton() == buttonIP) {
860 bncIpPort* ipp = new bncIpPort(this);
861 connect(ipp, SIGNAL(newMountPoints(QStringList*)),
862 this, SLOT(slotNewMountPoints(QStringList*)));
863 ipp->exec();
864 delete ipp;
865 } else if (msgBox.clickedButton() == buttonUDP) {
866 bncUdpPort* udp = new bncUdpPort(this);
867 connect(udp, SIGNAL(newMountPoints(QStringList*)),
868 this, SLOT(slotNewMountPoints(QStringList*)));
869 udp->exec();
870 delete udp;
871 } else if (msgBox.clickedButton() == buttonSerial) {
872 bncSerialPort* sep = new bncSerialPort(this);
873 connect(sep, SIGNAL(newMountPoints(QStringList*)),
874 this, SLOT(slotNewMountPoints(QStringList*)));
875 sep->exec();
876 delete sep;
877 } else if (msgBox.clickedButton() == buttonCancel) {
878 // Cancel
879 }
880}
881
882// Delete Selected Mount Points
883////////////////////////////////////////////////////////////////////////////
884void bncWindow::slotDeleteMountPoints() {
885
886 int nRows = _mountPointsTable->rowCount();
887 bool flg[nRows];
888 for (int iRow = 0; iRow < nRows; iRow++) {
889 if (_mountPointsTable->isItemSelected(_mountPointsTable->item(iRow,1))) {
890 flg[iRow] = true;
891 }
892 else {
893 flg[iRow] = false;
894 }
895 }
896 for (int iRow = nRows-1; iRow >= 0; iRow--) {
897 if (flg[iRow]) {
898 _mountPointsTable->removeRow(iRow);
899 }
900 }
901 _actDeleteMountPoints->setEnabled(false);
902
903 if (_mountPointsTable->rowCount() == 0) {
904 _actGetData->setEnabled(false);
905 }
906}
907
908// New Mount Points Selected
909////////////////////////////////////////////////////////////////////////////
910void bncWindow::slotNewMountPoints(QStringList* mountPoints) {
911 int iRow = 0;
912 QListIterator<QString> it(*mountPoints);
913 while (it.hasNext()) {
914 QStringList hlp = it.next().split(" ");
915 QUrl url(hlp[0]);
916 QString fullPath = url.host() + QString(":%1").arg(url.port()) + url.path();
917 QString format(hlp[1]); QString latitude(hlp[2]); QString longitude(hlp[3]);
918 QString nmea(hlp[4]);
919 if (hlp[5] == "S") {
920 fullPath = hlp[0].replace(0,2,"");
921 }
922 QString ntripVersion = "1";
923 if (hlp.size() >= 6) {
924 ntripVersion = (hlp[5]);
925 }
926
927 _mountPointsTable->insertRow(iRow);
928
929 QTableWidgetItem* it;
930 it = new QTableWidgetItem(url.userInfo());
931 it->setFlags(it->flags() & ~Qt::ItemIsEditable);
932 _mountPointsTable->setItem(iRow, 0, it);
933
934 it = new QTableWidgetItem(fullPath);
935 it->setFlags(it->flags() & ~Qt::ItemIsEditable);
936 _mountPointsTable->setItem(iRow, 1, it);
937
938 it = new QTableWidgetItem(format);
939 _mountPointsTable->setItem(iRow, 2, it);
940
941 if (nmea == "yes") {
942 it = new QTableWidgetItem(latitude);
943 _mountPointsTable->setItem(iRow, 3, it);
944 it = new QTableWidgetItem(longitude);
945 _mountPointsTable->setItem(iRow, 4, it);
946 } else {
947 it = new QTableWidgetItem(latitude);
948 it->setFlags(it->flags() & ~Qt::ItemIsEditable);
949 _mountPointsTable->setItem(iRow, 3, it);
950 it = new QTableWidgetItem(longitude);
951 it->setFlags(it->flags() & ~Qt::ItemIsEditable);
952 _mountPointsTable->setItem(iRow, 4, it);
953 }
954
955 it = new QTableWidgetItem(nmea);
956 it->setFlags(it->flags() & ~Qt::ItemIsEditable);
957 _mountPointsTable->setItem(iRow, 5, it);
958
959 it = new QTableWidgetItem(ntripVersion);
960 it->setFlags(it->flags() & ~Qt::ItemIsEditable);
961 _mountPointsTable->setItem(iRow, 6, it);
962
963 bncTableItem* bncIt = new bncTableItem();
964 _mountPointsTable->setItem(iRow, 7, bncIt);
965
966 iRow++;
967 }
968 _mountPointsTable->hideColumn(0);
969 _mountPointsTable->sortItems(1);
970 if (mountPoints->count() > 0 && !_actStop->isEnabled()) {
971 _actGetData->setEnabled(true);
972 }
973 delete mountPoints;
974}
975
976// Save Options
977////////////////////////////////////////////////////////////////////////////
978void bncWindow::slotSaveOptions() {
979
980 QStringList mountPoints;
981 for (int iRow = 0; iRow < _mountPointsTable->rowCount(); iRow++) {
982
983 if (_mountPointsTable->item(iRow, 6)->text() != "S") {
984 QUrl url( "//" + _mountPointsTable->item(iRow, 0)->text() +
985 "@" + _mountPointsTable->item(iRow, 1)->text() );
986
987 mountPoints.append(url.toString() + " " +
988 _mountPointsTable->item(iRow, 2)->text()
989 + " " + _mountPointsTable->item(iRow, 3)->text()
990 + " " + _mountPointsTable->item(iRow, 4)->text()
991 + " " + _mountPointsTable->item(iRow, 5)->text()
992 + " " + _mountPointsTable->item(iRow, 6)->text());
993 } else {
994 mountPoints.append(
995 "//" + _mountPointsTable->item(iRow, 1)->text()
996 + " " + _mountPointsTable->item(iRow, 2)->text()
997 + " " + _mountPointsTable->item(iRow, 3)->text()
998 + " " + _mountPointsTable->item(iRow, 4)->text()
999 + " " + _mountPointsTable->item(iRow, 5)->text()
1000 + " " + _mountPointsTable->item(iRow, 6)->text());
1001 }
1002 }
1003
1004 bncSettings settings;
1005
1006 settings.setValue("adviseFail", _adviseFailSpinBox->value());
1007 settings.setValue("adviseReco", _adviseRecoSpinBox->value());
1008 settings.setValue("adviseScript",_adviseScriptLineEdit->text());
1009 settings.setValue("autoStart", _autoStartCheckBox->checkState());
1010 settings.setValue("binSampl", _binSamplSpinBox->value());
1011 settings.setValue("corrIntr", _corrIntrComboBox->currentText());
1012 settings.setValue("corrPath", _corrPathLineEdit->text());
1013 settings.setValue("corrPort", _corrPortLineEdit->text());
1014 settings.setValue("corrTime", _corrTimeSpinBox->value());
1015 settings.setValue("ephIntr", _ephIntrComboBox->currentText());
1016 settings.setValue("ephPath", _ephPathLineEdit->text());
1017 settings.setValue("ephV3", _ephV3CheckBox->checkState());
1018 settings.setValue("logFile", _logFileLineEdit->text());
1019 settings.setValue("miscMount", _miscMountLineEdit->text());
1020 settings.setValue("mountPoints", mountPoints);
1021 settings.setValue("obsRate", _obsRateComboBox->currentText());
1022 settings.setValue("onTheFlyInterval", _onTheFlyComboBox->currentText());
1023 settings.setValue("outEphPort", _outEphPortLineEdit->text());
1024 settings.setValue("outFile", _outFileLineEdit->text());
1025 settings.setValue("outPort", _outPortLineEdit->text());
1026 settings.setValue("outUPort", _outUPortLineEdit->text());
1027 settings.setValue("perfIntr", _perfIntrComboBox->currentText());
1028 settings.setValue("proxyHost", _proxyHostLineEdit->text());
1029 settings.setValue("proxyPort", _proxyPortLineEdit->text());
1030 settings.setValue("rnxAppend", _rnxAppendCheckBox->checkState());
1031 settings.setValue("rnxIntr", _rnxIntrComboBox->currentText());
1032 settings.setValue("rnxPath", _rnxPathLineEdit->text());
1033 settings.setValue("rnxSampl", _rnxSamplSpinBox->value());
1034 settings.setValue("rnxScript", _rnxScrpLineEdit->text());
1035 settings.setValue("rnxSkel", _rnxSkelLineEdit->text());
1036 settings.setValue("rnxV3", _rnxV3CheckBox->checkState());
1037 settings.setValue("scanRTCM", _scanRTCMCheckBox->checkState());
1038 settings.setValue("serialFileNMEA",_serialFileNMEALineEdit->text());
1039 settings.setValue("serialHeightNMEA",_serialHeightNMEALineEdit->text());
1040 settings.setValue("serialAutoNMEA", _serialAutoNMEAComboBox->currentText());
1041 settings.setValue("serialBaudRate", _serialBaudRateComboBox->currentText());
1042 settings.setValue("serialDataBits", _serialDataBitsComboBox->currentText());
1043 settings.setValue("serialMountPoint",_serialMountPointLineEdit->text());
1044 settings.setValue("serialParity", _serialParityComboBox->currentText());
1045 settings.setValue("serialPortName", _serialPortNameLineEdit->text());
1046 settings.setValue("serialStopBits", _serialStopBitsComboBox->currentText());
1047 settings.setValue("serialFlowControl",_serialFlowControlComboBox->currentText());
1048 settings.setValue("startTab", _aogroup->currentIndex());
1049 settings.setValue("statusTab", _loggroup->currentIndex());
1050 settings.setValue("waitTime", _waitTimeSpinBox->value());
1051
1052 if (_caster) {
1053 _caster->slotReadMountPoints();
1054 }
1055 settings.sync();
1056}
1057
1058// All get slots terminated
1059////////////////////////////////////////////////////////////////////////////
1060void bncWindow::slotGetThreadsFinished() {
1061 ((bncApp*)qApp)->slotMessage("All Get Threads Terminated", true);
1062 delete _caster; _caster = 0;
1063 _actGetData->setEnabled(true);
1064 _actStop->setEnabled(false);
1065}
1066
1067// Retrieve Data
1068////////////////////////////////////////////////////////////////////////////
1069void bncWindow::slotGetData() {
1070 slotSaveOptions();
1071
1072 _actDeleteMountPoints->setEnabled(false);
1073 _actGetData->setEnabled(false);
1074 _actStop->setEnabled(true);
1075
1076 _caster = new bncCaster(_outFileLineEdit->text(),
1077 _outPortLineEdit->text().toInt());
1078
1079 ((bncApp*)qApp)->setPort(_outEphPortLineEdit->text().toInt());
1080 ((bncApp*)qApp)->setPortCorr(_corrPortLineEdit->text().toInt());
1081
1082 connect(_caster, SIGNAL(getThreadsFinished()),
1083 this, SLOT(slotGetThreadsFinished()));
1084
1085 connect (_caster, SIGNAL(mountPointsRead(QList<bncGetThread*>)),
1086 this, SLOT(slotMountPointsRead(QList<bncGetThread*>)));
1087
1088 ((bncApp*)qApp)->slotMessage("============ Start BNC ============", true);
1089
1090 bncSettings settings;
1091
1092 QDir rnxdir(settings.value("rnxPath").toString());
1093 if (!rnxdir.exists()) ((bncApp*)qApp)->slotMessage("Cannot find RINEX Observations directory", true);
1094
1095 QString rnx_file = settings.value("rnxScript").toString();
1096 if ( !rnx_file.isEmpty() ) {
1097 QFile rnxfile(settings.value("rnxScript").toString());
1098 if (!rnxfile.exists()) ((bncApp*)qApp)->slotMessage("Cannot find RINEX Observations script", true);
1099 }
1100
1101 QDir ephdir(settings.value("ephPath").toString());
1102 if (!ephdir.exists()) ((bncApp*)qApp)->slotMessage("Cannot find RINEX Ephemeris directory", true);
1103
1104 QDir corrdir(settings.value("corrPath").toString());
1105 if (!corrdir.exists()) ((bncApp*)qApp)->slotMessage("Cannot find Broadcast Corrections directory", true);
1106
1107 QString advise_file = settings.value("adviseScript").toString();
1108 if ( !advise_file.isEmpty() ) {
1109 QFile advisefile(settings.value("adviseScript").toString());
1110 if (!advisefile.exists()) ((bncApp*)qApp)->slotMessage("Cannot find Outages script", true);
1111 }
1112
1113 _bncFigure->updateMountPoints();
1114 _bncFigureLate->updateMountPoints();
1115 _caster->slotReadMountPoints();
1116}
1117
1118// Retrieve Data
1119////////////////////////////////////////////////////////////////////////////
1120void bncWindow::slotStop() {
1121 int iRet = QMessageBox::question(this, "Stop", "Stop retrieving data?",
1122 QMessageBox::Yes, QMessageBox::No,
1123 QMessageBox::NoButton);
1124 if (iRet == QMessageBox::Yes) {
1125 delete _caster; _caster = 0;
1126 _actGetData->setEnabled(true);
1127 _actStop->setEnabled(false);
1128 }
1129}
1130
1131// Close Application gracefully
1132////////////////////////////////////////////////////////////////////////////
1133void bncWindow::closeEvent(QCloseEvent* event) {
1134
1135 int iRet = QMessageBox::question(this, "Close", "Save Options?",
1136 QMessageBox::Yes, QMessageBox::No,
1137 QMessageBox::Cancel);
1138
1139 if (iRet == QMessageBox::Cancel) {
1140 event->ignore();
1141 return;
1142 }
1143 else if (iRet == QMessageBox::Yes) {
1144 slotSaveOptions();
1145 }
1146
1147 QMainWindow::closeEvent(event);
1148}
1149
1150// User changed the selection of mountPoints
1151////////////////////////////////////////////////////////////////////////////
1152void bncWindow::slotSelectionChanged() {
1153 if (_mountPointsTable->selectedItems().isEmpty()) {
1154 _actDeleteMountPoints->setEnabled(false);
1155 }
1156 else {
1157 _actDeleteMountPoints->setEnabled(true);
1158 }
1159}
1160
1161// Display Program Messages
1162////////////////////////////////////////////////////////////////////////////
1163void bncWindow::slotWindowMessage(const QByteArray msg, bool showOnScreen) {
1164
1165#ifdef DEBUG_RTCM2_2021
1166 const int maxBufferSize = 1000;
1167#else
1168 const int maxBufferSize = 10000;
1169#endif
1170
1171 if (! showOnScreen ) {
1172 return;
1173 }
1174
1175 QString txt = _log->toPlainText() + "\n" +
1176 QDateTime::currentDateTime().toUTC().toString("yy-MM-dd hh:mm:ss ") + msg;
1177 _log->clear();
1178 _log->append(txt.right(maxBufferSize));
1179}
1180
1181// About Message
1182////////////////////////////////////////////////////////////////////////////
1183void bncWindow::slotAbout() {
1184 new bncAboutDlg(0);
1185}
1186
1187//Flowchart
1188////////////////////////////////////////////////////////////////////////////
1189void bncWindow::slotFlowchart() {
1190 new bncFlowchartDlg(0);
1191}
1192
1193// Help Window
1194////////////////////////////////////////////////////////////////////////////
1195void bncWindow::slotHelp() {
1196 QUrl url;
1197 url.setPath(":bnchelp.html");
1198 new bncHlpDlg(0, url);
1199}
1200
1201// Select Fonts
1202////////////////////////////////////////////////////////////////////////////
1203void bncWindow::slotFontSel() {
1204 bool ok;
1205 QFont newFont = QFontDialog::getFont(&ok, this->font(), this);
1206 if (ok) {
1207 bncSettings settings;
1208 settings.setValue("font", newFont.toString());
1209 QApplication::setFont(newFont);
1210 int ww = QFontMetrics(newFont).width('w');
1211 setMinimumSize(60*ww, 80*ww);
1212 resize(60*ww, 80*ww);
1213 }
1214}
1215
1216// Whats This Help
1217void bncWindow::slotWhatsThis() {
1218 QWhatsThis::enterWhatsThisMode();
1219}
1220
1221//
1222////////////////////////////////////////////////////////////////////////////
1223void bncWindow::slotMountPointsRead(QList<bncGetThread*> threads) {
1224 populateMountPointsTable();
1225 bncSettings settings;
1226 _binSamplSpinBox->setValue(settings.value("binSampl").toInt());
1227 _waitTimeSpinBox->setValue(settings.value("waitTime").toInt());
1228 QListIterator<bncGetThread*> iTh(threads);
1229 while (iTh.hasNext()) {
1230 bncGetThread* thread = iTh.next();
1231 for (int iRow = 0; iRow < _mountPointsTable->rowCount(); iRow++) {
1232 QUrl url( "//" + _mountPointsTable->item(iRow, 0)->text() +
1233 "@" + _mountPointsTable->item(iRow, 1)->text() );
1234 if (url == thread->mountPoint() &&
1235 _mountPointsTable->item(iRow, 3)->text() == thread->latitude() &&
1236 _mountPointsTable->item(iRow, 4)->text() == thread->longitude() ) {
1237 ((bncTableItem*) _mountPointsTable->item(iRow, 7))->setGetThread(thread);
1238 connect(thread, SIGNAL(newBytes(QByteArray, double)),
1239 _bncFigure, SLOT(slotNewData(QByteArray, double)));
1240 connect(thread, SIGNAL(newLatency(QByteArray, double)),
1241 _bncFigureLate, SLOT(slotNewLatency(QByteArray, double)));
1242 break;
1243 }
1244 }
1245 }
1246}
1247
1248//
1249////////////////////////////////////////////////////////////////////////////
1250void bncWindow::CreateMenu() {
1251 // Create Menus
1252 // ------------
1253 _menuFile = menuBar()->addMenu(tr("&File"));
1254 _menuFile->addAction(_actFontSel);
1255 _menuFile->addSeparator();
1256 _menuFile->addAction(_actSaveOpt);
1257 _menuFile->addSeparator();
1258 _menuFile->addAction(_actQuit);
1259
1260 _menuHlp = menuBar()->addMenu(tr("&Help"));
1261 _menuHlp->addAction(_actHelp);
1262 _menuHlp->addAction(_actFlowchart);
1263 _menuHlp->addAction(_actAbout);
1264}
1265
1266// Toolbar
1267////////////////////////////////////////////////////////////////////////////
1268void bncWindow::AddToolbar() {
1269 // Tool (Command) Bar
1270 // ------------------
1271 QToolBar* toolBar = new QToolBar;
1272 addToolBar(Qt::BottomToolBarArea, toolBar);
1273 toolBar->setMovable(false);
1274 toolBar->addAction(_actAddMountPoints);
1275 toolBar->addAction(_actDeleteMountPoints);
1276 toolBar->addAction(_actGetData);
1277 toolBar->addAction(_actStop);
1278 toolBar->addWidget(new QLabel(" "));
1279 toolBar->addAction(_actwhatsthis);
1280}
1281
1282// About
1283////////////////////////////////////////////////////////////////////////////
1284bncAboutDlg::bncAboutDlg(QWidget* parent) :
1285 QDialog(parent) {
1286
1287 QTextBrowser* tb = new QTextBrowser;
1288 QUrl url; url.setPath(":bncabout.html");
1289 tb->setSource(url);
1290 tb->setReadOnly(true);
1291
1292 int ww = QFontMetrics(font()).width('w');
1293 QPushButton* _closeButton = new QPushButton("Close");
1294 _closeButton->setMaximumWidth(10*ww);
1295 connect(_closeButton, SIGNAL(clicked()), this, SLOT(close()));
1296
1297 QGridLayout* dlgLayout = new QGridLayout();
1298 QLabel* img = new QLabel();
1299 img->setPixmap(QPixmap(":ntrip-logo.png"));
1300 dlgLayout->addWidget(img, 0,0);
1301 dlgLayout->addWidget(new QLabel("BKG Ntrip Client (BNC) Version 1.7"), 0,1);
1302 dlgLayout->addWidget(tb,1,0,1,2);
1303 dlgLayout->addWidget(_closeButton,2,1,Qt::AlignRight);
1304
1305 setLayout(dlgLayout);
1306 resize(60*ww, 60*ww);
1307 setWindowTitle("About BNC");
1308 show();
1309}
1310
1311//
1312////////////////////////////////////////////////////////////////////////////
1313bncAboutDlg::~bncAboutDlg() {
1314};
1315
1316// Flowchart
1317////////////////////////////////////////////////////////////////////////////
1318bncFlowchartDlg::bncFlowchartDlg(QWidget* parent) :
1319 QDialog(parent) {
1320
1321 int ww = QFontMetrics(font()).width('w');
1322 QPushButton* _closeButton = new QPushButton("Close");
1323 _closeButton->setMaximumWidth(10*ww);
1324 connect(_closeButton, SIGNAL(clicked()), this, SLOT(close()));
1325
1326 QGridLayout* dlgLayout = new QGridLayout();
1327 QLabel* img = new QLabel();
1328 img->setPixmap(QPixmap(":bncflowchart.png"));
1329 dlgLayout->addWidget(img, 0,0);
1330 dlgLayout->addWidget(_closeButton,1,0,Qt::AlignLeft);
1331
1332 setLayout(dlgLayout);
1333 setWindowTitle("Flow Chart");
1334 show();
1335}
1336
1337//
1338////////////////////////////////////////////////////////////////////////////
1339bncFlowchartDlg::~bncFlowchartDlg() {
1340};
1341
1342// Bnc Text
1343////////////////////////////////////////////////////////////////////////////
1344void bncWindow::bncText(const QString &text){
1345
1346 bool isEmpty = text.isEmpty();
1347
1348 QPalette palette;
1349 QColor lightGray(230, 230, 230);
1350 QColor white(255, 255, 255);
1351
1352
1353 // Proxy
1354 //------
1355 if (_aogroup->currentIndex() == 0) {
1356 if (!isEmpty) {
1357 _proxyPortLineEdit->setStyleSheet("background-color: white");
1358 _proxyPortLineEdit->setEnabled(true);
1359 } else {
1360 _proxyPortLineEdit->setStyleSheet("background-color: lightGray");
1361 _proxyPortLineEdit->setEnabled(false);
1362 }
1363 }
1364
1365 // RINEX Observations
1366 // ------------------
1367 if (_aogroup->currentIndex() == 2) {
1368 if (!isEmpty) {
1369 _rnxSamplSpinBox->setStyleSheet("background-color: white");
1370 _rnxSkelLineEdit->setStyleSheet("background-color: white");
1371 _rnxScrpLineEdit->setStyleSheet("background-color: white");
1372 palette.setColor(_rnxV3CheckBox->backgroundRole(), white);
1373 _rnxV3CheckBox->setPalette(palette);
1374 _rnxIntrComboBox->setStyleSheet("background-color: white");
1375 _rnxSamplSpinBox->setEnabled(true);
1376 _rnxSkelLineEdit->setEnabled(true);
1377 _rnxScrpLineEdit->setEnabled(true);
1378 _rnxV3CheckBox->setEnabled(true);
1379 _rnxIntrComboBox->setEnabled(true);
1380 } else {
1381 _rnxSamplSpinBox->setStyleSheet("background-color: lightGray");
1382 _rnxSkelLineEdit->setStyleSheet("background-color: lightGray");
1383 _rnxScrpLineEdit->setStyleSheet("background-color: lightGray");
1384 palette.setColor(_rnxV3CheckBox->backgroundRole(), lightGray);
1385 _rnxV3CheckBox->setPalette(palette);
1386 _rnxIntrComboBox->setStyleSheet("background-color: lightGray");
1387 _rnxSamplSpinBox->setEnabled(false);
1388 _rnxSkelLineEdit->setEnabled(false);
1389 _rnxScrpLineEdit->setEnabled(false);
1390 _rnxV3CheckBox->setEnabled(false);
1391 _rnxIntrComboBox->setEnabled(false);
1392 }
1393 }
1394
1395 // RINEX Ephemeris
1396 // ---------------
1397 if (_aogroup->currentIndex() == 3) {
1398 if (!_ephPathLineEdit->text().isEmpty() && !_outEphPortLineEdit->text().isEmpty()) {
1399 _ephIntrComboBox->setStyleSheet("background-color: white");
1400 palette.setColor(_ephV3CheckBox->backgroundRole(), white);
1401 _ephV3CheckBox->setPalette(palette);
1402 _ephIntrComboBox->setEnabled(true);
1403 _ephV3CheckBox->setEnabled(true);
1404 }
1405 if (_ephPathLineEdit->text().isEmpty() && !_outEphPortLineEdit->text().isEmpty()) {
1406 _ephIntrComboBox->setStyleSheet("background-color: lightGray");
1407 palette.setColor(_ephV3CheckBox->backgroundRole(), white);
1408 _ephV3CheckBox->setPalette(palette);
1409 _ephIntrComboBox->setEnabled(false);
1410 _ephV3CheckBox->setEnabled(true);
1411 }
1412 if (!_ephPathLineEdit->text().isEmpty() && _outEphPortLineEdit->text().isEmpty()) {
1413 _ephIntrComboBox->setStyleSheet("background-color: white");
1414 palette.setColor(_ephV3CheckBox->backgroundRole(), white);
1415 _ephV3CheckBox->setPalette(palette);
1416 _ephIntrComboBox->setEnabled(true);
1417 _ephV3CheckBox->setEnabled(true);
1418 }
1419 if (_ephPathLineEdit->text().isEmpty() && _outEphPortLineEdit->text().isEmpty()) {
1420 _ephIntrComboBox->setStyleSheet("background-color: lightGray");
1421 palette.setColor(_ephV3CheckBox->backgroundRole(), lightGray);
1422 _ephV3CheckBox->setPalette(palette);
1423 _ephIntrComboBox->setEnabled(false);
1424 _ephV3CheckBox->setEnabled(false);
1425 }
1426 }
1427
1428 // Broadcast Corrections
1429 // ---------------------
1430 if (_aogroup->currentIndex() == 4) {
1431 if (!isEmpty) {
1432 if (!_corrPathLineEdit->text().isEmpty()) {
1433 _corrIntrComboBox->setStyleSheet("background-color: white");
1434 _corrPortLineEdit->setStyleSheet("background-color: white");
1435 _corrIntrComboBox->setEnabled(true);
1436 _corrPortLineEdit->setEnabled(true);
1437 }
1438 if (!_corrPortLineEdit->text().isEmpty()) {
1439 _corrTimeSpinBox->setStyleSheet("background-color: white");
1440 _corrTimeSpinBox->setEnabled(true);
1441 }
1442 } else {
1443 if (_corrPathLineEdit->text().isEmpty()) {
1444 _corrIntrComboBox->setStyleSheet("background-color: lightGray");
1445 _corrIntrComboBox->setEnabled(false);
1446 }
1447 if (_corrPortLineEdit->text().isEmpty()) {
1448 _corrTimeSpinBox->setStyleSheet("background-color: lightGray");
1449 _corrTimeSpinBox->setEnabled(false);
1450 }
1451 }
1452 }
1453
1454 // Feed Engine
1455 // -----------
1456 if (_aogroup->currentIndex() == 5) {
1457 if ( !_outPortLineEdit->text().isEmpty() || !_outFileLineEdit->text().isEmpty()) {
1458 _waitTimeSpinBox->setStyleSheet("background-color: white");
1459 _binSamplSpinBox->setStyleSheet("background-color: white");
1460 _waitTimeSpinBox->setEnabled(true);
1461 _binSamplSpinBox->setEnabled(true);
1462 } else {
1463 _waitTimeSpinBox->setStyleSheet("background-color: lightGray");
1464 _binSamplSpinBox->setStyleSheet("background-color: lightGray");
1465 _waitTimeSpinBox->setEnabled(false);
1466 _binSamplSpinBox->setEnabled(false);
1467 }
1468 }
1469
1470 // Serial Output
1471 // -------------
1472 if (_aogroup->currentIndex() == 6) {
1473 if (!isEmpty) {
1474 _serialPortNameLineEdit->setStyleSheet("background-color: white");
1475 _serialBaudRateComboBox->setStyleSheet("background-color: white");
1476 _serialParityComboBox->setStyleSheet("background-color: white");
1477 _serialDataBitsComboBox->setStyleSheet("background-color: white");
1478 _serialStopBitsComboBox->setStyleSheet("background-color: white");
1479 _serialFlowControlComboBox->setStyleSheet("background-color: white");
1480 _serialAutoNMEAComboBox->setStyleSheet("background-color: white");
1481 _serialPortNameLineEdit->setEnabled(true);
1482 _serialBaudRateComboBox->setEnabled(true);
1483 _serialParityComboBox->setEnabled(true);
1484 _serialDataBitsComboBox->setEnabled(true);
1485 _serialStopBitsComboBox->setEnabled(true);
1486 _serialFlowControlComboBox->setEnabled(true);
1487 _serialAutoNMEAComboBox->setEnabled(true);
1488 if (_serialAutoNMEAComboBox->currentText() != "Auto" ) {
1489 _serialHeightNMEALineEdit->setStyleSheet("background-color: white");
1490 _serialHeightNMEALineEdit->setEnabled(true);
1491 _serialFileNMEALineEdit->setStyleSheet("background-color: lightGray");
1492 _serialFileNMEALineEdit->setEnabled(false);
1493 } else {
1494 _serialHeightNMEALineEdit->setStyleSheet("background-color: lightGray");
1495 _serialHeightNMEALineEdit->setEnabled(false);
1496 _serialFileNMEALineEdit->setStyleSheet("background-color: white");
1497 _serialFileNMEALineEdit->setEnabled(true);
1498 }
1499 } else {
1500 _serialPortNameLineEdit->setStyleSheet("background-color: lightGray");
1501 _serialBaudRateComboBox->setStyleSheet("background-color: lightGray");
1502 _serialParityComboBox->setStyleSheet("background-color: lightGray");
1503 _serialDataBitsComboBox->setStyleSheet("background-color: lightGray");
1504 _serialStopBitsComboBox->setStyleSheet("background-color: lightGray");
1505 _serialFlowControlComboBox->setStyleSheet("background-color: lightGray");
1506 _serialAutoNMEAComboBox->setStyleSheet("background-color: lightGray");
1507 _serialFileNMEALineEdit->setStyleSheet("background-color: lightGray");
1508 _serialHeightNMEALineEdit->setStyleSheet("background-color: lightGray");
1509 _serialPortNameLineEdit->setEnabled(false);
1510 _serialBaudRateComboBox->setEnabled(false);
1511 _serialParityComboBox->setEnabled(false);
1512 _serialDataBitsComboBox->setEnabled(false);
1513 _serialStopBitsComboBox->setEnabled(false);
1514 _serialFlowControlComboBox->setEnabled(false);
1515 _serialAutoNMEAComboBox->setEnabled(false);
1516 _serialHeightNMEALineEdit->setEnabled(false);
1517 _serialFileNMEALineEdit->setEnabled(false);
1518 }
1519 }
1520
1521 // Outages
1522 // -------
1523 if (_aogroup->currentIndex() == 7) {
1524 if (!isEmpty) {
1525 _adviseScriptLineEdit->setStyleSheet("background-color: white");
1526 _adviseFailSpinBox->setStyleSheet("background-color: white");
1527 _adviseRecoSpinBox->setStyleSheet("background-color: white");
1528 _adviseFailSpinBox->setEnabled(true);
1529 _adviseRecoSpinBox->setEnabled(true);
1530 _adviseScriptLineEdit->setEnabled(true);
1531 } else {
1532 _adviseScriptLineEdit->setStyleSheet("background-color: lightGray");
1533 _adviseFailSpinBox->setStyleSheet("background-color: lightGray");
1534 _adviseRecoSpinBox->setStyleSheet("background-color: lightGray");
1535 _adviseFailSpinBox->setEnabled(false);
1536 _adviseRecoSpinBox->setEnabled(false);
1537 _adviseScriptLineEdit->setEnabled(false);
1538 }
1539 }
1540
1541 // Miscellaneous
1542 // -------------
1543 if (_aogroup->currentIndex() == 8) {
1544 if (!isEmpty) {
1545 _perfIntrComboBox->setStyleSheet("background-color: white");
1546 palette.setColor(_scanRTCMCheckBox->backgroundRole(), white);
1547 _scanRTCMCheckBox->setPalette(palette);
1548 _perfIntrComboBox->setEnabled(true);
1549 _scanRTCMCheckBox->setEnabled(true);
1550 } else {
1551 _perfIntrComboBox->setStyleSheet("background-color: lightGray");
1552 palette.setColor(_scanRTCMCheckBox->backgroundRole(), lightGray);
1553 _scanRTCMCheckBox->setPalette(palette);
1554 _perfIntrComboBox->setEnabled(false);
1555 _scanRTCMCheckBox->setEnabled(false);
1556 }
1557 }
1558}
1559
Note: See TracBrowser for help on using the repository browser.