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

Last change on this file since 9850 was 9850, checked in by stuerze, 18 months ago

minor changes

File size: 9.3 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()
[9404]68 << "http://user:pass@euref-ip.net:2101"
69 << "http://user:pass@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", "");
[9292]73 setValue_p("ntripVersion", "2");
[4251]74 // Network
75 setValue_p("proxyHost", "");
76 setValue_p("proxyPort", "");
77 setValue_p("sslCaCertPath", "");
[9795]78 setValue_p("sslClientCertPath", "");
[9292]79 setValue_p("sslIgnoreErrors", "0");
[4251]80 // General
81 setValue_p("logFile", "");
[9292]82 setValue_p("rnxAppend", "0");
83 setValue_p("onTheFlyInterval", "no");
84 setValue_p("autoStart", "0");
[4251]85 setValue_p("rawOutFile", "");
86 // RINEX Observations
87 setValue_p("rnxPath", "");
[9292]88 setValue_p("rnxIntr", "1 day");
[6827]89 setValue_p("rnxOnlyWithSKL", "");
[9292]90 setValue_p("rnxSampl", "1 sec");
91 setValue_p("rnxSkel", "skl");
[9184]92 setValue_p("rnxSkelPath", "");
[6827]93 setValue_p("rnxV2Priority", "");
[4251]94 setValue_p("rnxScript", "");
[9760]95 setValue_p("rnxVersion", "3");
[4251]96 // RINEX Ephemeris
97 setValue_p("ephPath", "");
[9292]98 setValue_p("ephIntr", "1 day");
[7326]99 setValue_p("ephOutPort", "");
[9760]100 setValue_p("ephVersion", "3");
[6827]101 // Reqc
102 setValue_p("reqcAction", "");
103 setValue_p("reqcObsFile", "");
104 setValue_p("reqcNavFile", "");
105 setValue_p("reqcOutObsFile", "");
106 setValue_p("reqcOutNavFile", "");
107 setValue_p("reqcOutLogFile", "");
[9424]108 setValue_p("reqcSkyPlotSignals", "G:1&2&5 R:1&2&3 E:1&7 C:2&6 J:1&2 I:5&9 S:1&5");
[6827]109 setValue_p("reqcPlotDir", "");
110 setValue_p("reqcRnxVersion", "");
[8397]111 setValue_p("reqcSampling", "1 sec");
[8354]112 setValue_p("reqcStartDateTime", "1967-11-02T00:00:00");
113 setValue_p("reqcEndDateTime", "2099-01-01T00:00:00");
[6827]114 setValue_p("reqcLogSummaryOnly", "");
115 setValue_p("reqcRunBy", "");
116 setValue_p("reqcComment", "");
117 setValue_p("reqcOldMarkerName", "");
118 setValue_p("reqcNewMarkerName", "");
119 setValue_p("reqcOldAntennaName", "");
120 setValue_p("reqcNewAntennaName", "");
121 setValue_p("reqcOldReceiverName", "");
122 setValue_p("reqcNewReceiverName", "");
[8010]123 setValue_p("reqcOldAntennaNumber", "");
[6827]124 setValue_p("reqcNewAntennaNumber","");
[8010]125 setValue_p("reqcOldAntennadE", "");
[6827]126 setValue_p("reqcNewAntennadE", "");
[8010]127 setValue_p("reqcOldAntennadN", "");
[6827]128 setValue_p("reqcNewAntennadN", "");
[8010]129 setValue_p("reqcOldAntennadU", "");
[6827]130 setValue_p("reqcNewAntennadU", "");
[8010]131 setValue_p("reqcOldReceiverNumber", "");
[6827]132 setValue_p("reqcNewReceiverNumber", "");
133 setValue_p("reqcUseObsTypes", "");
[9850]134 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:18&DPX I:ABCX S:1&C S:5&IQX");
[7297]135 // SP3
[6827]136 setValue_p("sp3CompFile", "");
137 setValue_p("sp3CompExclude", "");
138 setValue_p("sp3CompOutLogFile", "");
[4251]139 // Braodcast Corrections
140 setValue_p("corrPath", "");
[9292]141 setValue_p("corrIntr", "1 day");
[4251]142 setValue_p("corrPort", "");
143 // Feed Engine
144 setValue_p("outPort", "");
[9292]145 setValue_p("outWait", "5");
146 setValue_p("outSampl", "1 sec");
[4251]147 setValue_p("outFile", "");
148 setValue_p("outUPort", "");
[9292]149 setValue_p("outLockTime", "0");
[4251]150 // Serial Output
151 setValue_p("serialMountPoint", "");
152 setValue_p("serialPortName", "");
153 setValue_p("serialBaudRate", "9600");
154 setValue_p("serialFlowControl", "OFF");
155 setValue_p("serialDataBits", "8");
156 setValue_p("serialParity", "NONE");
157 setValue_p("serialStopBits", "1");
158 setValue_p("serialAutoNMEA", "Auto");
159 setValue_p("serialFileNMEA", "");
160 setValue_p("serialHeightNMEA", "");
[8672]161 setValue_p("serialManualNMEASampling", "10");
[4251]162 // Outages
[7330]163 setValue_p("adviseObsRate", "");
[4251]164 setValue_p("adviseFail", "15");
165 setValue_p("adviseReco", "5");
166 setValue_p("adviseScript", "");
167 // Miscellaneous
[7297]168 setValue_p("miscMount", "");
[7418]169 setValue_p("miscIntr", "");
170 setValue_p("miscScanRTCM", "0");
[7297]171 setValue_p("miscPort", "");
[4251]172 // Combination
[7297]173 setValue_p("cmbStreams", "");
[4251]174 setValue_p("cmbMethod", "");
175 setValue_p("cmbMaxres", "");
[9292]176 setValue_p("cmbSampl", "10");
177 setValue_p("cmbGps", "2");
178 setValue_p("cmbGlo", "2");
179 setValue_p("cmbGal", "2");
180 setValue_p("cmbBds", "2");
181 setValue_p("cmbQzss", "0");
182 setValue_p("cmbSbas", "0");
183 setValue_p("cmbIrnss", "0");
184
[4251]185 // Upload (clk)
186 setValue_p("uploadMountpointsOut","");
[9292]187 setValue_p("uploadIntr", "1 day");
[4251]188 setValue_p("uploadSamplRtcmEphCorr", "0");
[9292]189 setValue_p("uploadSamplSp3", "1");
190 setValue_p("uploadSamplClkRnx", "10");
[9652]191 setValue_p("uploadSamplBiaSnx", "60");
[4251]192 setValue_p("trafo_dx", "");
193 setValue_p("trafo_dy", "");
194 setValue_p("trafo_dz", "");
195 setValue_p("trafo_dxr", "");
196 setValue_p("trafo_dyr", "");
197 setValue_p("trafo_dzr", "");
198 setValue_p("trafo_ox", "");
199 setValue_p("trafo_oy", "");
200 setValue_p("trafo_oz", "");
201 setValue_p("trafo_oxr", "");
202 setValue_p("trafo_oyr", "");
203 setValue_p("trafo_ozr", "");
204 setValue_p("trafo_sc", "");
205 setValue_p("trafo_scr", "");
206 setValue_p("trafo_t0", "");
207 // Upload (eph)
[7889]208 setValue_p("uploadEphMountpointsOut","");
[8870]209 setValue_p("uploadSamplRtcmEph", "5");
[4251]210 }
[5080]211#ifdef GNSSCENTER_PLUGIN
212 settings.endGroup();
213#endif
[4251]214}
215
[7297]216//
[4070]217////////////////////////////////////////////////////////////////////////////
218QVariant bncSettings::value(const QString& key,
219 const QVariant& defaultValue) const {
[4073]220 QMutexLocker locker(&_mutex);
221
[5068]222 if (BNC_CORE->_settings.contains(key)) {
223 return BNC_CORE->_settings[key];
[4070]224 }
225 else {
226 return defaultValue;
227 }
228}
229
[7297]230//
[4070]231////////////////////////////////////////////////////////////////////////////
232void bncSettings::setValue(const QString &key, const QVariant& value) {
[4078]233 QMutexLocker locker(&_mutex);
234 setValue_p(key, value);
235}
236
[7297]237//
[4078]238////////////////////////////////////////////////////////////////////////////
239void bncSettings::setValue_p(const QString &key, const QVariant& value) {
[5068]240 BNC_CORE->_settings[key] = value;
[4070]241}
242
[7297]243//
[4070]244////////////////////////////////////////////////////////////////////////////
245void bncSettings::remove(const QString& key ) {
[4073]246 QMutexLocker locker(&_mutex);
[5068]247 BNC_CORE->_settings.remove(key);
[4070]248}
249
[7297]250//
[4070]251////////////////////////////////////////////////////////////////////////////
[6411]252bool bncSettings::contains(const QString& key) const {
253 QMutexLocker locker(&_mutex);
254 return BNC_CORE->_settings.contains(key);
255}
256
[7297]257//
[6411]258////////////////////////////////////////////////////////////////////////////
[4070]259void bncSettings::sync() {
[4073]260 QMutexLocker locker(&_mutex);
[5068]261 QSettings settings(BNC_CORE->confFileName(), QSettings::IniFormat);
[4075]262 settings.clear();
[5068]263 QMapIterator<QString, QVariant> it(BNC_CORE->_settings);
[5080]264#ifdef GNSSCENTER_PLUGIN
265 settings.beginGroup("BNC");
266#endif
[4075]267 while (it.hasNext()) {
268 it.next();
269 settings.setValue(it.key(), it.value());
270 }
[5080]271#ifdef GNSSCENTER_PLUGIN
272 settings.endGroup();
273#endif
[4075]274 settings.sync();
[4070]275}
Note: See TracBrowser for help on using the repository browser.