James Feist | 139cb57 | 2018-09-10 15:26:18 -0700 | [diff] [blame] | 1 | #pragma once |
| 2 | |
| 3 | #include <Thresholds.hpp> |
| 4 | #include <sdbusplus/asio/object_server.hpp> |
James Feist | af79dd3 | 2018-09-12 12:54:15 -0700 | [diff] [blame^] | 5 | #include <sensor.hpp> |
James Feist | 139cb57 | 2018-09-10 15:26:18 -0700 | [diff] [blame] | 6 | |
James Feist | af79dd3 | 2018-09-12 12:54:15 -0700 | [diff] [blame^] | 7 | class HwmonTempSensor : public Sensor |
James Feist | 139cb57 | 2018-09-10 15:26:18 -0700 | [diff] [blame] | 8 | { |
| 9 | public: |
| 10 | std::string name; |
| 11 | std::string configuration; |
| 12 | HwmonTempSensor(const std::string &path, const std::string &objectType, |
| 13 | sdbusplus::asio::object_server &objectServer, |
| 14 | std::shared_ptr<sdbusplus::asio::connection> &conn, |
| 15 | boost::asio::io_service &io, const std::string &fan_name, |
| 16 | std::vector<thresholds::Threshold> &&thresholds, |
| 17 | const std::string &sensorConfiguration); |
| 18 | ~HwmonTempSensor(); |
| 19 | |
| 20 | private: |
| 21 | std::string path; |
| 22 | std::string objectType; |
| 23 | sdbusplus::asio::object_server &objServer; |
James Feist | 139cb57 | 2018-09-10 15:26:18 -0700 | [diff] [blame] | 24 | boost::asio::posix::stream_descriptor input_dev; |
| 25 | boost::asio::deadline_timer wait_timer; |
| 26 | boost::asio::streambuf read_buf; |
James Feist | 139cb57 | 2018-09-10 15:26:18 -0700 | [diff] [blame] | 27 | int err_count; |
| 28 | double max_value; |
| 29 | double min_value; |
| 30 | void setup_read(void); |
| 31 | void handle_response(const boost::system::error_code &err); |
| 32 | void check_thresholds(void); |
| 33 | void update_value(const double &new_value); |
James Feist | af79dd3 | 2018-09-12 12:54:15 -0700 | [diff] [blame^] | 34 | |
James Feist | 139cb57 | 2018-09-10 15:26:18 -0700 | [diff] [blame] | 35 | void set_initial_properties( |
| 36 | std::shared_ptr<sdbusplus::asio::connection> &conn); |
| 37 | }; |