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

Last change on this file since 1332 was 1332, checked in by mervart, 15 years ago

* empty log message *

File size: 51.7 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,broadcaster:port / mountpoint,decoder,lat,long,nmea,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 &Mountpoints"),this);
92 connect(_actAddMountPoints, SIGNAL(triggered()), SLOT(slotAddMountPoints()));
93
94 _actDeleteMountPoints = new QAction(tr("&Delete Mountpoints"),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 _miscMountLineEdit->setMaximumWidth(20*ww);
117 _scanRTCMCheckBox = new QCheckBox();
118 _scanRTCMCheckBox->setCheckState(Qt::CheckState(
119 settings.value("scanRTCM").toInt()));
120 _waitTimeSpinBox = new QSpinBox();
121 _waitTimeSpinBox->setMinimum(1);
122 _waitTimeSpinBox->setMaximum(30);
123 _waitTimeSpinBox->setSingleStep(1);
124 _waitTimeSpinBox->setSuffix(" sec");
125 _waitTimeSpinBox->setMaximumWidth(9*ww);
126 _waitTimeSpinBox->setValue(settings.value("waitTime").toInt());
127 _outFileLineEdit = new QLineEdit(settings.value("outFile").toString());
128 _outPortLineEdit = new QLineEdit(settings.value("outPort").toString());
129 _outPortLineEdit->setMaximumWidth(9*ww);
130 _outUPortLineEdit = new QLineEdit(settings.value("outUPort").toString());
131 _outUPortLineEdit->setMaximumWidth(9*ww);
132 _outEphPortLineEdit = new QLineEdit(settings.value("outEphPort").toString());
133 _outEphPortLineEdit->setMaximumWidth(9*ww);
134 _corrPortLineEdit = new QLineEdit(settings.value("corrPort").toString());
135 _corrPortLineEdit->setMaximumWidth(9*ww);
136 _rnxPathLineEdit = new QLineEdit(settings.value("rnxPath").toString());
137 _ephPathLineEdit = new QLineEdit(settings.value("ephPath").toString());
138 _corrPathLineEdit = new QLineEdit(settings.value("corrPath").toString());
139
140 _rnxV3CheckBox = new QCheckBox();
141 _rnxV3CheckBox->setCheckState(Qt::CheckState(settings.value("rnxV3").toInt()));
142 _ephV3CheckBox = new QCheckBox();
143 _ephV3CheckBox->setCheckState(Qt::CheckState(settings.value("ephV3").toInt()));
144 _rnxScrpLineEdit = new QLineEdit(settings.value("rnxScript").toString());
145 _rnxSkelLineEdit = new QLineEdit(settings.value("rnxSkel").toString());
146 _rnxSkelLineEdit->setMaximumWidth(5*ww);
147 _rnxAppendCheckBox = new QCheckBox();
148 _rnxAppendCheckBox->setCheckState(Qt::CheckState(
149 settings.value("rnxAppend").toInt()));
150 _rnxIntrComboBox = new QComboBox();
151 _rnxIntrComboBox->setMaximumWidth(9*ww);
152 _rnxIntrComboBox->setEditable(false);
153 _rnxIntrComboBox->addItems(QString("1 min,2 min,5 min,10 min,15 min,30 min,1 hour,1 day").split(","));
154 int ii = _rnxIntrComboBox->findText(settings.value("rnxIntr").toString());
155 if (ii != -1) {
156 _rnxIntrComboBox->setCurrentIndex(ii);
157 }
158 _onTheFlyComboBox = new QComboBox();
159 _onTheFlyComboBox->setMaximumWidth(9*ww);
160 _onTheFlyComboBox->setEditable(false);
161 _onTheFlyComboBox->addItems(QString("1 day,1 hour,1 min").split(","));
162 ii = _onTheFlyComboBox->findText(settings.value("onTheFlyInterval").toString());
163 if (ii != -1) {
164 _onTheFlyComboBox->setCurrentIndex(ii);
165 }
166 _ephIntrComboBox = new QComboBox();
167 _ephIntrComboBox->setMaximumWidth(9*ww);
168 _ephIntrComboBox->setEditable(false);
169 _ephIntrComboBox->addItems(QString("1 min,2 min,5 min,10 min,15 min,30 min,1 hour,1 day").split(","));
170 int jj = _ephIntrComboBox->findText(settings.value("ephIntr").toString());
171 if (jj != -1) {
172 _ephIntrComboBox->setCurrentIndex(jj);
173 }
174 _corrIntrComboBox = new QComboBox();
175 _corrIntrComboBox->setMaximumWidth(9*ww);
176 _corrIntrComboBox->setEditable(false);
177 _corrIntrComboBox->addItems(QString("1 min,2 min,5 min,10 min,15 min,30 min,1 hour,1 day").split(","));
178 int mm = _corrIntrComboBox->findText(settings.value("corrIntr").toString());
179 if (mm != -1) {
180 _corrIntrComboBox->setCurrentIndex(mm);
181 }
182 _corrTimeSpinBox = new QSpinBox();
183 _corrTimeSpinBox->setMinimum(1);
184 _corrTimeSpinBox->setMaximum(30);
185 _corrTimeSpinBox->setSingleStep(1);
186 _corrTimeSpinBox->setSuffix(" sec");
187 _corrTimeSpinBox->setMaximumWidth(9*ww);
188 _corrTimeSpinBox->setValue(settings.value("corrTime").toInt());
189 _rnxSamplSpinBox = new QSpinBox();
190 _rnxSamplSpinBox->setMinimum(0);
191 _rnxSamplSpinBox->setMaximum(60);
192 _rnxSamplSpinBox->setSingleStep(5);
193 _rnxSamplSpinBox->setMaximumWidth(9*ww);
194 _rnxSamplSpinBox->setValue(settings.value("rnxSampl").toInt());
195 _rnxSamplSpinBox->setSuffix(" sec");
196
197 _binSamplSpinBox = new QSpinBox();
198 _binSamplSpinBox->setMinimum(0);
199 _binSamplSpinBox->setMaximum(60);
200 _binSamplSpinBox->setSingleStep(5);
201 _binSamplSpinBox->setMaximumWidth(9*ww);
202 _binSamplSpinBox->setValue(settings.value("binSampl").toInt());
203 _binSamplSpinBox->setSuffix(" sec");
204
205 _obsRateComboBox = new QComboBox();
206 _obsRateComboBox->setMaximumWidth(9*ww);
207 _obsRateComboBox->setEditable(false);
208 _obsRateComboBox->addItems(QString(",0.1 Hz,0.2 Hz,0.5 Hz,1 Hz,5 Hz").split(","));
209 int kk = _obsRateComboBox->findText(settings.value("obsRate").toString());
210 if (kk != -1) {
211 _obsRateComboBox->setCurrentIndex(kk);
212 }
213 _makePauseCheckBox = new QCheckBox();
214 _makePauseCheckBox->setCheckState(Qt::CheckState(
215 settings.value("makePause").toInt()));
216 _adviseRecoSpinBox = new QSpinBox();
217 _adviseRecoSpinBox->setMinimum(0);
218 _adviseRecoSpinBox->setMaximum(60);
219 _adviseRecoSpinBox->setSingleStep(1);
220 _adviseRecoSpinBox->setSuffix(" min");
221 _adviseRecoSpinBox->setMaximumWidth(9*ww);
222 _adviseRecoSpinBox->setValue(settings.value("adviseReco").toInt());
223 _adviseFailSpinBox = new QSpinBox();
224 _adviseFailSpinBox->setMinimum(0);
225 _adviseFailSpinBox->setMaximum(60);
226 _adviseFailSpinBox->setSingleStep(1);
227 _adviseFailSpinBox->setSuffix(" min");
228 _adviseFailSpinBox->setMaximumWidth(9*ww);
229 _adviseFailSpinBox->setValue(settings.value("adviseFail").toInt());
230 _logFileLineEdit = new QLineEdit(settings.value("logFile").toString());
231 _adviseScriptLineEdit = new QLineEdit(settings.value("adviseScript").toString());
232
233 _serialPortNameLineEdit = new QLineEdit(settings.value("serialPortName").toString());
234 _serialMountPointLineEdit = new QLineEdit(settings.value("serialMountPoint").toString());
235
236 _serialBaudRateComboBox = new QComboBox();
237 _serialBaudRateComboBox->addItems(QString("110,300,600,"
238 "1200,2400,4800,9600,19200,38400,57600,115200").split(","));
239 kk = _serialBaudRateComboBox->findText(settings.value("serialBaudRate").toString());
240 if (kk != -1) {
241 _serialBaudRateComboBox->setCurrentIndex(kk);
242 }
243 _serialParityComboBox = new QComboBox();
244 _serialParityComboBox->addItems(QString("NONE,ODD,EVEN,SPACE").split(","));
245 kk = _serialParityComboBox->findText(settings.value("serialParity").toString());
246 if (kk != -1) {
247 _serialParityComboBox->setCurrentIndex(kk);
248 }
249 _serialDataBitsComboBox = new QComboBox();
250 _serialDataBitsComboBox->addItems(QString("5,6,7,8").split(","));
251 kk = _serialDataBitsComboBox->findText(settings.value("serialDataBits").toString());
252 if (kk != -1) {
253 _serialDataBitsComboBox->setCurrentIndex(kk);
254 }
255 _serialStopBitsComboBox = new QComboBox();
256 _serialStopBitsComboBox->addItems(QString("1,2").split(","));
257 kk = _serialStopBitsComboBox->findText(settings.value("serialStopBits").toString());
258 if (kk != -1) {
259 _serialStopBitsComboBox->setCurrentIndex(kk);
260 }
261
262 _perfIntrComboBox = new QComboBox();
263 _perfIntrComboBox->setMaximumWidth(9*ww);
264 _perfIntrComboBox->setEditable(false);
265 _perfIntrComboBox->addItems(QString(",1 min,5 min,15 min,1 hour,6 hours,1 day").split(","));
266 int ll = _perfIntrComboBox->findText(settings.value("perfIntr").toString());
267 if (ll != -1) {
268 _perfIntrComboBox->setCurrentIndex(ll);
269 }
270
271 _mountPointsTable = new QTableWidget(0,7);
272
273 _mountPointsTable->horizontalHeader()->resizeSection(1,34*ww);
274 _mountPointsTable->horizontalHeader()->resizeSection(2,9*ww);
275 _mountPointsTable->horizontalHeader()->resizeSection(3,7*ww);
276 _mountPointsTable->horizontalHeader()->resizeSection(4,7*ww);
277 _mountPointsTable->horizontalHeader()->resizeSection(5,5*ww);
278 _mountPointsTable->horizontalHeader()->setResizeMode(QHeaderView::Interactive);
279 _mountPointsTable->horizontalHeader()->setStretchLastSection(true);
280 _mountPointsTable->setHorizontalHeaderLabels(labels);
281 _mountPointsTable->setGridStyle(Qt::NoPen);
282 _mountPointsTable->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
283 _mountPointsTable->setSelectionMode(QAbstractItemView::ExtendedSelection);
284 _mountPointsTable->setSelectionBehavior(QAbstractItemView::SelectRows);
285 _mountPointsTable->hideColumn(0);
286 connect(_mountPointsTable, SIGNAL(itemSelectionChanged()),
287 SLOT(slotSelectionChanged()));
288 populateMountPointsTable();
289
290 _log = new QTextBrowser();
291 _log->setReadOnly(true);
292
293 // WhatsThis
294 // ---------
295 _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>"));
296 _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>"));
297 _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>"));
298 _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."));
299 _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."));
300 _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."));
301 _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."));
302 _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."));
303 _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."));
304 _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."));
305 _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."));
306 _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."));
307 _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>"));
308 _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>"));
309 _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>"));
310 _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>"));
311 _rnxIntrComboBox->setWhatsThis(tr("<p>Select the length of the RINEX Observation file.</p>"));
312 _ephIntrComboBox->setWhatsThis(tr("<p>Select the length of the RINEX Navigation file.</p>"));
313 _corrIntrComboBox->setWhatsThis(tr("<p>Select the length of the Broadcast Ephemeris Correction files.</p>"));
314 _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>"));
315 _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>"));
316 _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>"));
317 _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>"));
318 _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>"));
319 _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>"));
320 _logFileLineEdit->setWhatsThis(tr("Records of BNC's activities are shown in the Log 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."));
321 _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>"));
322 _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 file/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>"));
323 _mountPointsTable->setWhatsThis(tr("<p>Streams selected for retrieval are listed in the 'Mountpoints' section. Clicking on 'Add Mountpoints' 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 'Mountpoints' list, highlight it by clicking on it and hit the 'Delete Mountpoints' button. You can also remove multiple mountpoints 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' and 'format-details' as given in the sourcetable. However, there might be cases where you need to override the automatic selection due to incorrect sourcetable for example. BNC allows users to manually select the required decoder 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). To initiate these streams, an approximate rover position needs to be sent in NMEA GGA message to the NTRIP broadcaster. In return, a user-specific data stream is generated, typically by a Network-RTK software. This stream is customized to the exact latitude and longitude as shown in the 'lat' and 'long' columns under 'Mountpoints'. These VRS streams are indicated by a 'yes' in the 'nmea' column under 'Mountpoints' as well as in the sourcetable. The default 'lat' and 'long' values are taken from the sourcetable. However, in most cases you would probably want to change this according to your requirement. Double click on 'lat' and 'long' fields, enter the values you wish to send and then hit Enter. The format is in positive north latitude degrees (e.g. for northern hemisphere: 52.436, for southern hemisphere: -24.567) and eastern longitude degrees (e.g.: 358.872 or -1.128). Only mountpoints with a 'yes' in its 'nmea' column can be edited. The position should preferably be a point within the coverage of the network.</p>"));
324 _log->setWhatsThis(tr("Records of BNC's activities are shown in the Log 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."));
325 _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."));
326 _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."));
327 _miscMountLineEdit->setWhatsThis(tr("<p>Specify a mountpoint to apply 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>"));
328 _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>"));
329
330 // Canvas with Editable Fields
331 // ---------------------------
332 _canvas = new QWidget;
333 setCentralWidget(_canvas);
334
335 QTabWidget* aogroup = new QTabWidget();
336 QWidget* pgroup = new QWidget();
337 QWidget* ggroup = new QWidget();
338 QWidget* sgroup = new QWidget();
339 QWidget* egroup = new QWidget();
340 QWidget* agroup = new QWidget();
341 QWidget* cgroup = new QWidget();
342 QWidget* ogroup = new QWidget();
343 QWidget* rgroup = new QWidget();
344 QWidget* sergroup = new QWidget();
345 aogroup->addTab(pgroup,tr("Proxy"));
346 aogroup->addTab(ggroup,tr("General"));
347 aogroup->addTab(ogroup,tr("RINEX Observations"));
348 aogroup->addTab(egroup,tr("RINEX Ephemeris"));
349 aogroup->addTab(cgroup,tr("Ephemeris Corrections"));
350 aogroup->addTab(sgroup,tr("Feed Engine"));
351 aogroup->addTab(agroup,tr("Outages"));
352 aogroup->addTab(rgroup,tr("Miscellaneous"));
353 aogroup->addTab(sergroup,tr("Serial"));
354
355 QGridLayout* pLayout = new QGridLayout;
356 pLayout->setColumnMinimumWidth(0,14*ww);
357 pLayout->addWidget(new QLabel("Proxy host"),0,0, Qt::AlignLeft);
358 pLayout->addWidget(_proxyHostLineEdit,0, 1);
359 pLayout->addWidget(new QLabel("Proxy port"),1,0, Qt::AlignLeft);
360 pLayout->addWidget(_proxyPortLineEdit,1,1);
361 pLayout->addWidget(new QLabel("Settings for the proxy in protected networks, leave the boxes blank if none."),2, 0, 1, 2, Qt::AlignLeft);
362 pLayout->addWidget(new QLabel(" "),3,0);
363 pLayout->addWidget(new QLabel(" "),4,0);
364 pLayout->addWidget(new QLabel(" "),5,0);
365 pgroup->setLayout(pLayout);
366
367 QGridLayout* gLayout = new QGridLayout;
368 gLayout->setColumnMinimumWidth(0,14*ww);
369 gLayout->addWidget(new QLabel("Logfile (full path)"), 0, 0);
370 gLayout->addWidget(_logFileLineEdit, 0, 1);
371 gLayout->addWidget(new QLabel("Append files"), 1, 0);
372 gLayout->addWidget(_rnxAppendCheckBox, 1, 1);
373 gLayout->addWidget(new QLabel("Reread configuration"), 2, 0);
374 gLayout->addWidget(_onTheFlyComboBox, 2, 1);
375 gLayout->addWidget(new QLabel("General settings for logfile, file handling and configuration on-the-fly."),3, 0, 1, 2, Qt::AlignLeft);
376 gLayout->addWidget(new QLabel(" "),4,0);
377 gLayout->addWidget(new QLabel(" "),5,0);
378 ggroup->setLayout(gLayout);
379
380 QGridLayout* sLayout = new QGridLayout;
381 sLayout->setColumnMinimumWidth(0,14*ww);
382 sLayout->addWidget(new QLabel("Port (synchronized)"), 0, 0);
383 sLayout->addWidget(_outPortLineEdit, 0, 1);
384 sLayout->addWidget(new QLabel("Wait for full epoch"), 0, 2, Qt::AlignRight);
385 sLayout->addWidget(_waitTimeSpinBox, 0, 3, Qt::AlignLeft);
386 sLayout->addWidget(new QLabel("Port (unsynchronized)"), 1, 0);
387 sLayout->addWidget(_outUPortLineEdit, 1, 1);
388 sLayout->addWidget(new QLabel("File (full path)"), 2, 0);
389 sLayout->addWidget(_outFileLineEdit, 2, 1, 1, 30);
390 sLayout->addWidget(new QLabel("Sampling"), 3, 0);
391 sLayout->addWidget(_binSamplSpinBox, 3, 1, Qt::AlignLeft);
392 sLayout->addWidget(new QLabel("Output decoded observations in a binary format to feed a real-time GNSS engine."),4,0,1,30);
393 sLayout->addWidget(new QLabel(" "),5,0);
394 sgroup->setLayout(sLayout);
395
396 QGridLayout* eLayout = new QGridLayout;
397 eLayout->setColumnMinimumWidth(0,14*ww);
398 eLayout->addWidget(new QLabel("Directory"), 0, 0);
399 eLayout->addWidget(_ephPathLineEdit, 0, 1);
400 eLayout->addWidget(new QLabel("Interval"), 1, 0);
401 eLayout->addWidget(_ephIntrComboBox, 1, 1);
402 eLayout->addWidget(new QLabel("Port"), 2, 0);
403 eLayout->addWidget(_outEphPortLineEdit, 2, 1);
404 eLayout->addWidget(new QLabel("Version 3"), 3, 0);
405 eLayout->addWidget(_ephV3CheckBox, 3, 1);
406 eLayout->addWidget(new QLabel("Saving RINEX ephemeris files and ephemeris output through IP port."),4,0,1,2,Qt::AlignLeft);
407 eLayout->addWidget(new QLabel(" "),5,0);
408 egroup->setLayout(eLayout);
409
410 QGridLayout* aLayout = new QGridLayout;
411 aLayout->setColumnMinimumWidth(0,14*ww);
412 aLayout->addWidget(new QLabel("Observation rate"), 0, 0);
413 aLayout->addWidget(_obsRateComboBox, 0, 1);
414 aLayout->addWidget(new QLabel("Failure threshold"), 1, 0);
415 aLayout->addWidget(_adviseFailSpinBox, 1, 1);
416 aLayout->addWidget(new QLabel("Recovery threshold"), 2, 0);
417 aLayout->addWidget(_adviseRecoSpinBox, 2, 1);
418 aLayout->addWidget(new QLabel("Pause"), 2, 2, Qt::AlignRight);
419 aLayout->addWidget(_makePauseCheckBox, 2, 3, Qt::AlignLeft);
420 aLayout->addWidget(new QLabel("Script (full path)"), 3, 0);
421 aLayout->addWidget(_adviseScriptLineEdit, 3, 1,1,10);
422 aLayout->addWidget(new QLabel("Outage report, handling of corrupted streams."),5,0,1,10,Qt::AlignLeft);
423 agroup->setLayout(aLayout);
424
425 QGridLayout* rLayout = new QGridLayout;
426 rLayout->setColumnMinimumWidth(0,14*ww);
427 rLayout->addWidget(new QLabel("Mountpoint"), 0, 0, Qt::AlignLeft);
428 rLayout->addWidget(_miscMountLineEdit, 0, 1,1,15,Qt::AlignLeft);
429 rLayout->addWidget(new QLabel("Log latency"), 1, 0);
430 rLayout->addWidget(_perfIntrComboBox, 1, 1);
431 rLayout->addWidget(new QLabel("Scan RTCM"), 2, 0);
432 rLayout->addWidget(_scanRTCMCheckBox, 2, 1);
433 rLayout->addWidget(new QLabel("Log latencies or scan RTCM streams for numbers of message types and antenna information."),3, 0, 1, 4, Qt::AlignLeft);
434 rLayout->addWidget(new QLabel(" "), 4, 0);
435 rLayout->addWidget(new QLabel(" "), 5, 0);
436 rgroup->setLayout(rLayout);
437
438 QGridLayout* oLayout = new QGridLayout;
439 oLayout->setColumnMinimumWidth(0,14*ww);
440 oLayout->addWidget(new QLabel("Directory"), 0, 0);
441 oLayout->addWidget(_rnxPathLineEdit, 0, 1,1,12);
442 oLayout->addWidget(new QLabel("Interval"), 1, 0);
443 oLayout->addWidget(_rnxIntrComboBox, 1, 1);
444 oLayout->addWidget(new QLabel("Sampling"), 1, 2, Qt::AlignRight);
445 oLayout->addWidget(_rnxSamplSpinBox, 1, 3, Qt::AlignLeft);
446 oLayout->addWidget(new QLabel("Skeleton extension"), 2, 0);
447 oLayout->addWidget(_rnxSkelLineEdit, 2, 1,1,1, Qt::AlignLeft);
448 oLayout->addWidget(new QLabel("Script (full path)"), 3, 0);
449 oLayout->addWidget(_rnxScrpLineEdit, 3, 1,1,12);
450 oLayout->addWidget(new QLabel("Version 3"), 4, 0);
451 oLayout->addWidget(_rnxV3CheckBox, 4, 1);
452 oLayout->addWidget(new QLabel("Saving RINEX observation files."),5,0,1,12, Qt::AlignLeft);
453 ogroup->setLayout(oLayout);
454
455 QGridLayout* cLayout = new QGridLayout;
456 cLayout->setColumnMinimumWidth(0,14*ww);
457 cLayout->addWidget(new QLabel("Directory"), 0, 0);
458 cLayout->addWidget(_corrPathLineEdit, 0, 1,1,30);
459 cLayout->addWidget(new QLabel("Interval"), 1, 0);
460 cLayout->addWidget(_corrIntrComboBox, 1, 1);
461 cLayout->addWidget(new QLabel("Port"), 2, 0);
462 cLayout->addWidget(_corrPortLineEdit, 2, 1);
463 cLayout->addWidget(new QLabel("Wait for full epoch"), 2, 2, Qt::AlignRight);
464 cLayout->addWidget(_corrTimeSpinBox, 2, 3, Qt::AlignLeft);
465 cLayout->addWidget(new QLabel("Saving Broadcast Ephemeris correction files and correction output through IP port."),3,0,1,30);
466 cLayout->addWidget(new QLabel(" "),4,0);
467 cLayout->addWidget(new QLabel(" "),5,0);
468 cgroup->setLayout(cLayout);
469
470 QGridLayout* serLayout = new QGridLayout;
471 serLayout->addWidget(new QLabel("Port Name"),0,0, Qt::AlignLeft);
472 serLayout->addWidget(_serialPortNameLineEdit,0,1);
473 serLayout->addWidget(new QLabel(" "),0,2, Qt::AlignLeft);
474 serLayout->addWidget(new QLabel("MountPoint"),0,3, Qt::AlignLeft);
475 serLayout->addWidget(_serialMountPointLineEdit,0,4);
476 serLayout->addWidget(new QLabel("Baud Rate"),1,0, Qt::AlignLeft);
477 serLayout->addWidget(_serialBaudRateComboBox,1,1);
478 serLayout->addWidget(new QLabel("Parity"),1,3, Qt::AlignLeft);
479 serLayout->addWidget(_serialParityComboBox,1,4);
480 serLayout->addWidget(new QLabel("Data Bits"),2,0, Qt::AlignLeft);
481 serLayout->addWidget(_serialDataBitsComboBox,2,1);
482 serLayout->addWidget(new QLabel("Stop Bits"),2,3, Qt::AlignLeft);
483 serLayout->addWidget(_serialStopBitsComboBox,2,4);
484
485 sergroup->setLayout(serLayout);
486
487 QVBoxLayout* mLayout = new QVBoxLayout;
488 mLayout->addWidget(aogroup);
489 mLayout->addWidget(_mountPointsTable);
490 mLayout->addWidget(_log);
491
492 _canvas->setLayout(mLayout);
493}
494
495// Destructor
496////////////////////////////////////////////////////////////////////////////
497bncWindow::~bncWindow() {
498 delete _caster;
499}
500
501//
502////////////////////////////////////////////////////////////////////////////
503void bncWindow::populateMountPointsTable() {
504
505 for (int iRow = _mountPointsTable->rowCount()-1; iRow >=0; iRow--) {
506 _mountPointsTable->removeRow(iRow);
507 }
508
509 QSettings settings;
510
511 QListIterator<QString> it(settings.value("mountPoints").toStringList());
512 if (!it.hasNext()) {
513 _actGetData->setEnabled(false);
514 }
515 int iRow = 0;
516 while (it.hasNext()) {
517 QStringList hlp = it.next().split(" ");
518 if (hlp.size() < 5) continue;
519 _mountPointsTable->insertRow(iRow);
520
521 QUrl url(hlp[0]);
522
523 QString fullPath = url.host() + QString(":%1").arg(url.port()) + url.path();
524 QString format(hlp[1]); QString latitude(hlp[2]); QString longitude(hlp[3]);
525 QString nmea(hlp[4]);
526
527 QTableWidgetItem* it;
528 it = new QTableWidgetItem(url.userInfo());
529 it->setFlags(it->flags() & ~Qt::ItemIsEditable);
530 _mountPointsTable->setItem(iRow, 0, it);
531
532 it = new QTableWidgetItem(fullPath);
533 it->setFlags(it->flags() & ~Qt::ItemIsEditable);
534 _mountPointsTable->setItem(iRow, 1, it);
535
536 it = new QTableWidgetItem(format);
537 _mountPointsTable->setItem(iRow, 2, it);
538
539 if (nmea == "yes") {
540 it = new QTableWidgetItem(latitude);
541 _mountPointsTable->setItem(iRow, 3, it);
542 it = new QTableWidgetItem(longitude);
543 _mountPointsTable->setItem(iRow, 4, it);
544 } else {
545 it = new QTableWidgetItem(latitude);
546 it->setFlags(it->flags() & ~Qt::ItemIsEditable);
547 _mountPointsTable->setItem(iRow, 3, it);
548 it = new QTableWidgetItem(longitude);
549 it->setFlags(it->flags() & ~Qt::ItemIsEditable);
550 _mountPointsTable->setItem(iRow, 4, it);
551 }
552
553 it = new QTableWidgetItem(nmea);
554 it->setFlags(it->flags() & ~Qt::ItemIsEditable);
555 _mountPointsTable->setItem(iRow, 5, it);
556
557 bncTableItem* bncIt = new bncTableItem();
558 bncIt->setFlags(bncIt->flags() & ~Qt::ItemIsEditable);
559 _mountPointsTable->setItem(iRow, 6, bncIt);
560
561 iRow++;
562 }
563
564 _mountPointsTable->sortItems(1);
565}
566
567// Retrieve Table
568////////////////////////////////////////////////////////////////////////////
569void bncWindow::slotAddMountPoints() {
570
571 QSettings settings;
572 QString proxyHost = settings.value("proxyHost").toString();
573 int proxyPort = settings.value("proxyPort").toInt();
574 if (proxyHost != _proxyHostLineEdit->text() ||
575 proxyPort != _proxyPortLineEdit->text().toInt()) {
576 int iRet = QMessageBox::question(this, "Question", "Proxy options "
577 "changed. Use the new ones?",
578 QMessageBox::Yes, QMessageBox::No,
579 QMessageBox::NoButton);
580 if (iRet == QMessageBox::Yes) {
581 settings.setValue("proxyHost", _proxyHostLineEdit->text());
582 settings.setValue("proxyPort", _proxyPortLineEdit->text());
583 }
584 }
585
586 bncTableDlg* dlg = new bncTableDlg(this);
587 dlg->move(this->pos().x()+50, this->pos().y()+50);
588 connect(dlg, SIGNAL(newMountPoints(QStringList*)),
589 this, SLOT(slotNewMountPoints(QStringList*)));
590 dlg->exec();
591 delete dlg;
592
593}
594
595// Delete Selected Mount Points
596////////////////////////////////////////////////////////////////////////////
597void bncWindow::slotDeleteMountPoints() {
598
599 int nRows = _mountPointsTable->rowCount();
600 bool flg[nRows];
601 for (int iRow = 0; iRow < nRows; iRow++) {
602 if (_mountPointsTable->isItemSelected(_mountPointsTable->item(iRow,1))) {
603 flg[iRow] = true;
604 }
605 else {
606 flg[iRow] = false;
607 }
608 }
609 for (int iRow = nRows-1; iRow >= 0; iRow--) {
610 if (flg[iRow]) {
611 _mountPointsTable->removeRow(iRow);
612 }
613 }
614 _actDeleteMountPoints->setEnabled(false);
615
616 if (_mountPointsTable->rowCount() == 0) {
617 _actGetData->setEnabled(false);
618 }
619}
620
621// New Mount Points Selected
622////////////////////////////////////////////////////////////////////////////
623void bncWindow::slotNewMountPoints(QStringList* mountPoints) {
624 int iRow = 0;
625 QListIterator<QString> it(*mountPoints);
626 while (it.hasNext()) {
627 QStringList hlp = it.next().split(" ");
628 QUrl url(hlp[0]);
629 QString fullPath = url.host() + QString(":%1").arg(url.port()) + url.path();
630 QString format(hlp[1]); QString latitude(hlp[2]); QString longitude(hlp[3]);
631 QString nmea(hlp[4]);
632
633 _mountPointsTable->insertRow(iRow);
634
635 QTableWidgetItem* it;
636 it = new QTableWidgetItem(url.userInfo());
637 it->setFlags(it->flags() & ~Qt::ItemIsEditable);
638 _mountPointsTable->setItem(iRow, 0, it);
639
640 it = new QTableWidgetItem(fullPath);
641 it->setFlags(it->flags() & ~Qt::ItemIsEditable);
642 _mountPointsTable->setItem(iRow, 1, it);
643
644 it = new QTableWidgetItem(format);
645 _mountPointsTable->setItem(iRow, 2, it);
646
647 if (nmea == "yes") {
648 it = new QTableWidgetItem(latitude);
649 _mountPointsTable->setItem(iRow, 3, it);
650 it = new QTableWidgetItem(longitude);
651 _mountPointsTable->setItem(iRow, 4, it);
652 } else {
653 it = new QTableWidgetItem(latitude);
654 it->setFlags(it->flags() & ~Qt::ItemIsEditable);
655 _mountPointsTable->setItem(iRow, 3, it);
656 it = new QTableWidgetItem(longitude);
657 it->setFlags(it->flags() & ~Qt::ItemIsEditable);
658 _mountPointsTable->setItem(iRow, 4, it);
659 }
660
661 it = new QTableWidgetItem(nmea);
662 it->setFlags(it->flags() & ~Qt::ItemIsEditable);
663 _mountPointsTable->setItem(iRow, 5, it);
664
665 bncTableItem* bncIt = new bncTableItem();
666 _mountPointsTable->setItem(iRow, 6, bncIt);
667
668 iRow++;
669 }
670 _mountPointsTable->hideColumn(0);
671 _mountPointsTable->sortItems(1);
672 if (mountPoints->count() > 0 && !_actStop->isEnabled()) {
673 _actGetData->setEnabled(true);
674 }
675 delete mountPoints;
676}
677
678// Save Options
679////////////////////////////////////////////////////////////////////////////
680void bncWindow::slotSaveOptions() {
681 QSettings settings;
682 settings.setValue("proxyHost", _proxyHostLineEdit->text());
683 settings.setValue("proxyPort", _proxyPortLineEdit->text());
684 settings.setValue("waitTime", _waitTimeSpinBox->value());
685 settings.setValue("obsRate", _obsRateComboBox->currentText());
686 settings.setValue("adviseFail", _adviseFailSpinBox->value());
687 settings.setValue("adviseReco", _adviseRecoSpinBox->value());
688 settings.setValue("makePause", _makePauseCheckBox->checkState());
689 settings.setValue("outFile", _outFileLineEdit->text());
690 settings.setValue("perfIntr", _perfIntrComboBox->currentText());
691 settings.setValue("outPort", _outPortLineEdit->text());
692 settings.setValue("outUPort", _outUPortLineEdit->text());
693 settings.setValue("outEphPort", _outEphPortLineEdit->text());
694 settings.setValue("corrPort", _corrPortLineEdit->text());
695 settings.setValue("corrTime", _corrTimeSpinBox->value());
696 settings.setValue("rnxPath", _rnxPathLineEdit->text());
697 settings.setValue("ephPath", _ephPathLineEdit->text());
698 settings.setValue("corrPath", _corrPathLineEdit->text());
699 settings.setValue("rnxScript", _rnxScrpLineEdit->text());
700 settings.setValue("rnxIntr", _rnxIntrComboBox->currentText());
701 settings.setValue("onTheFlyInterval", _onTheFlyComboBox->currentText());
702 settings.setValue("ephIntr", _ephIntrComboBox->currentText());
703 settings.setValue("corrIntr", _corrIntrComboBox->currentText());
704 settings.setValue("rnxSampl", _rnxSamplSpinBox->value());
705 settings.setValue("binSampl", _binSamplSpinBox->value());
706 settings.setValue("rnxSkel", _rnxSkelLineEdit->text());
707 settings.setValue("rnxAppend", _rnxAppendCheckBox->checkState());
708 settings.setValue("rnxV3", _rnxV3CheckBox->checkState());
709 settings.setValue("ephV3", _ephV3CheckBox->checkState());
710 settings.setValue("logFile", _logFileLineEdit->text());
711 settings.setValue("adviseScript",_adviseScriptLineEdit->text());
712 settings.setValue("miscMount", _miscMountLineEdit->text());
713 settings.setValue("scanRTCM", _scanRTCMCheckBox->checkState());
714 settings.setValue("serialPortName", _serialPortNameLineEdit->text());
715 settings.setValue("serialMountPoint", _serialMountPointLineEdit->text());
716 settings.setValue("serialBaudRate", _serialBaudRateComboBox->currentText());
717 settings.setValue("serialParity", _serialParityComboBox->currentText());
718 settings.setValue("serialDataBits", _serialDataBitsComboBox->currentText());
719 settings.setValue("serialStopBits", _serialStopBitsComboBox->currentText());
720
721 QStringList mountPoints;
722
723 for (int iRow = 0; iRow < _mountPointsTable->rowCount(); iRow++) {
724 QUrl url( "//" + _mountPointsTable->item(iRow, 0)->text() +
725 "@" + _mountPointsTable->item(iRow, 1)->text() );
726
727 mountPoints.append(url.toString() + " " +
728 _mountPointsTable->item(iRow, 2)->text()
729 + " " + _mountPointsTable->item(iRow, 3)->text()
730 + " " + _mountPointsTable->item(iRow, 4)->text()
731 + " " + _mountPointsTable->item(iRow, 5)->text());
732 }
733 settings.setValue("mountPoints", mountPoints);
734 if (_caster) {
735 _caster->slotReadMountPoints();
736 }
737}
738
739// All get slots terminated
740////////////////////////////////////////////////////////////////////////////
741void bncWindow::slotGetThreadErrors() {
742 ((bncApp*)qApp)->slotMessage("All Get Threads Terminated", true);
743 if (!_actStop->isEnabled()) {
744 _actGetData->setEnabled(true);
745 }
746}
747
748// Retrieve Data
749////////////////////////////////////////////////////////////////////////////
750void bncWindow::slotGetData() {
751 slotSaveOptions();
752
753 _actDeleteMountPoints->setEnabled(false);
754 _actGetData->setEnabled(false);
755 _actStop->setEnabled(true);
756
757 _caster = new bncCaster(_outFileLineEdit->text(),
758 _outPortLineEdit->text().toInt());
759
760 ((bncApp*)qApp)->setPort(_outEphPortLineEdit->text().toInt());
761 ((bncApp*)qApp)->setPortCorr(_corrPortLineEdit->text().toInt());
762
763 connect(_caster, SIGNAL(getThreadErrors()),
764 this, SLOT(slotGetThreadErrors()));
765
766 connect (_caster, SIGNAL(mountPointsRead(QList<bncGetThread*>)),
767 this, SLOT(slotMountPointsRead(QList<bncGetThread*>)));
768
769 ((bncApp*)qApp)->slotMessage("============ Start BNC ============", true);
770
771 _caster->slotReadMountPoints();
772}
773
774// Retrieve Data
775////////////////////////////////////////////////////////////////////////////
776void bncWindow::slotStop() {
777 int iRet = QMessageBox::question(this, "Stop", "Stop retrieving data?",
778 QMessageBox::Yes, QMessageBox::No,
779 QMessageBox::NoButton);
780 if (iRet == QMessageBox::Yes) {
781 delete _caster; _caster = 0;
782 _actGetData->setEnabled(true);
783 _actStop->setEnabled(false);
784 }
785}
786
787// Close Application gracefully
788////////////////////////////////////////////////////////////////////////////
789void bncWindow::closeEvent(QCloseEvent* event) {
790
791 int iRet = QMessageBox::question(this, "Close", "Save Options?",
792 QMessageBox::Yes, QMessageBox::No,
793 QMessageBox::Cancel);
794
795 if (iRet == QMessageBox::Cancel) {
796 event->ignore();
797 return;
798 }
799 else if (iRet == QMessageBox::Yes) {
800 slotSaveOptions();
801 }
802
803 QMainWindow::closeEvent(event);
804}
805
806// User changed the selection of mountPoints
807////////////////////////////////////////////////////////////////////////////
808void bncWindow::slotSelectionChanged() {
809 if (_mountPointsTable->selectedItems().isEmpty()) {
810 _actDeleteMountPoints->setEnabled(false);
811 }
812 else {
813 _actDeleteMountPoints->setEnabled(true);
814 }
815}
816
817// Display Program Messages
818////////////////////////////////////////////////////////////////////////////
819void bncWindow::slotWindowMessage(const QByteArray msg, bool showOnScreen) {
820
821#ifdef DEBUG_RTCM2_2021
822 const int maxBufferSize = 1000;
823#else
824 const int maxBufferSize = 10000;
825#endif
826
827 if (! showOnScreen ) {
828 return;
829 }
830
831 QString txt = _log->toPlainText() + "\n" +
832 QDateTime::currentDateTime().toUTC().toString("yy-MM-dd hh:mm:ss ") + msg;
833 _log->clear();
834 _log->append(txt.right(maxBufferSize));
835}
836
837// About Message
838////////////////////////////////////////////////////////////////////////////
839void bncWindow::slotAbout() {
840 new bncAboutDlg(0);
841}
842
843//Flowchart
844////////////////////////////////////////////////////////////////////////////
845void bncWindow::slotFlowchart() {
846 new bncFlowchartDlg(0);
847}
848
849// Help Window
850////////////////////////////////////////////////////////////////////////////
851void bncWindow::slotHelp() {
852 QUrl url;
853 url.setPath(":bnchelp.html");
854 new bncHlpDlg(0, url);
855}
856
857// Select Fonts
858////////////////////////////////////////////////////////////////////////////
859void bncWindow::slotFontSel() {
860 bool ok;
861 QFont newFont = QFontDialog::getFont(&ok, this->font(), this);
862 if (ok) {
863 QSettings settings;
864 settings.setValue("font", newFont.toString());
865 QApplication::setFont(newFont);
866 int ww = QFontMetrics(newFont).width('w');
867 setMinimumSize(60*ww, 80*ww);
868 resize(60*ww, 80*ww);
869 }
870}
871
872// Whats This Help
873void bncWindow::slotWhatsThis() {
874 QWhatsThis::enterWhatsThisMode();
875}
876
877//
878////////////////////////////////////////////////////////////////////////////
879void bncWindow::slotMountPointsRead(QList<bncGetThread*> threads) {
880 populateMountPointsTable();
881 QSettings settings;
882 _binSamplSpinBox->setValue(settings.value("binSampl").toInt());
883 _waitTimeSpinBox->setValue(settings.value("waitTime").toInt());
884 QListIterator<bncGetThread*> iTh(threads);
885 while (iTh.hasNext()) {
886 bncGetThread* thread = iTh.next();
887 for (int iRow = 0; iRow < _mountPointsTable->rowCount(); iRow++) {
888 QUrl url( "//" + _mountPointsTable->item(iRow, 0)->text() +
889 "@" + _mountPointsTable->item(iRow, 1)->text() );
890 if (url == thread->mountPoint() &&
891 _mountPointsTable->item(iRow, 3)->text() == thread->latitude() &&
892 _mountPointsTable->item(iRow, 4)->text() == thread->longitude() ) {
893 ((bncTableItem*) _mountPointsTable->item(iRow, 6))->setGetThread(thread);
894 break;
895 }
896 }
897 }
898}
899
900//
901////////////////////////////////////////////////////////////////////////////
902void bncWindow::CreateMenu() {
903 // Create Menus
904 // ------------
905 _menuFile = menuBar()->addMenu(tr("&File"));
906 _menuFile->addAction(_actFontSel);
907 _menuFile->addSeparator();
908 _menuFile->addAction(_actSaveOpt);
909 _menuFile->addSeparator();
910 _menuFile->addAction(_actQuit);
911
912 _menuHlp = menuBar()->addMenu(tr("&Help"));
913 _menuHlp->addAction(_actHelp);
914 _menuHlp->addAction(_actFlowchart);
915 _menuHlp->addAction(_actAbout);
916}
917
918//
919////////////////////////////////////////////////////////////////////////////
920void bncWindow::AddToolbar() {
921 // Tool (Command) Bar
922 // ------------------
923 QToolBar* toolBar = new QToolBar;
924 addToolBar(Qt::BottomToolBarArea, toolBar);
925 toolBar->setMovable(false);
926 toolBar->addAction(_actAddMountPoints);
927 toolBar->addAction(_actDeleteMountPoints);
928 toolBar->addAction(_actGetData);
929 toolBar->addAction(_actStop);
930 toolBar->addWidget(new QLabel(" "));
931 toolBar->addAction(_actwhatsthis);
932}
933
934//
935////////////////////////////////////////////////////////////////////////////
936bncAboutDlg::bncAboutDlg(QWidget* parent) :
937 QDialog(parent) {
938
939 QTextBrowser* tb = new QTextBrowser;
940 QUrl url; url.setPath(":bncabout.html");
941 tb->setSource(url);
942 tb->setReadOnly(true);
943
944 int ww = QFontMetrics(font()).width('w');
945 QPushButton* _closeButton = new QPushButton("Close");
946 _closeButton->setMaximumWidth(10*ww);
947 connect(_closeButton, SIGNAL(clicked()), this, SLOT(close()));
948
949 QGridLayout* dlgLayout = new QGridLayout();
950 QLabel* img = new QLabel();
951 img->setPixmap(QPixmap(":ntrip-logo.png"));
952 dlgLayout->addWidget(img, 0,0);
953 dlgLayout->addWidget(new QLabel("BKG Ntrip Client (BNC) Version 1.7"), 0,1);
954 dlgLayout->addWidget(tb,1,0,1,2);
955 dlgLayout->addWidget(_closeButton,2,1,Qt::AlignRight);
956
957 setLayout(dlgLayout);
958 resize(60*ww, 60*ww);
959 show();
960}
961
962//
963////////////////////////////////////////////////////////////////////////////
964bncAboutDlg::~bncAboutDlg() {
965};
966
967//
968////////////////////////////////////////////////////////////////////////////
969bncFlowchartDlg::bncFlowchartDlg(QWidget* parent) :
970 QDialog(parent) {
971
972 int ww = QFontMetrics(font()).width('w');
973 QPushButton* _closeButton = new QPushButton("Close");
974 _closeButton->setMaximumWidth(10*ww);
975 connect(_closeButton, SIGNAL(clicked()), this, SLOT(close()));
976
977 QGridLayout* dlgLayout = new QGridLayout();
978 QLabel* img = new QLabel();
979 img->setPixmap(QPixmap(":bncflowchart.png"));
980 dlgLayout->addWidget(img, 0,0);
981 dlgLayout->addWidget(_closeButton,1,0,Qt::AlignLeft);
982
983 setLayout(dlgLayout);
984 show();
985}
986
987//
988////////////////////////////////////////////////////////////////////////////
989bncFlowchartDlg::~bncFlowchartDlg() {
990};
991
Note: See TracBrowser for help on using the repository browser.