Yuan Li | 445efe3 | 2019-06-14 22:58:32 +0800 | [diff] [blame] | 1 | #pragma once |
| 2 | #include "sensor.hpp" |
| 3 | |
| 4 | #include <boost/asio/deadline_timer.hpp> |
| 5 | #include <boost/container/flat_map.hpp> |
| 6 | #include <chrono> |
| 7 | #include <limits> |
Patrick Venture | fd6ba73 | 2019-10-31 14:27:39 -0700 | [diff] [blame] | 8 | #include <memory> |
| 9 | #include <string> |
Yuan Li | 445efe3 | 2019-06-14 22:58:32 +0800 | [diff] [blame] | 10 | #include <vector> |
| 11 | |
| 12 | struct MCUTempSensor : public Sensor |
| 13 | { |
| 14 | MCUTempSensor(std::shared_ptr<sdbusplus::asio::connection>& conn, |
| 15 | boost::asio::io_service& io, const std::string& name, |
| 16 | const std::string& sensorConfiguration, |
| 17 | sdbusplus::asio::object_server& objectServer, |
| 18 | std::vector<thresholds::Threshold>&& thresholds, |
| 19 | uint8_t busId, uint8_t mcuAddress, uint8_t tempReg); |
| 20 | ~MCUTempSensor(); |
| 21 | |
| 22 | void checkThresholds(void) override; |
| 23 | void read(void); |
| 24 | void init(void); |
| 25 | |
| 26 | uint8_t busId; |
| 27 | uint8_t mcuAddress; |
| 28 | uint8_t tempReg; |
| 29 | |
| 30 | private: |
| 31 | int getMCURegsInfoWord(uint8_t regs, int16_t* pu16data); |
| 32 | sdbusplus::asio::object_server& objectServer; |
| 33 | std::shared_ptr<sdbusplus::asio::connection> dbusConnection; |
| 34 | boost::asio::deadline_timer waitTimer; |
| 35 | }; |