source: ntrip/branches/BNC_2.11.0/src/bncsettings.cpp@ 9161

Last change on this file since 9161 was 5642, checked in by weber, 11 years ago

Raw stream output through TCP/IP port enabled

File size: 9.4 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("casterUrlList", (QStringList()
69 << "http://user:pass@www.euref-ip.net:2101"
70 << "http://user:pass@www.igs-ip.net:2101"
71 << "http://user:pass@products.igs-ip.net:2101"
72 << "http://user:pass@mgex.igs-ip.net:2101"));
73 setValue_p("mountPoints", "");
74 setValue_p("ntripVersion", "1");
75 // Network
76 setValue_p("proxyHost", "");
77 setValue_p("proxyPort", "");
78 setValue_p("sslCaCertPath", "");
79 setValue_p("ignoreSslErrors", "0");
80 // General
81 setValue_p("logFile", "");
82 setValue_p("rnxAppend", "0");
83 setValue_p("onTheFlyInterval", "1 day");
84 setValue_p("autoStart", "0");
85 setValue_p("rawOutFile", "");
86 // RINEX Observations
87 setValue_p("rnxPath", "");
88 setValue_p("rnxIntr", "1 day");
89 setValue_p("rnxSampl", "0");
90 setValue_p("rnxSkel", "SKL");
91 setValue_p("rnxScript", "");
92 setValue_p("rnxV3", "0");
93 // RINEX Ephemeris
94 setValue_p("ephPath", "");
95 setValue_p("ephIntr", "1 day");
96 setValue_p("outEphPort", "");
97 setValue_p("ephV3", "0");
98 // Braodcast Corrections
99 setValue_p("corrPath", "");
100 setValue_p("corrIntr", "1 day");
101 setValue_p("corrPort", "");
102 setValue_p("corrTime", "5");
103 // Feed Engine
104 setValue_p("outPort", "");
105 setValue_p("waitTime", "5");
106 setValue_p("binSampl", "0");
107 setValue_p("outFile", "");
108 setValue_p("outUPort", "");
109 // Serial Output
110 setValue_p("serialMountPoint", "");
111 setValue_p("serialPortName", "");
112 setValue_p("serialBaudRate", "9600");
113 setValue_p("serialFlowControl", "OFF");
114 setValue_p("serialDataBits", "8");
115 setValue_p("serialParity", "NONE");
116 setValue_p("serialStopBits", "1");
117 setValue_p("serialAutoNMEA", "Auto");
118 setValue_p("serialFileNMEA", "");
119 setValue_p("serialHeightNMEA", "");
120 // Outages
121 setValue_p("obsRate", "");
122 setValue_p("adviseFail", "15");
123 setValue_p("adviseReco", "5");
124 setValue_p("adviseScript", "");
125 // Miscellaneous
126 setValue_p("miscMount", "");
127 setValue_p("perfIntr", "");
128 setValue_p("scanRTCM", "0");
129 setValue_p("miscPort", "");
130 // PPP
131 setValue_p("pppSPP", "");
132 setValue_p("pppMount", "");
133 setValue_p("pppCorrMount", "");
134 setValue_p("pppRefCrdX", "");
135 setValue_p("pppRefCrdY", "");
136 setValue_p("pppRefCrdZ", "");
137 setValue_p("pppRefdN", "");
138 setValue_p("pppRefdE", "");
139 setValue_p("pppRefdU", "");
140 setValue_p("nmeaFile", "");
141 setValue_p("nmeaPort", "");
142 setValue_p("pppPlotCoordinates", "");
143 setValue_p("useOsmMap", false);
144 setValue_p("mapWinDotSize", "");
145 setValue_p("mapWinDotColor", "red");
146 setValue_p("mapSpeed", 0);
147 setValue_p("postObsFile", "");
148 setValue_p("postNavFile", "");
149 setValue_p("postCorrFile", "");
150 setValue_p("postOutFile", "");
151 setValue_p("pppAntenna", "");
152 setValue_p("pppAntex", "");
153 setValue_p("pppUsePhase", "");
154 setValue_p("pppEstTropo", "");
155 setValue_p("pppGLONASS", "");
156 setValue_p("pppGalileo", "");
157 setValue_p("pppSync", "");
158 setValue_p("pppAverage", "");
159 setValue_p("pppQuickStart", "");
160 setValue_p("pppMaxSolGap", "");
161 setValue_p("pppAudioResponse", "");
162 setValue_p("pppSigmaCode", "10.0");
163 setValue_p("pppSigmaPhase", "0.02");
164 setValue_p("pppSigCrd0", "100.0");
165 setValue_p("pppSigCrdP", "100.0");
166 setValue_p("pppSigTrp0", "0.1");
167 setValue_p("pppSigTrpP", "3e-6");
168 // Reqc
169 setValue_p("reqcAction", "");
170 setValue_p("reqcObsFile", "");
171 setValue_p("reqcNavFile", "");
172 setValue_p("reqcOutObsFile", "");
173 setValue_p("reqcOutNavFile", "");
174 setValue_p("reqcOutLogFile", "");
175 setValue_p("reqcPlotDir", "");
176 setValue_p("reqcSkyPlotSystems", "ALL");
177 setValue_p("reqcRnxVersion", "");
178 setValue_p("reqcSampling", "");
179 setValue_p("reqcStartDateTime", "");
180 setValue_p("reqcEndDateTime", "");
181 setValue_p("reqcRunBy", "");
182 setValue_p("reqcComment", "");
183 setValue_p("reqcOldMarkerName", "");
184 setValue_p("reqcNewMarkerName", "");
185 setValue_p("reqcOldAntennaName", "");
186 setValue_p("reqcNewAntennaName", "");
187 setValue_p("reqcOldReceiverName", "");
188 setValue_p("reqcNewReceiverName", "");
189 // Combination
190 setValue_p("combineStreams", "");
191 setValue_p("cmbMethod", "");
192 setValue_p("cmbMaxres", "");
193 setValue_p("cmbSampl", "10");
194 // Upload (clk)
195 setValue_p("uploadMountpointsOut","");
196 setValue_p("uploadIntr", "1 day");
197 setValue_p("uploadSamplRtcmEphCorr", "0");
198 setValue_p("uploadSamplSp3", "1");
199 setValue_p("uploadSamplClkRnx", "10");
200 setValue_p("trafo_dx", "");
201 setValue_p("trafo_dy", "");
202 setValue_p("trafo_dz", "");
203 setValue_p("trafo_dxr", "");
204 setValue_p("trafo_dyr", "");
205 setValue_p("trafo_dzr", "");
206 setValue_p("trafo_ox", "");
207 setValue_p("trafo_oy", "");
208 setValue_p("trafo_oz", "");
209 setValue_p("trafo_oxr", "");
210 setValue_p("trafo_oyr", "");
211 setValue_p("trafo_ozr", "");
212 setValue_p("trafo_sc", "");
213 setValue_p("trafo_scr", "");
214 setValue_p("trafo_t0", "");
215 // Upload (eph)
216 setValue_p("uploadEphHost", "");
217 setValue_p("uploadEphPort", "");
218 setValue_p("uploadEphMountpoint", "");
219 setValue_p("uploadEphPassword", "");
220 setValue_p("uploadEphSample", "5");
221 }
222#ifdef GNSSCENTER_PLUGIN
223 settings.endGroup();
224#endif
225}
226
227//
228////////////////////////////////////////////////////////////////////////////
229QVariant bncSettings::value(const QString& key,
230 const QVariant& defaultValue) const {
231 QMutexLocker locker(&_mutex);
232
233 if (BNC_CORE->_settings.contains(key)) {
234 return BNC_CORE->_settings[key];
235 }
236 else {
237 return defaultValue;
238 }
239}
240
241//
242////////////////////////////////////////////////////////////////////////////
243void bncSettings::setValue(const QString &key, const QVariant& value) {
244 QMutexLocker locker(&_mutex);
245 setValue_p(key, value);
246}
247
248//
249////////////////////////////////////////////////////////////////////////////
250void bncSettings::setValue_p(const QString &key, const QVariant& value) {
251 BNC_CORE->_settings[key] = value;
252}
253
254//
255////////////////////////////////////////////////////////////////////////////
256void bncSettings::remove(const QString& key ) {
257 QMutexLocker locker(&_mutex);
258 BNC_CORE->_settings.remove(key);
259}
260
261//
262////////////////////////////////////////////////////////////////////////////
263void bncSettings::sync() {
264 QMutexLocker locker(&_mutex);
265 QSettings settings(BNC_CORE->confFileName(), QSettings::IniFormat);
266 settings.clear();
267 QMapIterator<QString, QVariant> it(BNC_CORE->_settings);
268#ifdef GNSSCENTER_PLUGIN
269 settings.beginGroup("BNC");
270#endif
271 while (it.hasNext()) {
272 it.next();
273 settings.setValue(it.key(), it.value());
274 }
275#ifdef GNSSCENTER_PLUGIN
276 settings.endGroup();
277#endif
278 settings.sync();
279}
Note: See TracBrowser for help on using the repository browser.