source: ntrip/trunk/BNC/src/bncsettings.cpp@ 7701

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

Keyname 'ignoreSslErrors' changed to 'sslIngoreErrors'

File size: 9.1 KB
Line 
1/* -------------------------------------------------------------------------
2 * BKG NTRIP Client
3 * -------------------------------------------------------------------------
4 *
5 * Class: bncSettings
6 *
7 * Purpose: Subclasses the QSettings
8 *
9 * Author: L. Mervart
10 *
11 * Created: 25-Jan-2009
12 *
13 * Changes:
14 *
15 * -----------------------------------------------------------------------*/
16
17#include <QSettings>
18
19#include "bncsettings.h"
20#include "bnccore.h"
21
22QMutex bncSettings::_mutex; // static mutex
23
24// Constructor
25////////////////////////////////////////////////////////////////////////////
26bncSettings::bncSettings() {
27 QMutexLocker locker(&_mutex);
28
29 // First fill the options
30 // ----------------------
31 if (BNC_CORE->_settings.size() == 0) {
32 reRead();
33 }
34}
35
36// Destructor
37////////////////////////////////////////////////////////////////////////////
38bncSettings::~bncSettings() {
39}
40
41// (Re-)read the Options from File or Set the Defaults
42////////////////////////////////////////////////////////////////////////////
43void bncSettings::reRead() {
44
45 BNC_CORE->_settings.clear();
46
47 QSettings settings(BNC_CORE->confFileName(), QSettings::IniFormat);
48
49#ifdef GNSSCENTER_PLUGIN
50 settings.beginGroup("BNC");
51#endif
52
53 // Read from File
54 // --------------
55 if (settings.allKeys().size() > 0) {
56 QStringListIterator it(settings.allKeys());
57 while (it.hasNext()) {
58 QString key = it.next();
59 BNC_CORE->_settings[key] = settings.value(key);
60 }
61 }
62
63 // Set Defaults
64 // ------------
65 else {
66 setValue_p("startTab", "0");
67 setValue_p("statusTab", "0");
68 setValue_p("font", "");
69 setValue_p("casterUrlList", (QStringList()
70 << "http://user:pass@www.euref-ip.net:2101"
71 << "http://user:pass@www.igs-ip.net:2101"
72 << "http://user:pass@products.igs-ip.net:2101"
73 << "http://user:pass@mgex.igs-ip.net:2101"));
74 setValue_p("mountPoints", "");
75 setValue_p("ntripVersion", "2");
76 // Network
77 setValue_p("proxyHost", "");
78 setValue_p("proxyPort", "");
79 setValue_p("sslCaCertPath", "");
80 setValue_p("sslIgnoreErrors", "0");
81 // General
82 setValue_p("logFile", "");
83 setValue_p("rnxAppend", "0");
84 setValue_p("onTheFlyInterval", "1 day");
85 setValue_p("autoStart", "0");
86 setValue_p("rawOutFile", "");
87 // RINEX Observations
88 setValue_p("rnxPath", "");
89 setValue_p("rnxIntr", "1 day");
90 setValue_p("rnxOnlyWithSKL", "");
91 setValue_p("rnxSampl", "0");
92 setValue_p("rnxSkel", "SKL");
93 setValue_p("rnxV2Priority", "");
94 setValue_p("rnxScript", "");
95 setValue_p("rnxV3", "0");
96 setValue_p("rnxV3filenames", "0");
97 // RINEX Ephemeris
98 setValue_p("ephPath", "");
99 setValue_p("ephIntr", "1 day");
100 setValue_p("ephOutPort", "");
101 setValue_p("ephV3", "0");
102 setValue_p("ephV3filenames", "0");
103 // Reqc
104 setValue_p("reqcAction", "");
105 setValue_p("reqcObsFile", "");
106 setValue_p("reqcNavFile", "");
107 setValue_p("reqcOutObsFile", "");
108 setValue_p("reqcOutNavFile", "");
109 setValue_p("reqcOutLogFile", "");
110 setValue_p("reqcSkyPlotSignals", "C:2&7 E:1&5 G:1&2 J:1&2 R:1&2 S:1&5");
111 setValue_p("reqcPlotDir", "");
112 setValue_p("reqcRnxVersion", "");
113 setValue_p("reqcSampling", "");
114 setValue_p("reqcStartDateTime", "");
115 setValue_p("reqcEndDateTime", "");
116 setValue_p("reqcLogSummaryOnly", "");
117 setValue_p("reqcRunBy", "");
118 setValue_p("reqcComment", "");
119 setValue_p("reqcOldMarkerName", "");
120 setValue_p("reqcNewMarkerName", "");
121 setValue_p("reqcOldAntennaName", "");
122 setValue_p("reqcNewAntennaName", "");
123 setValue_p("reqcOldReceiverName", "");
124 setValue_p("reqcNewReceiverName", "");
125 setValue_p("reqcNewAntennaNumber","");
126 setValue_p("reqcNewAntennadE", "");
127 setValue_p("reqcNewAntennadN", "");
128 setValue_p("reqcNewAntennadU", "");
129 setValue_p("reqcNewReceiverNumber", "");
130 setValue_p("reqcOldAntennaNumber", "");
131 setValue_p("reqcOldAntennadE", "");
132 setValue_p("reqcOldAntennadN", "");
133 setValue_p("reqcOldAntennadU", "");
134 setValue_p("reqcOldReceiverNumber", "");
135 setValue_p("reqcUseObsTypes", "");
136 setValue_p("reqcV2Priority", "");
137 // SP3
138 setValue_p("sp3CompFile", "");
139 setValue_p("sp3CompExclude", "");
140 setValue_p("sp3CompOutLogFile", "");
141 // Braodcast Corrections
142 setValue_p("corrPath", "");
143 setValue_p("corrIntr", "1 day");
144 setValue_p("corrPort", "");
145 // Feed Engine
146 setValue_p("outPort", "");
147 setValue_p("outWait", "5");
148 setValue_p("outSampl", "0");
149 setValue_p("outFile", "");
150 setValue_p("outUPort", "");
151 // Serial Output
152 setValue_p("serialMountPoint", "");
153 setValue_p("serialPortName", "");
154 setValue_p("serialBaudRate", "9600");
155 setValue_p("serialFlowControl", "OFF");
156 setValue_p("serialDataBits", "8");
157 setValue_p("serialParity", "NONE");
158 setValue_p("serialStopBits", "1");
159 setValue_p("serialAutoNMEA", "Auto");
160 setValue_p("serialFileNMEA", "");
161 setValue_p("serialHeightNMEA", "");
162 setValue_p("serialManualNMEASampling", "");
163 // Outages
164 setValue_p("adviseObsRate", "");
165 setValue_p("adviseFail", "15");
166 setValue_p("adviseReco", "5");
167 setValue_p("adviseScript", "");
168 // Miscellaneous
169 setValue_p("miscMount", "");
170 setValue_p("miscIntr", "");
171 setValue_p("miscScanRTCM", "0");
172 setValue_p("miscPort", "");
173 // Combination
174 setValue_p("cmbStreams", "");
175 setValue_p("cmbMethod", "");
176 setValue_p("cmbMaxres", "");
177 setValue_p("cmbSampl", "10");
178 setValue_p("cmbUseGlonass", "");
179 // Upload (clk)
180 setValue_p("uploadMountpointsOut","");
181 setValue_p("uploadIntr", "1 day");
182 setValue_p("uploadSamplRtcmEphCorr", "0");
183 setValue_p("uploadSamplSp3", "1");
184 setValue_p("uploadSamplClkRnx", "10");
185 setValue_p("trafo_dx", "");
186 setValue_p("trafo_dy", "");
187 setValue_p("trafo_dz", "");
188 setValue_p("trafo_dxr", "");
189 setValue_p("trafo_dyr", "");
190 setValue_p("trafo_dzr", "");
191 setValue_p("trafo_ox", "");
192 setValue_p("trafo_oy", "");
193 setValue_p("trafo_oz", "");
194 setValue_p("trafo_oxr", "");
195 setValue_p("trafo_oyr", "");
196 setValue_p("trafo_ozr", "");
197 setValue_p("trafo_sc", "");
198 setValue_p("trafo_scr", "");
199 setValue_p("trafo_t0", "");
200 // Upload (eph)
201 setValue_p("uploadEphHost", "");
202 setValue_p("uploadEphPort", "");
203 setValue_p("uploadAntexFile", "");
204 setValue_p("uploadEphMountpoint", "");
205 setValue_p("uploadEphPassword", "");
206 setValue_p("uploadEphSample", "5");
207 }
208#ifdef GNSSCENTER_PLUGIN
209 settings.endGroup();
210#endif
211}
212
213//
214////////////////////////////////////////////////////////////////////////////
215QVariant bncSettings::value(const QString& key,
216 const QVariant& defaultValue) const {
217 QMutexLocker locker(&_mutex);
218
219 if (BNC_CORE->_settings.contains(key)) {
220 return BNC_CORE->_settings[key];
221 }
222 else {
223 return defaultValue;
224 }
225}
226
227//
228////////////////////////////////////////////////////////////////////////////
229void bncSettings::setValue(const QString &key, const QVariant& value) {
230 QMutexLocker locker(&_mutex);
231 setValue_p(key, value);
232}
233
234//
235////////////////////////////////////////////////////////////////////////////
236void bncSettings::setValue_p(const QString &key, const QVariant& value) {
237// qDebug() << "key: " << key << " value: " << value;
238 BNC_CORE->_settings[key] = value;
239}
240
241//
242////////////////////////////////////////////////////////////////////////////
243void bncSettings::remove(const QString& key ) {
244 QMutexLocker locker(&_mutex);
245 BNC_CORE->_settings.remove(key);
246}
247
248//
249////////////////////////////////////////////////////////////////////////////
250bool bncSettings::contains(const QString& key) const {
251 QMutexLocker locker(&_mutex);
252 return BNC_CORE->_settings.contains(key);
253}
254
255//
256////////////////////////////////////////////////////////////////////////////
257void bncSettings::sync() {
258 QMutexLocker locker(&_mutex);
259 QSettings settings(BNC_CORE->confFileName(), QSettings::IniFormat);
260 settings.clear();
261 QMapIterator<QString, QVariant> it(BNC_CORE->_settings);
262#ifdef GNSSCENTER_PLUGIN
263 settings.beginGroup("BNC");
264#endif
265 while (it.hasNext()) {
266 it.next();
267 settings.setValue(it.key(), it.value());
268 }
269#ifdef GNSSCENTER_PLUGIN
270 settings.endGroup();
271#endif
272 settings.sync();
273}
Note: See TracBrowser for help on using the repository browser.