Add base class to simplify threshold logic

Add base class for the default case check_thresholds
calls the thresholds.cpp function. This way for normal
things we can just pass sensors around as the base class.

Make it so that theshold alerts are only sent once.

Change-Id: Ic8e3ae1900aeb12b74c099f637f45bc038bd3c9a
Signed-off-by: James Feist <james.feist@linux.intel.com>
diff --git a/sensors/include/CPUSensor.hpp b/sensors/include/CPUSensor.hpp
index 85ae831..8f7d2f0 100644
--- a/sensors/include/CPUSensor.hpp
+++ b/sensors/include/CPUSensor.hpp
@@ -2,8 +2,9 @@
 
 #include <Thresholds.hpp>
 #include <sdbusplus/asio/object_server.hpp>
+#include <sensor.hpp>
 
-class CPUSensor
+class CPUSensor : public Sensor
 {
   private:
     std::string path;
@@ -11,16 +12,9 @@
     sdbusplus::asio::object_server &objServer;
     std::shared_ptr<sdbusplus::asio::connection> dbusConnection;
     std::string name;
-    std::vector<thresholds::Threshold> thresholds;
-    std::shared_ptr<sdbusplus::asio::dbus_interface> sensor_interface;
-    std::shared_ptr<sdbusplus::asio::dbus_interface>
-        threshold_interface_warning;
-    std::shared_ptr<sdbusplus::asio::dbus_interface>
-        threshold_interface_critical;
     boost::asio::posix::stream_descriptor input_dev;
     boost::asio::deadline_timer wait_timer;
     boost::asio::streambuf read_buf;
-    double value;
     int err_count;
     double max_value;
     double min_value;
@@ -28,8 +22,7 @@
     void handle_response(const boost::system::error_code &err);
     void check_thresholds(void);
     void update_value(const double &new_value);
-    void assert_thresholds(thresholds::Level level,
-                           thresholds::Direction direction, bool assert);
+
     void set_initial_properties(
         std::shared_ptr<sdbusplus::asio::connection> &conn);