blob: 2f3aef4a031858cb0cf07da6b29fbd9e3e02056c [file] [log] [blame]
Yuan Li445efe32019-06-14 22:58:32 +08001#pragma once
2#include "sensor.hpp"
3
4#include <boost/asio/deadline_timer.hpp>
5#include <boost/container/flat_map.hpp>
James Feist38fb5982020-05-28 10:09:54 -07006
Yuan Li445efe32019-06-14 22:58:32 +08007#include <chrono>
8#include <limits>
Patrick Venturefd6ba732019-10-31 14:27:39 -07009#include <memory>
10#include <string>
Yuan Li445efe32019-06-14 22:58:32 +080011#include <vector>
12
13struct MCUTempSensor : public Sensor
14{
15 MCUTempSensor(std::shared_ptr<sdbusplus::asio::connection>& conn,
16 boost::asio::io_service& io, const std::string& name,
17 const std::string& sensorConfiguration,
18 sdbusplus::asio::object_server& objectServer,
19 std::vector<thresholds::Threshold>&& thresholds,
20 uint8_t busId, uint8_t mcuAddress, uint8_t tempReg);
21 ~MCUTempSensor();
22
23 void checkThresholds(void) override;
24 void read(void);
25 void init(void);
26
27 uint8_t busId;
28 uint8_t mcuAddress;
29 uint8_t tempReg;
30
31 private:
32 int getMCURegsInfoWord(uint8_t regs, int16_t* pu16data);
33 sdbusplus::asio::object_server& objectServer;
Yuan Li445efe32019-06-14 22:58:32 +080034 boost::asio::deadline_timer waitTimer;
35};