Check threshold values
Added check threshold functionality and logging required messages.
Signed-off-by: Vijay Khemka <vijaykhemka@fb.com>
Change-Id: I1621ab1e1e938a9906ea81c3611e9d25d51d207e
diff --git a/virtualSensor.hpp b/virtualSensor.hpp
index 4f9de19..e39f8d9 100644
--- a/virtualSensor.hpp
+++ b/virtualSensor.hpp
@@ -80,9 +80,9 @@
* @param[in] sensorConfig - Json object for sensor config
*/
VirtualSensor(sdbusplus::bus::bus& bus, const char* objPath,
- const Json& sensorConfig) :
+ const Json& sensorConfig, const std::string& name) :
sensorIfaces(bus, objPath),
- bus(bus)
+ bus(bus), name(name)
{
initVirtualSensor(sensorConfig);
}
@@ -108,6 +108,8 @@
private:
/** @brief sdbusplus bus client connection. */
sdbusplus::bus::bus& bus;
+ /** @brief name of sensor */
+ std::string name;
/** @brief Expression string for virtual sensor value calculations */
std::string exprStr;
/** @brief symbol table from exprtk */
@@ -121,6 +123,8 @@
void initVirtualSensor(const Json& sensorConfig);
/** @brief Set Sensor Threshold to D-bus at beginning */
void setSensorThreshold(Threshold& sensorThreshold);
+ /** @brief Check Sensor threshold and update alarm and log */
+ void checkSensorThreshold(const double value);
};
class VirtualSensors