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

Last change on this file since 9184 was 9184, checked in by stuerze, 3 years ago

an option for the specification of a local skeleton directory is added

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