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

Last change on this file since 5064 was 5064, checked in by mervart, 11 years ago
File size: 9.0 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 "bncapp.h"
21
22QMutex bncSettings::_mutex; // static mutex
23
24// Constructor
25////////////////////////////////////////////////////////////////////////////
26bncSettings::bncSettings() {
27 QMutexLocker locker(&_mutex);
28
29#ifdef GNSSCENTER_PLUGIN
30 _bncApp = 0;
31 return;
32#else
33 _bncApp = static_cast<bncApp*>(qApp);
34#endif
35
36 // First fill the options
37 // ----------------------
38 if (_bncApp->_settings.size() == 0) {
39 reRead();
40 }
41}
42
43// Destructor
44////////////////////////////////////////////////////////////////////////////
45bncSettings::~bncSettings() {
46}
47
48// (Re-)read the Options from File or Set the Defaults
49////////////////////////////////////////////////////////////////////////////
50void bncSettings::reRead() {
51
52 _bncApp->_settings.clear();
53
54 QSettings settings(_bncApp->confFileName(), QSettings::IniFormat);
55
56 // Read from File
57 // --------------
58 if (settings.allKeys().size() > 0) {
59 QStringListIterator it(settings.allKeys());
60 while (it.hasNext()) {
61 QString key = it.next();
62 _bncApp->_settings[key] = settings.value(key);
63 }
64 }
65
66 // Set Defaults
67 // ------------
68 else {
69 setValue_p("startTab", "0");
70 setValue_p("statusTab", "0");
71 setValue_p("casterUrlList", (QStringList()
72 << "http://user:pass@www.euref-ip.net:2101"
73 << "http://user:pass@www.igs-ip.net:2101"
74 << "http://user:pass@products.igs-ip.net:2101"
75 << "http://user:pass@mgex.igs-ip.net:2101"));
76 setValue_p("mountPoints", "");
77 setValue_p("ntripVersion", "1");
78 // Network
79 setValue_p("proxyHost", "");
80 setValue_p("proxyPort", "");
81 setValue_p("sslCaCertPath", "");
82 setValue_p("ignoreSslErrors", "0");
83 // General
84 setValue_p("logFile", "");
85 setValue_p("rnxAppend", "0");
86 setValue_p("onTheFlyInterval", "1 day");
87 setValue_p("autoStart", "0");
88 setValue_p("rawOutFile", "");
89 // RINEX Observations
90 setValue_p("rnxPath", "");
91 setValue_p("rnxIntr", "1 day");
92 setValue_p("rnxSampl", "0");
93 setValue_p("rnxSkel", "SKL");
94 setValue_p("rnxScript", "");
95 setValue_p("rnxV3", "0");
96 // RINEX Ephemeris
97 setValue_p("ephPath", "");
98 setValue_p("ephIntr", "1 day");
99 setValue_p("outEphPort", "");
100 setValue_p("ephV3", "0");
101 // Braodcast Corrections
102 setValue_p("corrPath", "");
103 setValue_p("corrIntr", "1 day");
104 setValue_p("corrPort", "");
105 setValue_p("corrTime", "5");
106 // Feed Engine
107 setValue_p("outPort", "");
108 setValue_p("waitTime", "5");
109 setValue_p("binSampl", "0");
110 setValue_p("outFile", "");
111 setValue_p("outUPort", "");
112 // Serial Output
113 setValue_p("serialMountPoint", "");
114 setValue_p("serialPortName", "");
115 setValue_p("serialBaudRate", "9600");
116 setValue_p("serialFlowControl", "OFF");
117 setValue_p("serialDataBits", "8");
118 setValue_p("serialParity", "NONE");
119 setValue_p("serialStopBits", "1");
120 setValue_p("serialAutoNMEA", "Auto");
121 setValue_p("serialFileNMEA", "");
122 setValue_p("serialHeightNMEA", "");
123 // Outages
124 setValue_p("obsRate", "");
125 setValue_p("adviseFail", "15");
126 setValue_p("adviseReco", "5");
127 setValue_p("adviseScript", "");
128 // Miscellaneous
129 setValue_p("miscMount", "");
130 setValue_p("perfIntr", "");
131 setValue_p("scanRTCM", "0");
132 // PPP
133 setValue_p("pppSPP", "");
134 setValue_p("pppMount", "");
135 setValue_p("pppCorrMount", "");
136 setValue_p("pppRefCrdX", "");
137 setValue_p("pppRefCrdY", "");
138 setValue_p("pppRefCrdZ", "");
139 setValue_p("pppRefdN", "");
140 setValue_p("pppRefdE", "");
141 setValue_p("pppRefdU", "");
142 setValue_p("nmeaFile", "");
143 setValue_p("nmeaPort", "");
144 setValue_p("pppPlotCoordinates", "");
145 setValue_p("postObsFile", "");
146 setValue_p("postNavFile", "");
147 setValue_p("postCorrFile", "");
148 setValue_p("postOutFile", "");
149 setValue_p("pppAntenna", "");
150 setValue_p("pppAntex", "");
151 setValue_p("pppUsePhase", "");
152 setValue_p("pppEstTropo", "");
153 setValue_p("pppGLONASS", "");
154 setValue_p("pppGalileo", "");
155 setValue_p("pppSync", "");
156 setValue_p("pppAverage", "");
157 setValue_p("pppQuickStart", "");
158 setValue_p("pppMaxSolGap", "");
159 setValue_p("pppAudioResponse", "");
160 setValue_p("pppSigmaCode", "10.0");
161 setValue_p("pppSigmaPhase", "0.02");
162 setValue_p("pppSigCrd0", "100.0");
163 setValue_p("pppSigCrdP", "100.0");
164 setValue_p("pppSigTrp0", "0.1");
165 setValue_p("pppSigTrpP", "3e-6");
166 // Reqc
167 setValue_p("reqcAction", "");
168 setValue_p("reqcObsFile", "");
169 setValue_p("reqcNavFile", "");
170 setValue_p("reqcOutObsFile", "");
171 setValue_p("reqcOutNavFile", "");
172 setValue_p("reqcOutLogFile", "");
173 setValue_p("reqcPlotDir", "");
174 setValue_p("reqcRnxVersion", "");
175 setValue_p("reqcSampling", "");
176 setValue_p("reqcStartDateTime", "");
177 setValue_p("reqcEndDateTime", "");
178 setValue_p("reqcRunBy", "");
179 setValue_p("reqcComment", "");
180 setValue_p("reqcOldMarkerName", "");
181 setValue_p("reqcNewMarkerName", "");
182 setValue_p("reqcOldAntennaName", "");
183 setValue_p("reqcNewAntennaName", "");
184 setValue_p("reqcOldReceiverName", "");
185 setValue_p("reqcNewReceiverName", "");
186 // Combination
187 setValue_p("combineStreams", "");
188 setValue_p("cmbMethod", "");
189 setValue_p("cmbMaxres", "");
190 setValue_p("cmbSampl", "10");
191 // Upload (clk)
192 setValue_p("uploadMountpointsOut","");
193 setValue_p("uploadIntr", "1 day");
194 setValue_p("uploadSamplRtcmEphCorr", "0");
195 setValue_p("uploadSamplSp3", "1");
196 setValue_p("uploadSamplClkRnx", "10");
197 setValue_p("trafo_dx", "");
198 setValue_p("trafo_dy", "");
199 setValue_p("trafo_dz", "");
200 setValue_p("trafo_dxr", "");
201 setValue_p("trafo_dyr", "");
202 setValue_p("trafo_dzr", "");
203 setValue_p("trafo_ox", "");
204 setValue_p("trafo_oy", "");
205 setValue_p("trafo_oz", "");
206 setValue_p("trafo_oxr", "");
207 setValue_p("trafo_oyr", "");
208 setValue_p("trafo_ozr", "");
209 setValue_p("trafo_sc", "");
210 setValue_p("trafo_scr", "");
211 setValue_p("trafo_t0", "");
212 // Upload (eph)
213 setValue_p("uploadEphHost", "");
214 setValue_p("uploadEphPort", "");
215 setValue_p("uploadEphMountpoint", "");
216 setValue_p("uploadEphPassword", "");
217 setValue_p("uploadEphSample", "5");
218 }
219}
220
221//
222////////////////////////////////////////////////////////////////////////////
223QVariant bncSettings::value(const QString& key,
224 const QVariant& defaultValue) const {
225 QMutexLocker locker(&_mutex);
226
227 if (_bncApp && _bncApp->_settings.contains(key)) {
228 return _bncApp->_settings[key];
229 }
230 else {
231 return defaultValue;
232 }
233}
234
235//
236////////////////////////////////////////////////////////////////////////////
237void bncSettings::setValue(const QString &key, const QVariant& value) {
238 QMutexLocker locker(&_mutex);
239 setValue_p(key, value);
240}
241
242//
243////////////////////////////////////////////////////////////////////////////
244void bncSettings::setValue_p(const QString &key, const QVariant& value) {
245 _bncApp->_settings[key] = value;
246}
247
248//
249////////////////////////////////////////////////////////////////////////////
250void bncSettings::remove(const QString& key ) {
251 QMutexLocker locker(&_mutex);
252 _bncApp->_settings.remove(key);
253}
254
255//
256////////////////////////////////////////////////////////////////////////////
257void bncSettings::sync() {
258 QMutexLocker locker(&_mutex);
259 QSettings settings(_bncApp->confFileName(), QSettings::IniFormat);
260 settings.clear();
261 QMapIterator<QString, QVariant> it(_bncApp->_settings);
262 while (it.hasNext()) {
263 it.next();
264 settings.setValue(it.key(), it.value());
265 }
266 settings.sync();
267}
Note: See TracBrowser for help on using the repository browser.