Support threshold hysteresis

Add support for a hysteresis value on the warning high/low and critical
high/low sensor thresholds.  On the high thresholds, this requires the
sensor value to dip below the (threshold - hysteresis) value before the
alarm clears, and on the low thresholds it has to go above (threshold +
hysteresis).

These are optional fields in the configuration JSON and will default to
zero if not present, which results in the previous behavior of not
having a hysteresis at all.

Tested: with IBM's Ambient_Virtual_Temp sensor. When changing the value
above a high threshold and then back below the threshold, we only see
the alarm deasserted when the temp is below (threshold - hysteresis).

Change-Id: Ied1d40def94e1b66cf4ec8826799bada4e6236ab
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Signed-off-by: Rashmica Gupta <rashmica.g@gmail.com>
diff --git a/virtualSensor.hpp b/virtualSensor.hpp
index b4fd815..3b47fd6 100644
--- a/virtualSensor.hpp
+++ b/virtualSensor.hpp
@@ -199,8 +199,9 @@
         static constexpr auto tname = T::element_type::name;
 
         auto alarmHigh = threshold->alarmHigh();
+        auto highHysteresis = threshold->getHighHysteresis();
         if ((!alarmHigh && value >= threshold->high()) ||
-            (alarmHigh && value < threshold->high()))
+            (alarmHigh && value < (threshold->high() - highHysteresis)))
         {
             if (!alarmHigh)
             {
@@ -220,8 +221,9 @@
         }
 
         auto alarmLow = threshold->alarmLow();
+        auto lowHysteresis = threshold->getLowHysteresis();
         if ((!alarmLow && value <= threshold->low()) ||
-            (alarmLow && value > threshold->low()))
+            (alarmLow && value > (threshold->low() + lowHysteresis)))
         {
             if (!alarmLow)
             {