James Feist | 6714a25 | 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 | 251c782 | 2018-09-12 12:54:15 -0700 | [diff] [blame] | 5 | #include <sensor.hpp> |
James Feist | 6714a25 | 2018-09-10 15:26:18 -0700 | [diff] [blame] | 6 | |
James Feist | 251c782 | 2018-09-12 12:54:15 -0700 | [diff] [blame] | 7 | class ADCSensor : public Sensor |
James Feist | 6714a25 | 2018-09-10 15:26:18 -0700 | [diff] [blame] | 8 | { |
| 9 | public: |
James Feist | 6714a25 | 2018-09-10 15:26:18 -0700 | [diff] [blame] | 10 | ADCSensor(const std::string &path, |
| 11 | sdbusplus::asio::object_server &objectServer, |
| 12 | std::shared_ptr<sdbusplus::asio::connection> &conn, |
Jae Hyun Yoo | 9ced0a3 | 2018-10-25 10:42:39 -0700 | [diff] [blame] | 13 | boost::asio::io_service &io, const std::string &sensorName, |
James Feist | 6714a25 | 2018-09-10 15:26:18 -0700 | [diff] [blame] | 14 | std::vector<thresholds::Threshold> &&thresholds, |
Jae Hyun Yoo | 9ced0a3 | 2018-10-25 10:42:39 -0700 | [diff] [blame] | 15 | const double scaleFactor, const std::string &sensorConfiguration); |
James Feist | 6714a25 | 2018-09-10 15:26:18 -0700 | [diff] [blame] | 16 | ~ADCSensor(); |
| 17 | |
| 18 | private: |
James Feist | 6714a25 | 2018-09-10 15:26:18 -0700 | [diff] [blame] | 19 | sdbusplus::asio::object_server &objServer; |
Jae Hyun Yoo | 9ced0a3 | 2018-10-25 10:42:39 -0700 | [diff] [blame] | 20 | boost::asio::posix::stream_descriptor inputDev; |
| 21 | boost::asio::deadline_timer waitTimer; |
| 22 | boost::asio::streambuf readBuf; |
| 23 | int errCount; |
Jae Hyun Yoo | 9ced0a3 | 2018-10-25 10:42:39 -0700 | [diff] [blame] | 24 | double scaleFactor; |
| 25 | void setupRead(void); |
| 26 | void handleResponse(const boost::system::error_code &err); |
James Feist | ce3fca4 | 2018-11-21 12:58:24 -0800 | [diff] [blame^] | 27 | void checkThresholds(void) override; |
Jae Hyun Yoo | 9ced0a3 | 2018-10-25 10:42:39 -0700 | [diff] [blame] | 28 | }; |