Add redundancy sensor and cleanup

Add fan redundancy sensor and move some class members
into the base class. Asio now protects against setting
the same number twice, allow it now to simplify code.

Change-Id: Idb6b5ff4746da92be62c4756fe442d5a5ed23f4f
Signed-off-by: James Feist <james.feist@linux.intel.com>
diff --git a/sensors/src/Thresholds.cpp b/sensors/src/Thresholds.cpp
index ee4f7d0..10b1674 100644
--- a/sensors/src/Thresholds.cpp
+++ b/sensors/src/Thresholds.cpp
@@ -2,6 +2,7 @@
 #include <VariantVisitors.hpp>
 #include <boost/algorithm/string/replace.hpp>
 #include <boost/lexical_cast.hpp>
+#include <cmath>
 #include <fstream>
 #include <iostream>
 #include <sensor.hpp>
@@ -163,16 +164,21 @@
     }
 }
 
-void checkThresholds(Sensor *sensor)
+bool checkThresholds(Sensor *sensor)
 {
+    bool status = true;
 
     if (sensor->thresholds.empty())
     {
-        return;
+        return true;
     }
     for (auto &threshold : sensor->thresholds)
     {
-        if (threshold.direction == thresholds::Direction::HIGH)
+        if (std::isnan(sensor->value))
+        {
+            threshold.asserted = false;
+        }
+        else if (threshold.direction == thresholds::Direction::HIGH)
         {
             if (sensor->value > threshold.value && !threshold.asserted)
             {
@@ -202,7 +208,13 @@
                 threshold.asserted = false;
             }
         }
+        if (threshold.level == thresholds::Level::CRITICAL &&
+            threshold.asserted)
+        {
+            status = false;
+        }
     }
+    return status;
 }
 
 void assertThresholds(Sensor *sensor, thresholds::Level level,