source: ntrip/trunk/BNC/bncsettings.cpp@ 4182

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