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/ADCSensor.hpp b/sensors/include/ADCSensor.hpp
index 07c7893..d59bd5f 100644
--- a/sensors/include/ADCSensor.hpp
+++ b/sensors/include/ADCSensor.hpp
@@ -2,8 +2,9 @@
#include <Thresholds.hpp>
#include <sdbusplus/asio/object_server.hpp>
+#include <sensor.hpp>
-class ADCSensor
+class ADCSensor : public Sensor
{
public:
std::string name;
@@ -20,16 +21,9 @@
private:
std::string path;
sdbusplus::asio::object_server &objServer;
- 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;
@@ -38,8 +32,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);
};
\ No newline at end of file