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> |
| 8 | #include <vector> |
| 9 | |
| 10 | struct MCUTempSensor : public Sensor |
| 11 | { |
| 12 | MCUTempSensor(std::shared_ptr<sdbusplus::asio::connection>& conn, |
| 13 | boost::asio::io_service& io, const std::string& name, |
| 14 | const std::string& sensorConfiguration, |
| 15 | sdbusplus::asio::object_server& objectServer, |
| 16 | std::vector<thresholds::Threshold>&& thresholds, |
| 17 | uint8_t busId, uint8_t mcuAddress, uint8_t tempReg); |
| 18 | ~MCUTempSensor(); |
| 19 | |
| 20 | void checkThresholds(void) override; |
| 21 | void read(void); |
| 22 | void init(void); |
| 23 | |
| 24 | uint8_t busId; |
| 25 | uint8_t mcuAddress; |
| 26 | uint8_t tempReg; |
| 27 | |
| 28 | private: |
| 29 | int getMCURegsInfoWord(uint8_t regs, int16_t* pu16data); |
| 30 | sdbusplus::asio::object_server& objectServer; |
| 31 | std::shared_ptr<sdbusplus::asio::connection> dbusConnection; |
| 32 | boost::asio::deadline_timer waitTimer; |
| 33 | }; |