cpusensor: Add thresold offset
Added DTS critical offset parameter to change critical thresold
value of DTS sensors.
Tested by setting value in entity manager and seeing output
reflect in dbus interface.
Change-Id: Ib819d20322b7eca5f6e8690827bf97d49695e995
Signed-off-by: Vijay Khemka <vijaykhemka@fb.com>
diff --git a/src/CPUSensor.cpp b/src/CPUSensor.cpp
index 0920754..7654fde 100644
--- a/src/CPUSensor.cpp
+++ b/src/CPUSensor.cpp
@@ -33,12 +33,12 @@
boost::asio::io_service& io, const std::string& sensorName,
std::vector<thresholds::Threshold>&& _thresholds,
const std::string& sensorConfiguration, int cpuId,
- bool show) :
+ bool show, double dtsOffset) :
Sensor(boost::replace_all_copy(sensorName, " ", "_"),
std::move(_thresholds), sensorConfiguration, objectType, maxReading,
minReading),
objServer(objectServer), inputDev(io, open(path.c_str(), O_RDONLY)),
- path(path), waitTimer(io), show(show),
+ path(path), waitTimer(io), show(show), dtsOffset(dtsOffset),
privTcontrol(std::numeric_limits<double>::quiet_NaN()), errCount(0)
{
nameTcontrol = labelTcontrol;
@@ -132,7 +132,8 @@
{
std::vector<thresholds::Threshold> newThresholds;
if (parseThresholdsFromAttr(newThresholds, path,
- CPUSensor::sensorScaleFactor))
+ CPUSensor::sensorScaleFactor,
+ dtsOffset))
{
if (!std::equal(thresholds.begin(), thresholds.end(),
newThresholds.begin(),