blob: 58eb534ddecb81a112fb0bf380c6b70b0aed1443 [file] [log] [blame]
James Feist139cb572018-09-10 15:26:18 -07001#pragma once
2
3#include <Thresholds.hpp>
4#include <sdbusplus/asio/object_server.hpp>
5
6class HwmonTempSensor
7{
8 public:
9 std::string name;
10 std::string configuration;
11 HwmonTempSensor(const std::string &path, const std::string &objectType,
12 sdbusplus::asio::object_server &objectServer,
13 std::shared_ptr<sdbusplus::asio::connection> &conn,
14 boost::asio::io_service &io, const std::string &fan_name,
15 std::vector<thresholds::Threshold> &&thresholds,
16 const std::string &sensorConfiguration);
17 ~HwmonTempSensor();
18
19 private:
20 std::string path;
21 std::string objectType;
22 sdbusplus::asio::object_server &objServer;
23 std::vector<thresholds::Threshold> thresholds;
24 std::shared_ptr<sdbusplus::asio::dbus_interface> sensor_interface;
25 std::shared_ptr<sdbusplus::asio::dbus_interface>
26 threshold_interface_warning;
27 std::shared_ptr<sdbusplus::asio::dbus_interface>
28 threshold_interface_critical;
29 boost::asio::posix::stream_descriptor input_dev;
30 boost::asio::deadline_timer wait_timer;
31 boost::asio::streambuf read_buf;
32 double value;
33 int err_count;
34 double max_value;
35 double min_value;
36 void setup_read(void);
37 void handle_response(const boost::system::error_code &err);
38 void check_thresholds(void);
39 void update_value(const double &new_value);
40 void assert_thresholds(thresholds::Level level,
41 thresholds::Direction direction, bool assert);
42 void set_initial_properties(
43 std::shared_ptr<sdbusplus::asio::connection> &conn);
44};