Commit 718e4334 authored by Micha Mueller's avatar Micha Mueller
Browse files

Tiny fix and improvement to SensorBase

parent 3ec2f885
......@@ -341,7 +341,11 @@ protected:
if (boost::iequals(val.first, "mqttsuffix")) {
sBase.setMqtt(val.second.data());
} else if (boost::iequals(val.first, "skipConstVal")) {
sBase.setSkipConstVal(val.second.data());
if (val.second.data() == "on") {
sBase.setSkipConstVal(true);
} else {
sBase.setSkipConstVal(false);
}
}
}
sensorBase(sBase, config);
......
......@@ -43,6 +43,7 @@ public:
SensorBase& operator=(const SensorBase& other) {
_name = other._name;
_mqtt = other._mqtt;
_skipConstVal = other._skipConstVal;
_cache.reset(nullptr);
_latestValue.timestamp = other._latestValue.timestamp;
_latestValue.value = other._latestValue.value;
......@@ -59,13 +60,7 @@ public:
void setName(const std::string& name) { _name = name; }
void setMqtt(const std::string& mqtt) { _mqtt = mqtt; }
void setSkipConstVal(const std::string& skipConstVal) {
if (skipConstVal == "on") {
_skipConstVal = true;
} else {
_skipConstVal = false;
}
}
void setSkipConstVal(bool skipConstVal) { _skipConstVal = skipConstVal; }
const std::size_t getSizeOfReadingQueue() const { return _readingQueue->read_available(); }
std::size_t popReadingQueue(reading_t *reads, std::size_t max) const { return _readingQueue->pop(reads, max); }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment