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

Last change on this file since 1409 was 1409, checked in by weber, 15 years ago

* empty log message *

File size: 55.2 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 "bnchlpdlg.h"
49#include "bnchtml.h"
50#include "bnctableitem.h"
51
52using namespace std;
53
54// Constructor
55////////////////////////////////////////////////////////////////////////////
56bncWindow::bncWindow() {
57
58 _caster = 0;
59
60 int ww = QFontMetrics(this->font()).width('w');
61
62 static const QStringList labels = QString("account, Streams: broadcaster:port/mountpoint,decoder,lat,long,nmea,ntrip,bytes").split(",");
63
64 setMinimumSize(80*ww, 65*ww);
65
66 setWindowTitle(tr("BKG Ntrip Client (BNC) Version 1.7"));
67
68 connect((bncApp*)qApp, SIGNAL(newMessage(QByteArray,bool)),
69 this, SLOT(slotWindowMessage(QByteArray,bool)));
70
71 // Create Actions
72 // --------------
73 _actHelp = new QAction(tr("&Help Contents"),this);
74 connect(_actHelp, SIGNAL(triggered()), SLOT(slotHelp()));
75
76 _actAbout = new QAction(tr("&About BNC"),this);
77 connect(_actAbout, SIGNAL(triggered()), SLOT(slotAbout()));
78
79 _actFlowchart = new QAction(tr("&Flow Chart"),this);
80 connect(_actFlowchart, SIGNAL(triggered()), SLOT(slotFlowchart()));
81
82 _actFontSel = new QAction(tr("Select &Font"),this);
83 connect(_actFontSel, SIGNAL(triggered()), SLOT(slotFontSel()));
84
85 _actSaveOpt = new QAction(tr("&Save && Activate Options"),this);
86 connect(_actSaveOpt, SIGNAL(triggered()), SLOT(slotSaveOptions()));
87
88 _actQuit = new QAction(tr("&Quit"),this);
89 connect(_actQuit, SIGNAL(triggered()), SLOT(close()));
90
91 _actAddMountPoints = new QAction(tr("Add &Streams"),this);
92 connect(_actAddMountPoints, SIGNAL(triggered()), SLOT(slotAddMountPoints()));
93
94 _actDeleteMountPoints = new QAction(tr("&Delete Streams"),this);
95 connect(_actDeleteMountPoints, SIGNAL(triggered()), SLOT(slotDeleteMountPoints()));
96 _actDeleteMountPoints->setEnabled(false);
97
98 _actGetData = new QAction(tr("Sta&rt"),this);
99 connect(_actGetData, SIGNAL(triggered()), SLOT(slotGetData()));
100
101 _actStop = new QAction(tr("Sto&p"),this);
102 connect(_actStop, SIGNAL(triggered()), SLOT(slotStop()));
103 _actStop->setEnabled(false);
104
105 _actwhatsthis= new QAction(tr("Help=Shift+F1"),this);
106 connect(_actwhatsthis, SIGNAL(triggered()), SLOT(slotWhatsThis()));
107
108 CreateMenu();
109 AddToolbar();
110
111 QSettings settings;
112 _proxyHostLineEdit = new QLineEdit(settings.value("proxyHost").toString());
113 _proxyPortLineEdit = new QLineEdit(settings.value("proxyPort").toString());
114 _proxyPortLineEdit->setMaximumWidth(9*ww);
115 _miscMountLineEdit = new QLineEdit(settings.value("miscMount").toString());
116 _scanRTCMCheckBox = new QCheckBox();
117 _scanRTCMCheckBox->setCheckState(Qt::CheckState(
118 settings.value("scanRTCM").toInt()));
119 _waitTimeSpinBox = new QSpinBox();
120 _waitTimeSpinBox->setMinimum(1);
121 _waitTimeSpinBox->setMaximum(30);
122 _waitTimeSpinBox->setSingleStep(1);
123 _waitTimeSpinBox->setSuffix(" sec");
124 _waitTimeSpinBox->setMaximumWidth(9*ww);
125 _waitTimeSpinBox->setValue(settings.value("waitTime").toInt());
126 _outFileLineEdit = new QLineEdit(settings.value("outFile").toString());
127 _outPortLineEdit = new QLineEdit(settings.value("outPort").toString());
128 _outPortLineEdit->setMaximumWidth(9*ww);
129 _outUPortLineEdit = new QLineEdit(settings.value("outUPort").toString());
130 _outUPortLineEdit->setMaximumWidth(9*ww);
131 _outEphPortLineEdit = new QLineEdit(settings.value("outEphPort").toString());
132 _outEphPortLineEdit->setMaximumWidth(9*ww);
133 _corrPortLineEdit = new QLineEdit(settings.value("corrPort").toString());
134 _corrPortLineEdit->setMaximumWidth(9*ww);
135 _rnxPathLineEdit = new QLineEdit(settings.value("rnxPath").toString());
136 _ephPathLineEdit = new QLineEdit(settings.value("ephPath").toString());
137 _corrPathLineEdit = new QLineEdit(settings.value("corrPath").toString());
138
139 _rnxV3CheckBox = new QCheckBox();
140 _rnxV3CheckBox->setCheckState(Qt::CheckState(settings.value("rnxV3").toInt()));
141 _ephV3CheckBox = new QCheckBox();
142 _ephV3CheckBox->setCheckState(Qt::CheckState(settings.value("ephV3").toInt()));
143 _rnxScrpLineEdit = new QLineEdit(settings.value("rnxScript").toString());
144 _rnxSkelLineEdit = new QLineEdit(settings.value("rnxSkel").toString());
145 _rnxSkelLineEdit->setMaximumWidth(5*ww);
146 _rnxAppendCheckBox = new QCheckBox();
147 _rnxAppendCheckBox->setCheckState(Qt::CheckState(
148 settings.value("rnxAppend").toInt()));
149 _autoStartCheckBox = new QCheckBox();
150 _autoStartCheckBox->setCheckState(Qt::CheckState(
151 settings.value("autoStart").toInt()));
152 _rnxIntrComboBox = new QComboBox();
153 _rnxIntrComboBox->setMaximumWidth(9*ww);
154 _rnxIntrComboBox->setEditable(false);
155 _rnxIntrComboBox->addItems(QString("1 min,2 min,5 min,10 min,15 min,30 min,1 hour,1 day").split(","));
156 int ii = _rnxIntrComboBox->findText(settings.value("rnxIntr").toString());
157 if (ii != -1) {
158 _rnxIntrComboBox->setCurrentIndex(ii);
159 }
160 _onTheFlyComboBox = new QComboBox();
161 _onTheFlyComboBox->setMaximumWidth(9*ww);
162 _onTheFlyComboBox->setEditable(false);
163 _onTheFlyComboBox->addItems(QString("1 day,1 hour,1 min").split(","));
164 ii = _onTheFlyComboBox->findText(settings.value("onTheFlyInterval").toString());
165 if (ii != -1) {
166 _onTheFlyComboBox->setCurrentIndex(ii);
167 }
168 _ephIntrComboBox = new QComboBox();
169 _ephIntrComboBox->setMaximumWidth(9*ww);
170 _ephIntrComboBox->setEditable(false);
171 _ephIntrComboBox->addItems(QString("1 min,2 min,5 min,10 min,15 min,30 min,1 hour,1 day").split(","));
172 int jj = _ephIntrComboBox->findText(settings.value("ephIntr").toString());
173 if (jj != -1) {
174 _ephIntrComboBox->setCurrentIndex(jj);
175 }
176 _corrIntrComboBox = new QComboBox();
177 _corrIntrComboBox->setMaximumWidth(9*ww);
178 _corrIntrComboBox->setEditable(false);
179 _corrIntrComboBox->addItems(QString("1 min,2 min,5 min,10 min,15 min,30 min,1 hour,1 day").split(","));
180 int mm = _corrIntrComboBox->findText(settings.value("corrIntr").toString());
181 if (mm != -1) {
182 _corrIntrComboBox->setCurrentIndex(mm);
183 }
184 _corrTimeSpinBox = new QSpinBox();
185 _corrTimeSpinBox->setMinimum(1);
186 _corrTimeSpinBox->setMaximum(30);
187 _corrTimeSpinBox->setSingleStep(1);
188 _corrTimeSpinBox->setSuffix(" sec");
189 _corrTimeSpinBox->setMaximumWidth(9*ww);
190 _corrTimeSpinBox->setValue(settings.value("corrTime").toInt());
191 _rnxSamplSpinBox = new QSpinBox();
192 _rnxSamplSpinBox->setMinimum(0);
193 _rnxSamplSpinBox->setMaximum(60);
194 _rnxSamplSpinBox->setSingleStep(5);
195 _rnxSamplSpinBox->setMaximumWidth(9*ww);
196 _rnxSamplSpinBox->setValue(settings.value("rnxSampl").toInt());
197 _rnxSamplSpinBox->setSuffix(" sec");
198
199 _binSamplSpinBox = new QSpinBox();
200 _binSamplSpinBox->setMinimum(0);
201 _binSamplSpinBox->setMaximum(60);
202 _binSamplSpinBox->setSingleStep(5);
203 _binSamplSpinBox->setMaximumWidth(9*ww);
204 _binSamplSpinBox->setValue(settings.value("binSampl").toInt());
205 _binSamplSpinBox->setSuffix(" sec");
206
207 _obsRateComboBox = new QComboBox();
208 _obsRateComboBox->setMaximumWidth(9*ww);
209 _obsRateComboBox->setEditable(false);
210 _obsRateComboBox->addItems(QString(",0.1 Hz,0.2 Hz,0.5 Hz,1 Hz,5 Hz").split(","));
211 int kk = _obsRateComboBox->findText(settings.value("obsRate").toString());
212 if (kk != -1) {
213 _obsRateComboBox->setCurrentIndex(kk);
214 }
215 _makePauseCheckBox = new QCheckBox();
216 _makePauseCheckBox->setCheckState(Qt::CheckState(
217 settings.value("makePause").toInt()));
218 _adviseRecoSpinBox = new QSpinBox();
219 _adviseRecoSpinBox->setMinimum(0);
220 _adviseRecoSpinBox->setMaximum(60);
221 _adviseRecoSpinBox->setSingleStep(1);
222 _adviseRecoSpinBox->setSuffix(" min");
223 _adviseRecoSpinBox->setMaximumWidth(9*ww);
224 _adviseRecoSpinBox->setValue(settings.value("adviseReco").toInt());
225 _adviseFailSpinBox = new QSpinBox();
226 _adviseFailSpinBox->setMinimum(0);
227 _adviseFailSpinBox->setMaximum(60);
228 _adviseFailSpinBox->setSingleStep(1);
229 _adviseFailSpinBox->setSuffix(" min");
230 _adviseFailSpinBox->setMaximumWidth(9*ww);
231 _adviseFailSpinBox->setValue(settings.value("adviseFail").toInt());
232 _logFileLineEdit = new QLineEdit(settings.value("logFile").toString());
233 _adviseScriptLineEdit = new QLineEdit(settings.value("adviseScript").toString());
234
235 _serialPortNameLineEdit = new QLineEdit(settings.value("serialPortName").toString());
236 _serialMountPointLineEdit = new QLineEdit(settings.value("serialMountPoint").toString());
237
238 _serialBaudRateComboBox = new QComboBox();
239 _serialBaudRateComboBox->setMaximumWidth(9*ww);
240 _serialBaudRateComboBox->addItems(QString("110,300,600,"
241 "1200,2400,4800,9600,19200,38400,57600,115200").split(","));
242 kk = _serialBaudRateComboBox->findText(settings.value("serialBaudRate").toString());
243 if (kk != -1) {
244 _serialBaudRateComboBox->setCurrentIndex(kk);
245 }
246 _serialParityComboBox = new QComboBox();
247 _serialParityComboBox->setMaximumWidth(9*ww);
248 _serialParityComboBox->addItems(QString("NONE,ODD,EVEN,SPACE").split(","));
249 kk = _serialParityComboBox->findText(settings.value("serialParity").toString());
250 if (kk != -1) {
251 _serialParityComboBox->setCurrentIndex(kk);
252 }
253 _serialDataBitsComboBox = new QComboBox();
254 _serialDataBitsComboBox->setMaximumWidth(5*ww);
255 _serialDataBitsComboBox->addItems(QString("5,6,7,8").split(","));
256 kk = _serialDataBitsComboBox->findText(settings.value("serialDataBits").toString());
257 if (kk != -1) {
258 _serialDataBitsComboBox->setCurrentIndex(kk);
259 }
260 _serialStopBitsComboBox = new QComboBox();
261 _serialStopBitsComboBox->setMaximumWidth(5*ww);
262 _serialStopBitsComboBox->addItems(QString("1,2").split(","));
263 kk = _serialStopBitsComboBox->findText(settings.value("serialStopBits").toString());
264 if (kk != -1) {
265 _serialStopBitsComboBox->setCurrentIndex(kk);
266 }
267 _serialAutoNMEACheckBox = new QCheckBox();
268 _serialAutoNMEACheckBox->setCheckState(Qt::CheckState(
269 settings.value("serialAutoNMEA").toInt()));
270
271 _perfIntrComboBox = new QComboBox();
272 _perfIntrComboBox->setMaximumWidth(9*ww);
273 _perfIntrComboBox->setEditable(false);
274 _perfIntrComboBox->addItems(QString(",1 min,5 min,15 min,1 hour,6 hours,1 day").split(","));
275 int ll = _perfIntrComboBox->findText(settings.value("perfIntr").toString());
276 if (ll != -1) {
277 _perfIntrComboBox->setCurrentIndex(ll);
278 }
279
280 _mountPointsTable = new QTableWidget(0,8);
281
282 _mountPointsTable->horizontalHeader()->resizeSection(1,34*ww);
283 _mountPointsTable->horizontalHeader()->resizeSection(2,9*ww);
284 _mountPointsTable->horizontalHeader()->resizeSection(3,7*ww);
285 _mountPointsTable->horizontalHeader()->resizeSection(4,7*ww);
286 _mountPointsTable->horizontalHeader()->resizeSection(5,5*ww);
287 _mountPointsTable->horizontalHeader()->resizeSection(6,4*ww);
288 _mountPointsTable->horizontalHeader()->setResizeMode(QHeaderView::Interactive);
289 _mountPointsTable->horizontalHeader()->setStretchLastSection(true);
290 _mountPointsTable->setHorizontalHeaderLabels(labels);
291 _mountPointsTable->setGridStyle(Qt::NoPen);
292 _mountPointsTable->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
293 _mountPointsTable->setSelectionMode(QAbstractItemView::ExtendedSelection);
294 _mountPointsTable->setSelectionBehavior(QAbstractItemView::SelectRows);
295 _mountPointsTable->hideColumn(0);
296 connect(_mountPointsTable, SIGNAL(itemSelectionChanged()),
297 SLOT(slotSelectionChanged()));
298 populateMountPointsTable();
299
300 _log = new QTextBrowser();
301 _log->setReadOnly(true);
302
303 // WhatsThis
304 // ---------
305 _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>"));
306 _proxyPortLineEdit->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>"));
307 _waitTimeSpinBox->setWhatsThis(tr("<p>When feeding a real-time GNSS 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 engine or products.</p><p>Note that 'Wait for full epoch' does not effect the RINEX Observation file content. Observations received later than 'Wait for full epoch' seconds will still be included in the RINEX Observation files.</p>"));
308 _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."));
309 _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."));
310 _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."));
311 _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."));
312 _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."));
313 _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."));
314 _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."));
315 _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."));
316 _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."));
317 _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><p>The triggering event for calling the script or batch file is the end of a RINEX Observation file 'Interval'. If that is overridden by a stream outage, the triggering event is the stream reconnection.</p>"));
318 _rnxSkelLineEdit->setWhatsThis(tr("<p>Whenever BNC starts generating RINEX Observation files (and then once every day at midnight), it first tries to retrieve information needed for RINEX headers from so-called public RINEX header skeleton files which are derived from sitelogs. However, sometimes public RINEX header skeleton files are not available, its contents is not up to date, or you need to put additional/optional records in the RINEX header.</p><p>For that 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. A file in the RINEX 'Directory' with the RINEX 'Skeleton extension' is interpreted by BNC as a personal RINEX header skeleton file for the corresponding stream.</p>"));
319 _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>"));
320 _autoStartCheckBox->setWhatsThis(tr("<p>Tick 'Auto start' for auto-start of BNC at startup time in window mode with preassigned processing options.</p>"));
321 _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 & Activate Options'.</p>"));
322 _rnxIntrComboBox->setWhatsThis(tr("<p>Select the length of the RINEX Observation file.</p>"));
323 _ephIntrComboBox->setWhatsThis(tr("<p>Select the length of the RINEX Navigation file.</p>"));
324 _corrIntrComboBox->setWhatsThis(tr("<p>Select the length of the Broadcast Ephemeris Correction files.</p>"));
325 _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>"));
326 _binSamplSpinBox->setWhatsThis(tr("<p>Select the Observation sampling interval in seconds. A value of zero '0' tells BNC to send/store all received epochs.</p>"));
327 _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><p>An empty option field (default) means that you don't want an explicit information from BNC about stream outages and incoming streams that can not be decoded and that the special procedure for handling of corrupted streams is bypassed.</p>"));
328 _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><p>Note that for using this function you need to specify the 'Observation rate'.</p>"));
329 _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><p>Note that for using this function you need to specify the 'Observation rate'.</p>"));
330 _makePauseCheckBox->setWhatsThis(tr("<p>In case of a continuously corrupted stream, the decoding process can be paused and decodings are then attempted again at decreasing rate till the stream hopefully recovers. Tick 'Pause' to activate this function.</p><p>Do not tick 'Pause' (default) in order to prevent BNC from making any decoding pause. Be aware that this may incur an unnecessary workload.</p><p>Note that this function is only effective if an 'Observation rate' is specified.</p>"));
331 _logFileLineEdit->setWhatsThis(tr("Records of BNC's activities are shown in the 'Logs' section 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."));
332 _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 can be configured to send an 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><p> Note that for using this function you need to specify the 'Observation rate'.</p>"));
333 _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 'Logs' section 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>"));
334 _mountPointsTable->setWhatsThis(tr("<p>Streams selected for retrieval are listed in the 'Streams' section. Clicking on 'Add Streams' 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 Streams' 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>"));
335 _log->setWhatsThis(tr("Records of BNC's activities are shown in the 'Logs' section. 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."));
336 _ephV3CheckBox->setWhatsThis(tr("The default format for RINEX Navigation files containing Broadcast Ephemeris is RINEX Version 2.11. Select 'Version 3' if you want to save the ephemeris in RINEX Version 3 format."));
337 _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."));
338 _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>"));
339 _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><p>An empty option field (default) means that you don't want BNC to log such information.</p>"));
340 _serialMountPointLineEdit->setWhatsThis(tr("<p>Enter a 'Mountpoint' to forward the corresponding stream to a serial connected device.</p>"));
341 _serialPortNameLineEdit->setWhatsThis(tr("<p>Enter the serial 'Port name' selected for communication with your serial connected device. 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>"));
342 _serialBaudRateComboBox->setWhatsThis(tr("<p>Select a 'Baud rate' for the serial link.</p><p>Note that your selection must equal the baud rate configured to the serial connected device. Note further that using a high baud rate is recommended.</p>"));
343 _serialParityComboBox->setWhatsThis(tr("<p>Select the 'Parity' for the serial link.</p><p>Note that your selection must equal the parity selection configured to the serial connected device. Note further that parity is often set to 'NONE'.</p>"));
344 _serialDataBitsComboBox->setWhatsThis(tr("<p>Select the number of 'Data bits' for the serial link.</p><p>Note that your selection must equal the number of data bits configured to the serial connected device. Note further that often 8 data bits are used.</p>"));
345 _serialStopBitsComboBox->setWhatsThis(tr("<p>Select the number of 'Stop bits' for the serial link.</p><p>Note that your selection must equal the number of stop bits configured to the serial connected device. Note further that often 1 stop bit is used.</p>"));
346 _serialAutoNMEACheckBox->setWhatsThis(tr("<p>Tick 'Auto NMEA' to forward NMEA GGA messages coming from your serial connected device to the NTRIP brodacaster.</p><p>Note that this replaces the simulation of an initial NMEA GGA message based on latitude/longitude from the broadcaster's sourcetable.</p>"));
347
348 // Canvas with Editable Fields
349 // ---------------------------
350 _canvas = new QWidget;
351 setCentralWidget(_canvas);
352
353//QTabWidget* aogroup = new QTabWidget();
354 aogroup = new QTabWidget();
355 QWidget* pgroup = new QWidget();
356 QWidget* ggroup = new QWidget();
357 QWidget* sgroup = new QWidget();
358 QWidget* egroup = new QWidget();
359 QWidget* agroup = new QWidget();
360 QWidget* cgroup = new QWidget();
361 QWidget* ogroup = new QWidget();
362 QWidget* rgroup = new QWidget();
363 QWidget* sergroup = new QWidget();
364 aogroup->addTab(pgroup,tr("Proxy"));
365 aogroup->addTab(ggroup,tr("General"));
366 aogroup->addTab(ogroup,tr("RINEX Observations"));
367 aogroup->addTab(egroup,tr("RINEX Ephemeris"));
368 aogroup->addTab(cgroup,tr("Ephemeris Corrections"));
369 aogroup->addTab(sgroup,tr("Feed Engine"));
370 aogroup->addTab(sergroup,tr("Serial Link"));
371 aogroup->addTab(agroup,tr("Outages"));
372 aogroup->addTab(rgroup,tr("Miscellaneous"));
373
374 QGridLayout* pLayout = new QGridLayout;
375 pLayout->setColumnMinimumWidth(0,13*ww);
376 pLayout->addWidget(new QLabel("Proxy host"), 0, 0);
377 pLayout->addWidget(_proxyHostLineEdit, 0, 1, 1,10);
378 pLayout->addWidget(new QLabel("Proxy port"), 1, 0);
379 pLayout->addWidget(_proxyPortLineEdit, 1, 1);
380 pLayout->addWidget(new QLabel("Settings for the proxy in protected networks, leave boxes blank if none."),2, 0, 1, 50, Qt::AlignLeft);
381 pLayout->addWidget(new QLabel(" "),3,0);
382 pLayout->addWidget(new QLabel(" "),4,0);
383 pLayout->addWidget(new QLabel(" "),5,0);
384 pgroup->setLayout(pLayout);
385
386 QGridLayout* gLayout = new QGridLayout;
387 gLayout->setColumnMinimumWidth(0,14*ww);
388 gLayout->addWidget(new QLabel("Logfile (full path)"), 0, 0);
389 gLayout->addWidget(_logFileLineEdit, 0, 1);
390 gLayout->addWidget(new QLabel("Append files"), 1, 0);
391 gLayout->addWidget(_rnxAppendCheckBox, 1, 1);
392 gLayout->addWidget(new QLabel("Reread configuration"), 2, 0);
393 gLayout->addWidget(_onTheFlyComboBox, 2, 1);
394 gLayout->addWidget(new QLabel("Auto start"), 3, 0);
395 gLayout->addWidget(_autoStartCheckBox, 3, 1);
396 gLayout->addWidget(new QLabel("General settings for logfile, file handling, configuration on-the-fly, and auto-start."),4, 0, 1, 2, Qt::AlignLeft);
397 gLayout->addWidget(new QLabel(" "),5,0);
398 ggroup->setLayout(gLayout);
399
400 QGridLayout* sLayout = new QGridLayout;
401 sLayout->setColumnMinimumWidth(0,14*ww);
402 sLayout->addWidget(new QLabel("Port (synchronized)"), 0, 0);
403 sLayout->addWidget(_outPortLineEdit, 0, 1);
404 sLayout->addWidget(new QLabel("Wait for full epoch"), 0, 2, Qt::AlignRight);
405 sLayout->addWidget(_waitTimeSpinBox, 0, 3, Qt::AlignLeft);
406 sLayout->addWidget(new QLabel("Port (unsynchronized)"), 1, 0);
407 sLayout->addWidget(_outUPortLineEdit, 1, 1);
408 sLayout->addWidget(new QLabel("File (full path)"), 2, 0);
409 sLayout->addWidget(_outFileLineEdit, 2, 1, 1, 30);
410 sLayout->addWidget(new QLabel("Sampling"), 3, 0);
411 sLayout->addWidget(_binSamplSpinBox, 3, 1, Qt::AlignLeft);
412 sLayout->addWidget(new QLabel("Output decoded observations in a binary format to feed a real-time GNSS engine."),4,0,1,30);
413 sLayout->addWidget(new QLabel(" "),5,0);
414 sgroup->setLayout(sLayout);
415
416 QGridLayout* eLayout = new QGridLayout;
417 eLayout->setColumnMinimumWidth(0,14*ww);
418 eLayout->addWidget(new QLabel("Directory"), 0, 0);
419 eLayout->addWidget(_ephPathLineEdit, 0, 1);
420 eLayout->addWidget(new QLabel("Interval"), 1, 0);
421 eLayout->addWidget(_ephIntrComboBox, 1, 1);
422 eLayout->addWidget(new QLabel("Port"), 2, 0);
423 eLayout->addWidget(_outEphPortLineEdit, 2, 1);
424 eLayout->addWidget(new QLabel("Version 3"), 3, 0);
425 eLayout->addWidget(_ephV3CheckBox, 3, 1);
426 eLayout->addWidget(new QLabel("Saving RINEX ephemeris files and ephemeris output through IP port."),4,0,1,2,Qt::AlignLeft);
427 eLayout->addWidget(new QLabel(" "),5,0);
428 egroup->setLayout(eLayout);
429
430 QGridLayout* aLayout = new QGridLayout;
431 aLayout->setColumnMinimumWidth(0,14*ww);
432 aLayout->addWidget(new QLabel("Observation rate"), 0, 0);
433 aLayout->addWidget(_obsRateComboBox, 0, 1);
434 aLayout->addWidget(new QLabel("Failure threshold"), 1, 0);
435 aLayout->addWidget(_adviseFailSpinBox, 1, 1);
436 aLayout->addWidget(new QLabel("Recovery threshold"), 2, 0);
437 aLayout->addWidget(_adviseRecoSpinBox, 2, 1);
438 aLayout->addWidget(new QLabel("Pause"), 2, 2, Qt::AlignRight);
439 aLayout->addWidget(_makePauseCheckBox, 2, 3, Qt::AlignLeft);
440 aLayout->addWidget(new QLabel("Script (full path)"), 3, 0);
441 aLayout->addWidget(_adviseScriptLineEdit, 3, 1,1,10);
442 aLayout->addWidget(new QLabel("Outage report, handling of corrupted streams."),5,0,1,10,Qt::AlignLeft);
443 agroup->setLayout(aLayout);
444
445 QGridLayout* rLayout = new QGridLayout;
446 rLayout->setColumnMinimumWidth(0,14*ww);
447 rLayout->addWidget(new QLabel("Mountpoint"), 0, 0);
448 rLayout->addWidget(_miscMountLineEdit, 0, 1, 1,7);
449 rLayout->addWidget(new QLabel("Log latency"), 1, 0);
450 rLayout->addWidget(_perfIntrComboBox, 1, 1);
451 rLayout->addWidget(new QLabel("Scan RTCM"), 2, 0);
452 rLayout->addWidget(_scanRTCMCheckBox, 2, 1);
453 rLayout->addWidget(new QLabel("Log latencies or scan RTCM streams for numbers of message types and antenna information."),3, 0,1,30);
454 rLayout->addWidget(new QLabel(" "), 4, 0);
455 rLayout->addWidget(new QLabel(" "), 5, 0);
456 rgroup->setLayout(rLayout);
457
458 QGridLayout* oLayout = new QGridLayout;
459 oLayout->setColumnMinimumWidth(0,14*ww);
460 oLayout->addWidget(new QLabel("Directory"), 0, 0);
461 oLayout->addWidget(_rnxPathLineEdit, 0, 1,1,12);
462 oLayout->addWidget(new QLabel("Interval"), 1, 0);
463 oLayout->addWidget(_rnxIntrComboBox, 1, 1);
464 oLayout->addWidget(new QLabel("Sampling"), 1, 2, Qt::AlignRight);
465 oLayout->addWidget(_rnxSamplSpinBox, 1, 3, Qt::AlignLeft);
466 oLayout->addWidget(new QLabel("Skeleton extension"), 2, 0);
467 oLayout->addWidget(_rnxSkelLineEdit, 2, 1,1,1, Qt::AlignLeft);
468 oLayout->addWidget(new QLabel("Script (full path)"), 3, 0);
469 oLayout->addWidget(_rnxScrpLineEdit, 3, 1,1,12);
470 oLayout->addWidget(new QLabel("Version 3"), 4, 0);
471 oLayout->addWidget(_rnxV3CheckBox, 4, 1);
472 oLayout->addWidget(new QLabel("Saving RINEX observation files."),5,0,1,12, Qt::AlignLeft);
473 ogroup->setLayout(oLayout);
474
475 QGridLayout* cLayout = new QGridLayout;
476 cLayout->setColumnMinimumWidth(0,14*ww);
477 cLayout->addWidget(new QLabel("Directory"), 0, 0);
478 cLayout->addWidget(_corrPathLineEdit, 0, 1,1,30);
479 cLayout->addWidget(new QLabel("Interval"), 1, 0);
480 cLayout->addWidget(_corrIntrComboBox, 1, 1);
481 cLayout->addWidget(new QLabel("Port"), 2, 0);
482 cLayout->addWidget(_corrPortLineEdit, 2, 1);
483 cLayout->addWidget(new QLabel("Wait for full epoch"), 2, 2, Qt::AlignRight);
484 cLayout->addWidget(_corrTimeSpinBox, 2, 3, Qt::AlignLeft);
485 cLayout->addWidget(new QLabel("Saving Broadcast Ephemeris correction files and correction output through IP port."),3,0,1,30);
486 cLayout->addWidget(new QLabel(" "),4,0);
487 cLayout->addWidget(new QLabel(" "),5,0);
488 cgroup->setLayout(cLayout);
489
490 QGridLayout* serLayout = new QGridLayout;
491 serLayout->setColumnMinimumWidth(0,14*ww);
492 serLayout->addWidget(new QLabel("Mountpoint"), 0,0, Qt::AlignLeft);
493 serLayout->addWidget(_serialMountPointLineEdit, 0,1,1,2);
494 serLayout->addWidget(new QLabel("Port name"), 1,0, Qt::AlignLeft);
495 serLayout->addWidget(_serialPortNameLineEdit, 1,1,1,2);
496 serLayout->addWidget(new QLabel("Baud rate"), 2,0, Qt::AlignLeft);
497 serLayout->addWidget(_serialBaudRateComboBox, 2,1);
498 serLayout->addWidget(new QLabel(" Parity "), 2,2, Qt::AlignRight);
499 serLayout->addWidget(_serialParityComboBox, 2,3);
500 serLayout->addWidget(new QLabel("Data bits"), 3,0, Qt::AlignLeft);
501 serLayout->addWidget(_serialDataBitsComboBox, 3,1);
502 serLayout->addWidget(new QLabel(" Stop bits "), 3,2, Qt::AlignRight);
503 serLayout->addWidget(_serialStopBitsComboBox, 3,3);
504 serLayout->addWidget(new QLabel("Auto NMEA"), 4, 0);
505 serLayout->addWidget(_serialAutoNMEACheckBox, 4, 1);
506 serLayout->addWidget(new QLabel("Serial port settings to feed a serial connected device."),5,0,1,30);
507
508 sergroup->setLayout(serLayout);
509
510//QVBoxLayout* mLayout = new QVBoxLayout;
511//mLayout->addWidget(aogroup);
512//mLayout->addWidget(_mountPointsTable);
513//mLayout->addWidget(_log);
514 QGridLayout* mLayout = new QGridLayout;
515 aogroup->setCurrentIndex(settings.value("startTab").toInt());
516 mLayout->addWidget(aogroup, 0,0);
517 mLayout->addWidget(_mountPointsTable, 1,0);
518 mLayout->addWidget(new QLabel(" Logs:"),2,0);
519 mLayout->addWidget(_log, 3,0);
520
521 _canvas->setLayout(mLayout);
522
523 // Auto start
524 // ----------
525 if ( Qt::CheckState(settings.value("autoStart").toInt()) == Qt::Checked) {
526 slotGetData();
527 }
528}
529
530// Destructor
531////////////////////////////////////////////////////////////////////////////
532bncWindow::~bncWindow() {
533 delete _caster;
534}
535
536//
537////////////////////////////////////////////////////////////////////////////
538void bncWindow::populateMountPointsTable() {
539
540 for (int iRow = _mountPointsTable->rowCount()-1; iRow >=0; iRow--) {
541 _mountPointsTable->removeRow(iRow);
542 }
543
544 QSettings settings;
545
546 QListIterator<QString> it(settings.value("mountPoints").toStringList());
547 if (!it.hasNext()) {
548 _actGetData->setEnabled(false);
549 }
550 int iRow = 0;
551 while (it.hasNext()) {
552 QStringList hlp = it.next().split(" ");
553 if (hlp.size() < 5) continue;
554 _mountPointsTable->insertRow(iRow);
555
556 QUrl url(hlp[0]);
557
558 QString fullPath = url.host() + QString(":%1").arg(url.port()) + url.path();
559 QString format(hlp[1]); QString latitude(hlp[2]); QString longitude(hlp[3]);
560 QString nmea(hlp[4]);
561 QString ntripVersion = "1";
562 if (hlp.size() >= 6) {
563 ntripVersion = (hlp[5]);
564 }
565
566 QTableWidgetItem* it;
567 it = new QTableWidgetItem(url.userInfo());
568 it->setFlags(it->flags() & ~Qt::ItemIsEditable);
569 _mountPointsTable->setItem(iRow, 0, it);
570
571 it = new QTableWidgetItem(fullPath);
572 it->setFlags(it->flags() & ~Qt::ItemIsEditable);
573 _mountPointsTable->setItem(iRow, 1, it);
574
575 it = new QTableWidgetItem(format);
576 _mountPointsTable->setItem(iRow, 2, it);
577
578 if (nmea == "yes") {
579 it = new QTableWidgetItem(latitude);
580 _mountPointsTable->setItem(iRow, 3, it);
581 it = new QTableWidgetItem(longitude);
582 _mountPointsTable->setItem(iRow, 4, it);
583 } else {
584 it = new QTableWidgetItem(latitude);
585 it->setFlags(it->flags() & ~Qt::ItemIsEditable);
586 _mountPointsTable->setItem(iRow, 3, it);
587 it = new QTableWidgetItem(longitude);
588 it->setFlags(it->flags() & ~Qt::ItemIsEditable);
589 _mountPointsTable->setItem(iRow, 4, it);
590 }
591
592 it = new QTableWidgetItem(nmea);
593 it->setFlags(it->flags() & ~Qt::ItemIsEditable);
594 _mountPointsTable->setItem(iRow, 5, it);
595
596 it = new QTableWidgetItem(ntripVersion);
597 it->setFlags(it->flags() & ~Qt::ItemIsEditable);
598 _mountPointsTable->setItem(iRow, 6, it);
599
600 bncTableItem* bncIt = new bncTableItem();
601 bncIt->setFlags(bncIt->flags() & ~Qt::ItemIsEditable);
602 _mountPointsTable->setItem(iRow, 7, bncIt);
603
604 iRow++;
605 }
606
607 _mountPointsTable->sortItems(1);
608}
609
610// Retrieve Table
611////////////////////////////////////////////////////////////////////////////
612void bncWindow::slotAddMountPoints() {
613
614 QSettings settings;
615 QString proxyHost = settings.value("proxyHost").toString();
616 int proxyPort = settings.value("proxyPort").toInt();
617 if (proxyHost != _proxyHostLineEdit->text() ||
618 proxyPort != _proxyPortLineEdit->text().toInt()) {
619 int iRet = QMessageBox::question(this, "Question", "Proxy options "
620 "changed. Use the new ones?",
621 QMessageBox::Yes, QMessageBox::No,
622 QMessageBox::NoButton);
623 if (iRet == QMessageBox::Yes) {
624 settings.setValue("proxyHost", _proxyHostLineEdit->text());
625 settings.setValue("proxyPort", _proxyPortLineEdit->text());
626 settings.sync();
627 }
628 }
629
630 bncTableDlg* dlg = new bncTableDlg(this);
631 dlg->move(this->pos().x()+50, this->pos().y()+50);
632 connect(dlg, SIGNAL(newMountPoints(QStringList*)),
633 this, SLOT(slotNewMountPoints(QStringList*)));
634 dlg->exec();
635 delete dlg;
636
637}
638
639// Delete Selected Mount Points
640////////////////////////////////////////////////////////////////////////////
641void bncWindow::slotDeleteMountPoints() {
642
643 int nRows = _mountPointsTable->rowCount();
644 bool flg[nRows];
645 for (int iRow = 0; iRow < nRows; iRow++) {
646 if (_mountPointsTable->isItemSelected(_mountPointsTable->item(iRow,1))) {
647 flg[iRow] = true;
648 }
649 else {
650 flg[iRow] = false;
651 }
652 }
653 for (int iRow = nRows-1; iRow >= 0; iRow--) {
654 if (flg[iRow]) {
655 _mountPointsTable->removeRow(iRow);
656 }
657 }
658 _actDeleteMountPoints->setEnabled(false);
659
660 if (_mountPointsTable->rowCount() == 0) {
661 _actGetData->setEnabled(false);
662 }
663}
664
665// New Mount Points Selected
666////////////////////////////////////////////////////////////////////////////
667void bncWindow::slotNewMountPoints(QStringList* mountPoints) {
668 int iRow = 0;
669 QListIterator<QString> it(*mountPoints);
670 while (it.hasNext()) {
671 QStringList hlp = it.next().split(" ");
672 QUrl url(hlp[0]);
673 QString fullPath = url.host() + QString(":%1").arg(url.port()) + url.path();
674 QString format(hlp[1]); QString latitude(hlp[2]); QString longitude(hlp[3]);
675 QString nmea(hlp[4]);
676 QString ntripVersion = "1";
677 if (hlp.size() >= 6) {
678 ntripVersion = (hlp[5]);
679 }
680
681 _mountPointsTable->insertRow(iRow);
682
683 QTableWidgetItem* it;
684 it = new QTableWidgetItem(url.userInfo());
685 it->setFlags(it->flags() & ~Qt::ItemIsEditable);
686 _mountPointsTable->setItem(iRow, 0, it);
687
688 it = new QTableWidgetItem(fullPath);
689 it->setFlags(it->flags() & ~Qt::ItemIsEditable);
690 _mountPointsTable->setItem(iRow, 1, it);
691
692 it = new QTableWidgetItem(format);
693 _mountPointsTable->setItem(iRow, 2, it);
694
695 if (nmea == "yes") {
696 it = new QTableWidgetItem(latitude);
697 _mountPointsTable->setItem(iRow, 3, it);
698 it = new QTableWidgetItem(longitude);
699 _mountPointsTable->setItem(iRow, 4, it);
700 } else {
701 it = new QTableWidgetItem(latitude);
702 it->setFlags(it->flags() & ~Qt::ItemIsEditable);
703 _mountPointsTable->setItem(iRow, 3, it);
704 it = new QTableWidgetItem(longitude);
705 it->setFlags(it->flags() & ~Qt::ItemIsEditable);
706 _mountPointsTable->setItem(iRow, 4, it);
707 }
708
709 it = new QTableWidgetItem(nmea);
710 it->setFlags(it->flags() & ~Qt::ItemIsEditable);
711 _mountPointsTable->setItem(iRow, 5, it);
712
713 it = new QTableWidgetItem(ntripVersion);
714 it->setFlags(it->flags() & ~Qt::ItemIsEditable);
715 _mountPointsTable->setItem(iRow, 6, it);
716
717 bncTableItem* bncIt = new bncTableItem();
718 _mountPointsTable->setItem(iRow, 7, bncIt);
719
720 iRow++;
721 }
722 _mountPointsTable->hideColumn(0);
723 _mountPointsTable->sortItems(1);
724 if (mountPoints->count() > 0 && !_actStop->isEnabled()) {
725 _actGetData->setEnabled(true);
726 }
727 delete mountPoints;
728}
729
730// Save Options
731////////////////////////////////////////////////////////////////////////////
732void bncWindow::slotSaveOptions() {
733 QSettings settings;
734 settings.setValue("proxyHost", _proxyHostLineEdit->text());
735 settings.setValue("proxyPort", _proxyPortLineEdit->text());
736 settings.setValue("waitTime", _waitTimeSpinBox->value());
737 settings.setValue("obsRate", _obsRateComboBox->currentText());
738 settings.setValue("adviseFail", _adviseFailSpinBox->value());
739 settings.setValue("adviseReco", _adviseRecoSpinBox->value());
740 settings.setValue("makePause", _makePauseCheckBox->checkState());
741 settings.setValue("outFile", _outFileLineEdit->text());
742 settings.setValue("perfIntr", _perfIntrComboBox->currentText());
743 settings.setValue("outPort", _outPortLineEdit->text());
744 settings.setValue("outUPort", _outUPortLineEdit->text());
745 settings.setValue("outEphPort", _outEphPortLineEdit->text());
746 settings.setValue("corrPort", _corrPortLineEdit->text());
747 settings.setValue("corrTime", _corrTimeSpinBox->value());
748 settings.setValue("rnxPath", _rnxPathLineEdit->text());
749 settings.setValue("ephPath", _ephPathLineEdit->text());
750 settings.setValue("corrPath", _corrPathLineEdit->text());
751 settings.setValue("rnxScript", _rnxScrpLineEdit->text());
752 settings.setValue("rnxIntr", _rnxIntrComboBox->currentText());
753 settings.setValue("onTheFlyInterval", _onTheFlyComboBox->currentText());
754 settings.setValue("ephIntr", _ephIntrComboBox->currentText());
755 settings.setValue("corrIntr", _corrIntrComboBox->currentText());
756 settings.setValue("rnxSampl", _rnxSamplSpinBox->value());
757 settings.setValue("binSampl", _binSamplSpinBox->value());
758 settings.setValue("rnxSkel", _rnxSkelLineEdit->text());
759 settings.setValue("rnxAppend", _rnxAppendCheckBox->checkState());
760 settings.setValue("autoStart", _autoStartCheckBox->checkState());
761 settings.setValue("rnxV3", _rnxV3CheckBox->checkState());
762 settings.setValue("ephV3", _ephV3CheckBox->checkState());
763 settings.setValue("logFile", _logFileLineEdit->text());
764 settings.setValue("adviseScript",_adviseScriptLineEdit->text());
765 settings.setValue("miscMount", _miscMountLineEdit->text());
766 settings.setValue("scanRTCM", _scanRTCMCheckBox->checkState());
767 settings.setValue("serialPortName", _serialPortNameLineEdit->text());
768 settings.setValue("serialMountPoint",_serialMountPointLineEdit->text());
769 settings.setValue("serialBaudRate", _serialBaudRateComboBox->currentText());
770 settings.setValue("serialParity", _serialParityComboBox->currentText());
771 settings.setValue("serialDataBits", _serialDataBitsComboBox->currentText());
772 settings.setValue("serialStopBits", _serialStopBitsComboBox->currentText());
773 settings.setValue("serialAutoNMEA", _serialAutoNMEACheckBox->checkState());
774 settings.setValue("startTab", aogroup->currentIndex());
775
776 QStringList mountPoints;
777
778 for (int iRow = 0; iRow < _mountPointsTable->rowCount(); iRow++) {
779 QUrl url( "//" + _mountPointsTable->item(iRow, 0)->text() +
780 "@" + _mountPointsTable->item(iRow, 1)->text() );
781
782 mountPoints.append(url.toString() + " " +
783 _mountPointsTable->item(iRow, 2)->text()
784 + " " + _mountPointsTable->item(iRow, 3)->text()
785 + " " + _mountPointsTable->item(iRow, 4)->text()
786 + " " + _mountPointsTable->item(iRow, 5)->text()
787 + " " + _mountPointsTable->item(iRow, 6)->text());
788 }
789 settings.setValue("mountPoints", mountPoints);
790 if (_caster) {
791 _caster->slotReadMountPoints();
792 }
793 settings.sync();
794}
795
796// All get slots terminated
797////////////////////////////////////////////////////////////////////////////
798void bncWindow::slotGetThreadErrors() {
799 ((bncApp*)qApp)->slotMessage("All Get Threads Terminated", true);
800 if (!_actStop->isEnabled()) {
801 _actGetData->setEnabled(true);
802 }
803}
804
805// Retrieve Data
806////////////////////////////////////////////////////////////////////////////
807void bncWindow::slotGetData() {
808 slotSaveOptions();
809
810 _actDeleteMountPoints->setEnabled(false);
811 _actGetData->setEnabled(false);
812 _actStop->setEnabled(true);
813
814 _caster = new bncCaster(_outFileLineEdit->text(),
815 _outPortLineEdit->text().toInt());
816
817 ((bncApp*)qApp)->setPort(_outEphPortLineEdit->text().toInt());
818 ((bncApp*)qApp)->setPortCorr(_corrPortLineEdit->text().toInt());
819
820 connect(_caster, SIGNAL(getThreadErrors()),
821 this, SLOT(slotGetThreadErrors()));
822
823 connect (_caster, SIGNAL(mountPointsRead(QList<bncGetThread*>)),
824 this, SLOT(slotMountPointsRead(QList<bncGetThread*>)));
825
826 ((bncApp*)qApp)->slotMessage("============ Start BNC ============", true);
827
828 _caster->slotReadMountPoints();
829}
830
831// Retrieve Data
832////////////////////////////////////////////////////////////////////////////
833void bncWindow::slotStop() {
834 int iRet = QMessageBox::question(this, "Stop", "Stop retrieving data?",
835 QMessageBox::Yes, QMessageBox::No,
836 QMessageBox::NoButton);
837 if (iRet == QMessageBox::Yes) {
838 delete _caster; _caster = 0;
839 _actGetData->setEnabled(true);
840 _actStop->setEnabled(false);
841 }
842}
843
844// Close Application gracefully
845////////////////////////////////////////////////////////////////////////////
846void bncWindow::closeEvent(QCloseEvent* event) {
847
848 int iRet = QMessageBox::question(this, "Close", "Save Options?",
849 QMessageBox::Yes, QMessageBox::No,
850 QMessageBox::Cancel);
851
852 if (iRet == QMessageBox::Cancel) {
853 event->ignore();
854 return;
855 }
856 else if (iRet == QMessageBox::Yes) {
857 slotSaveOptions();
858 }
859
860 QMainWindow::closeEvent(event);
861}
862
863// User changed the selection of mountPoints
864////////////////////////////////////////////////////////////////////////////
865void bncWindow::slotSelectionChanged() {
866 if (_mountPointsTable->selectedItems().isEmpty()) {
867 _actDeleteMountPoints->setEnabled(false);
868 }
869 else {
870 _actDeleteMountPoints->setEnabled(true);
871 }
872}
873
874// Display Program Messages
875////////////////////////////////////////////////////////////////////////////
876void bncWindow::slotWindowMessage(const QByteArray msg, bool showOnScreen) {
877
878#ifdef DEBUG_RTCM2_2021
879 const int maxBufferSize = 1000;
880#else
881 const int maxBufferSize = 10000;
882#endif
883
884 if (! showOnScreen ) {
885 return;
886 }
887
888 QString txt = _log->toPlainText() + "\n" +
889 QDateTime::currentDateTime().toUTC().toString("yy-MM-dd hh:mm:ss ") + msg;
890 _log->clear();
891 _log->append(txt.right(maxBufferSize));
892}
893
894// About Message
895////////////////////////////////////////////////////////////////////////////
896void bncWindow::slotAbout() {
897 new bncAboutDlg(0);
898}
899
900//Flowchart
901////////////////////////////////////////////////////////////////////////////
902void bncWindow::slotFlowchart() {
903 new bncFlowchartDlg(0);
904}
905
906// Help Window
907////////////////////////////////////////////////////////////////////////////
908void bncWindow::slotHelp() {
909 QUrl url;
910 url.setPath(":bnchelp.html");
911 new bncHlpDlg(0, url);
912}
913
914// Select Fonts
915////////////////////////////////////////////////////////////////////////////
916void bncWindow::slotFontSel() {
917 bool ok;
918 QFont newFont = QFontDialog::getFont(&ok, this->font(), this);
919 if (ok) {
920 QSettings settings;
921 settings.setValue("font", newFont.toString());
922 QApplication::setFont(newFont);
923 int ww = QFontMetrics(newFont).width('w');
924 setMinimumSize(60*ww, 80*ww);
925 resize(60*ww, 80*ww);
926 }
927}
928
929// Whats This Help
930void bncWindow::slotWhatsThis() {
931 QWhatsThis::enterWhatsThisMode();
932}
933
934//
935////////////////////////////////////////////////////////////////////////////
936void bncWindow::slotMountPointsRead(QList<bncGetThread*> threads) {
937 populateMountPointsTable();
938 QSettings settings;
939 _binSamplSpinBox->setValue(settings.value("binSampl").toInt());
940 _waitTimeSpinBox->setValue(settings.value("waitTime").toInt());
941 QListIterator<bncGetThread*> iTh(threads);
942 while (iTh.hasNext()) {
943 bncGetThread* thread = iTh.next();
944 for (int iRow = 0; iRow < _mountPointsTable->rowCount(); iRow++) {
945 QUrl url( "//" + _mountPointsTable->item(iRow, 0)->text() +
946 "@" + _mountPointsTable->item(iRow, 1)->text() );
947 if (url == thread->mountPoint() &&
948 _mountPointsTable->item(iRow, 3)->text() == thread->latitude() &&
949 _mountPointsTable->item(iRow, 4)->text() == thread->longitude() ) {
950 ((bncTableItem*) _mountPointsTable->item(iRow, 7))->setGetThread(thread);
951 break;
952 }
953 }
954 }
955}
956
957//
958////////////////////////////////////////////////////////////////////////////
959void bncWindow::CreateMenu() {
960 // Create Menus
961 // ------------
962 _menuFile = menuBar()->addMenu(tr("&File"));
963 _menuFile->addAction(_actFontSel);
964 _menuFile->addSeparator();
965 _menuFile->addAction(_actSaveOpt);
966 _menuFile->addSeparator();
967 _menuFile->addAction(_actQuit);
968
969 _menuHlp = menuBar()->addMenu(tr("&Help"));
970 _menuHlp->addAction(_actHelp);
971 _menuHlp->addAction(_actFlowchart);
972 _menuHlp->addAction(_actAbout);
973}
974
975//
976////////////////////////////////////////////////////////////////////////////
977void bncWindow::AddToolbar() {
978 // Tool (Command) Bar
979 // ------------------
980 QToolBar* toolBar = new QToolBar;
981 addToolBar(Qt::BottomToolBarArea, toolBar);
982 toolBar->setMovable(false);
983 toolBar->addAction(_actAddMountPoints);
984 toolBar->addAction(_actDeleteMountPoints);
985 toolBar->addAction(_actGetData);
986 toolBar->addAction(_actStop);
987 toolBar->addWidget(new QLabel(" "));
988 toolBar->addAction(_actwhatsthis);
989}
990
991//
992////////////////////////////////////////////////////////////////////////////
993bncAboutDlg::bncAboutDlg(QWidget* parent) :
994 QDialog(parent) {
995
996 QTextBrowser* tb = new QTextBrowser;
997 QUrl url; url.setPath(":bncabout.html");
998 tb->setSource(url);
999 tb->setReadOnly(true);
1000
1001 int ww = QFontMetrics(font()).width('w');
1002 QPushButton* _closeButton = new QPushButton("Close");
1003 _closeButton->setMaximumWidth(10*ww);
1004 connect(_closeButton, SIGNAL(clicked()), this, SLOT(close()));
1005
1006 QGridLayout* dlgLayout = new QGridLayout();
1007 QLabel* img = new QLabel();
1008 img->setPixmap(QPixmap(":ntrip-logo.png"));
1009 dlgLayout->addWidget(img, 0,0);
1010 dlgLayout->addWidget(new QLabel("BKG Ntrip Client (BNC) Version 1.7"), 0,1);
1011 dlgLayout->addWidget(tb,1,0,1,2);
1012 dlgLayout->addWidget(_closeButton,2,1,Qt::AlignRight);
1013
1014 setLayout(dlgLayout);
1015 resize(60*ww, 60*ww);
1016 show();
1017}
1018
1019//
1020////////////////////////////////////////////////////////////////////////////
1021bncAboutDlg::~bncAboutDlg() {
1022};
1023
1024//
1025////////////////////////////////////////////////////////////////////////////
1026bncFlowchartDlg::bncFlowchartDlg(QWidget* parent) :
1027 QDialog(parent) {
1028
1029 int ww = QFontMetrics(font()).width('w');
1030 QPushButton* _closeButton = new QPushButton("Close");
1031 _closeButton->setMaximumWidth(10*ww);
1032 connect(_closeButton, SIGNAL(clicked()), this, SLOT(close()));
1033
1034 QGridLayout* dlgLayout = new QGridLayout();
1035 QLabel* img = new QLabel();
1036 img->setPixmap(QPixmap(":bncflowchart.png"));
1037 dlgLayout->addWidget(img, 0,0);
1038 dlgLayout->addWidget(_closeButton,1,0,Qt::AlignLeft);
1039
1040 setLayout(dlgLayout);
1041 show();
1042}
1043
1044//
1045////////////////////////////////////////////////////////////////////////////
1046bncFlowchartDlg::~bncFlowchartDlg() {
1047};
1048
Note: See TracBrowser for help on using the repository browser.