Fix numeric threshold

There was an issue when sensor value reach threshold set by the user.
Example: given numeric threshold, set as increasing with value of 20.0,
and following sensor updates: 20 -> 30 -> 40, trigger action  would not
start, which is clearly a defect, as 30 is crossed.

Testing done:
- numeric threshold now works with example given above.
- UTs were updated and are passing.

Signed-off-by: Szymon Dompke <szymon.dompke@intel.com>
Change-Id: I955876e076f2286efd98d187cae775a7ab2f4e28
diff --git a/src/numeric_threshold.hpp b/src/numeric_threshold.hpp
index 4e47721..4b861a3 100644
--- a/src/numeric_threshold.hpp
+++ b/src/numeric_threshold.hpp
@@ -50,18 +50,26 @@
 
     struct ThresholdDetail
     {
-        std::string sensorName;
-        double prevValue;
-        bool dwell;
+        std::optional<double> prevValue = std::nullopt;
+        numeric::Direction prevDirection = numeric::Direction::either;
+        bool dwell = false;
         boost::asio::steady_timer timer;
 
-        ThresholdDetail(const std::string& name, double prevValue, bool dwell,
+        ThresholdDetail(const std::string& sensorNameIn,
                         boost::asio::io_context& ioc) :
-            sensorName(name),
-            prevValue(prevValue), dwell(dwell), timer(ioc)
+            timer(ioc),
+            sensorName(sensorNameIn)
         {}
         ThresholdDetail(const ThresholdDetail&) = delete;
         ThresholdDetail(ThresholdDetail&&) = delete;
+
+        const std::string& getSensorName()
+        {
+            return sensorName;
+        }
+
+      private:
+        std::string sensorName;
     };
     using SensorDetails =
         std::unordered_map<std::shared_ptr<interfaces::Sensor>,