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> |
| 5 | |
| 6 | class TachSensor |
| 7 | { |
| 8 | public: |
| 9 | std::string name; |
| 10 | std::string configuration; |
| 11 | TachSensor(const std::string &path, |
| 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 | ~TachSensor(); |
| 18 | |
| 19 | private: |
| 20 | std::string path; |
| 21 | sdbusplus::asio::object_server &objServer; |
| 22 | std::shared_ptr<sdbusplus::asio::connection> dbusConnection; |
| 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 | }; |