blob: 5dd3c03a576b75c585f078ca617baf4959a6e036 [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>
6#include <chrono>
7#include <limits>
8#include <vector>
9
10struct 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};