[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"
|
---|
[5070] | 20 | #include "bnccore.h"
|
---|
[1535] | 21 |
|
---|
[4073] | 22 | QMutex bncSettings::_mutex; // static mutex
|
---|
| 23 |
|
---|
[1535] | 24 | // Constructor
|
---|
| 25 | ////////////////////////////////////////////////////////////////////////////
|
---|
[4077] | 26 | bncSettings::bncSettings() {
|
---|
[4073] | 27 | QMutexLocker locker(&_mutex);
|
---|
[1536] | 28 |
|
---|
[4070] | 29 | // First fill the options
|
---|
| 30 | // ----------------------
|
---|
[5068] | 31 | if (BNC_CORE->_settings.size() == 0) {
|
---|
[4251] | 32 | reRead();
|
---|
[1536] | 33 | }
|
---|
[1535] | 34 | }
|
---|
| 35 |
|
---|
[4070] | 36 | // Destructor
|
---|
| 37 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 38 | bncSettings::~bncSettings() {
|
---|
| 39 | }
|
---|
| 40 |
|
---|
[4251] | 41 | // (Re-)read the Options from File or Set the Defaults
|
---|
| 42 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 43 | void bncSettings::reRead() {
|
---|
| 44 |
|
---|
[5068] | 45 | BNC_CORE->_settings.clear();
|
---|
[4251] | 46 |
|
---|
[5068] | 47 | QSettings settings(BNC_CORE->confFileName(), QSettings::IniFormat);
|
---|
[4251] | 48 |
|
---|
[5080] | 49 | #ifdef GNSSCENTER_PLUGIN
|
---|
| 50 | settings.beginGroup("BNC");
|
---|
| 51 | #endif
|
---|
| 52 |
|
---|
[4251] | 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();
|
---|
[5068] | 59 | BNC_CORE->_settings[key] = settings.value(key);
|
---|
[4251] | 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 | // Feed Engine
|
---|
| 103 | setValue_p("outPort", "");
|
---|
| 104 | setValue_p("waitTime", "5");
|
---|
| 105 | setValue_p("binSampl", "0");
|
---|
| 106 | setValue_p("outFile", "");
|
---|
| 107 | setValue_p("outUPort", "");
|
---|
| 108 | // Serial Output
|
---|
| 109 | setValue_p("serialMountPoint", "");
|
---|
| 110 | setValue_p("serialPortName", "");
|
---|
| 111 | setValue_p("serialBaudRate", "9600");
|
---|
| 112 | setValue_p("serialFlowControl", "OFF");
|
---|
| 113 | setValue_p("serialDataBits", "8");
|
---|
| 114 | setValue_p("serialParity", "NONE");
|
---|
| 115 | setValue_p("serialStopBits", "1");
|
---|
| 116 | setValue_p("serialAutoNMEA", "Auto");
|
---|
| 117 | setValue_p("serialFileNMEA", "");
|
---|
| 118 | setValue_p("serialHeightNMEA", "");
|
---|
| 119 | // Outages
|
---|
| 120 | setValue_p("obsRate", "");
|
---|
| 121 | setValue_p("adviseFail", "15");
|
---|
| 122 | setValue_p("adviseReco", "5");
|
---|
| 123 | setValue_p("adviseScript", "");
|
---|
| 124 | // Miscellaneous
|
---|
| 125 | setValue_p("miscMount", "");
|
---|
| 126 | setValue_p("perfIntr", "");
|
---|
| 127 | setValue_p("scanRTCM", "0");
|
---|
[5642] | 128 | setValue_p("miscPort", "");
|
---|
[4251] | 129 | // Reqc
|
---|
| 130 | setValue_p("reqcAction", "");
|
---|
| 131 | setValue_p("reqcObsFile", "");
|
---|
| 132 | setValue_p("reqcNavFile", "");
|
---|
| 133 | setValue_p("reqcOutObsFile", "");
|
---|
| 134 | setValue_p("reqcOutNavFile", "");
|
---|
| 135 | setValue_p("reqcOutLogFile", "");
|
---|
[4449] | 136 | setValue_p("reqcPlotDir", "");
|
---|
[4251] | 137 | setValue_p("reqcRnxVersion", "");
|
---|
| 138 | setValue_p("reqcSampling", "");
|
---|
| 139 | setValue_p("reqcStartDateTime", "");
|
---|
| 140 | setValue_p("reqcEndDateTime", "");
|
---|
| 141 | setValue_p("reqcRunBy", "");
|
---|
| 142 | setValue_p("reqcComment", "");
|
---|
| 143 | setValue_p("reqcOldMarkerName", "");
|
---|
| 144 | setValue_p("reqcNewMarkerName", "");
|
---|
| 145 | setValue_p("reqcOldAntennaName", "");
|
---|
| 146 | setValue_p("reqcNewAntennaName", "");
|
---|
| 147 | setValue_p("reqcOldReceiverName", "");
|
---|
| 148 | setValue_p("reqcNewReceiverName", "");
|
---|
| 149 | // Combination
|
---|
| 150 | setValue_p("combineStreams", "");
|
---|
| 151 | setValue_p("cmbMethod", "");
|
---|
| 152 | setValue_p("cmbMaxres", "");
|
---|
| 153 | setValue_p("cmbSampl", "10");
|
---|
| 154 | // Upload (clk)
|
---|
| 155 | setValue_p("uploadMountpointsOut","");
|
---|
| 156 | setValue_p("uploadIntr", "1 day");
|
---|
| 157 | setValue_p("uploadSamplRtcmEphCorr", "0");
|
---|
| 158 | setValue_p("uploadSamplSp3", "1");
|
---|
| 159 | setValue_p("uploadSamplClkRnx", "10");
|
---|
| 160 | setValue_p("trafo_dx", "");
|
---|
| 161 | setValue_p("trafo_dy", "");
|
---|
| 162 | setValue_p("trafo_dz", "");
|
---|
| 163 | setValue_p("trafo_dxr", "");
|
---|
| 164 | setValue_p("trafo_dyr", "");
|
---|
| 165 | setValue_p("trafo_dzr", "");
|
---|
| 166 | setValue_p("trafo_ox", "");
|
---|
| 167 | setValue_p("trafo_oy", "");
|
---|
| 168 | setValue_p("trafo_oz", "");
|
---|
| 169 | setValue_p("trafo_oxr", "");
|
---|
| 170 | setValue_p("trafo_oyr", "");
|
---|
| 171 | setValue_p("trafo_ozr", "");
|
---|
| 172 | setValue_p("trafo_sc", "");
|
---|
| 173 | setValue_p("trafo_scr", "");
|
---|
| 174 | setValue_p("trafo_t0", "");
|
---|
| 175 | // Upload (eph)
|
---|
| 176 | setValue_p("uploadEphHost", "");
|
---|
| 177 | setValue_p("uploadEphPort", "");
|
---|
| 178 | setValue_p("uploadEphMountpoint", "");
|
---|
| 179 | setValue_p("uploadEphPassword", "");
|
---|
| 180 | setValue_p("uploadEphSample", "5");
|
---|
| 181 | }
|
---|
[5080] | 182 | #ifdef GNSSCENTER_PLUGIN
|
---|
| 183 | settings.endGroup();
|
---|
| 184 | #endif
|
---|
[4251] | 185 | }
|
---|
| 186 |
|
---|
[4070] | 187 | //
|
---|
| 188 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 189 | QVariant bncSettings::value(const QString& key,
|
---|
| 190 | const QVariant& defaultValue) const {
|
---|
[4073] | 191 | QMutexLocker locker(&_mutex);
|
---|
| 192 |
|
---|
[5068] | 193 | if (BNC_CORE->_settings.contains(key)) {
|
---|
| 194 | return BNC_CORE->_settings[key];
|
---|
[4070] | 195 | }
|
---|
| 196 | else {
|
---|
| 197 | return defaultValue;
|
---|
| 198 | }
|
---|
| 199 | }
|
---|
| 200 |
|
---|
| 201 | //
|
---|
| 202 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 203 | void bncSettings::setValue(const QString &key, const QVariant& value) {
|
---|
[4078] | 204 | QMutexLocker locker(&_mutex);
|
---|
| 205 | setValue_p(key, value);
|
---|
| 206 | }
|
---|
| 207 |
|
---|
| 208 | //
|
---|
| 209 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 210 | void bncSettings::setValue_p(const QString &key, const QVariant& value) {
|
---|
[5068] | 211 | BNC_CORE->_settings[key] = value;
|
---|
[4070] | 212 | }
|
---|
| 213 |
|
---|
| 214 | //
|
---|
| 215 | ////////////////////////////////////////////////////////////////////////////
|
---|
| 216 | void bncSettings::remove(const QString& key ) {
|
---|
[4073] | 217 | QMutexLocker locker(&_mutex);
|
---|
[5068] | 218 | BNC_CORE->_settings.remove(key);
|
---|
[4070] | 219 | }
|
---|
| 220 |
|
---|
| 221 | //
|
---|
| 222 | ////////////////////////////////////////////////////////////////////////////
|
---|
[6411] | 223 | bool bncSettings::contains(const QString& key) const {
|
---|
| 224 | QMutexLocker locker(&_mutex);
|
---|
| 225 | return BNC_CORE->_settings.contains(key);
|
---|
| 226 | }
|
---|
| 227 |
|
---|
| 228 | //
|
---|
| 229 | ////////////////////////////////////////////////////////////////////////////
|
---|
[4070] | 230 | void bncSettings::sync() {
|
---|
[4073] | 231 | QMutexLocker locker(&_mutex);
|
---|
[5068] | 232 | QSettings settings(BNC_CORE->confFileName(), QSettings::IniFormat);
|
---|
[4075] | 233 | settings.clear();
|
---|
[5068] | 234 | QMapIterator<QString, QVariant> it(BNC_CORE->_settings);
|
---|
[5080] | 235 | #ifdef GNSSCENTER_PLUGIN
|
---|
| 236 | settings.beginGroup("BNC");
|
---|
| 237 | #endif
|
---|
[4075] | 238 | while (it.hasNext()) {
|
---|
| 239 | it.next();
|
---|
| 240 | settings.setValue(it.key(), it.value());
|
---|
| 241 | }
|
---|
[5080] | 242 | #ifdef GNSSCENTER_PLUGIN
|
---|
| 243 | settings.endGroup();
|
---|
| 244 | #endif
|
---|
[4075] | 245 | settings.sync();
|
---|
[4070] | 246 | }
|
---|