blob: 677cab8ecf04a676214722ed4f116dd364e659cb [file] [log] [blame]
James Feist6714a252018-09-10 15:26:18 -07001#pragma once
2
Patrick Ventureca44b2f2019-10-31 11:02:26 -07003#include "Thresholds.hpp"
4#include "sensor.hpp"
5
James Feist6714a252018-09-10 15:26:18 -07006#include <sdbusplus/asio/object_server.hpp>
Patrick Venturefd6ba732019-10-31 14:27:39 -07007#include <string>
8#include <vector>
James Feist6714a252018-09-10 15:26:18 -07009
James Feist251c7822018-09-12 12:54:15 -070010class HwmonTempSensor : public Sensor
James Feist6714a252018-09-10 15:26:18 -070011{
12 public:
James Feistd8705872019-02-08 13:26:09 -080013 HwmonTempSensor(const std::string& path, const std::string& objectType,
14 sdbusplus::asio::object_server& objectServer,
15 std::shared_ptr<sdbusplus::asio::connection>& conn,
16 boost::asio::io_service& io, const std::string& fanName,
17 std::vector<thresholds::Threshold>&& thresholds,
18 const std::string& sensorConfiguration);
James Feist6714a252018-09-10 15:26:18 -070019 ~HwmonTempSensor();
20
21 private:
James Feistd8705872019-02-08 13:26:09 -080022 sdbusplus::asio::object_server& objServer;
Jae Hyun Yoo9ced0a32018-10-25 10:42:39 -070023 boost::asio::posix::stream_descriptor inputDev;
24 boost::asio::deadline_timer waitTimer;
25 boost::asio::streambuf readBuf;
James Feist930fcde2019-05-28 12:58:43 -070026 std::string path;
Brad Bishopfbb44ad2019-11-08 09:42:37 -050027 size_t errCount;
Jae Hyun Yoo9ced0a32018-10-25 10:42:39 -070028 void setupRead(void);
James Feistd8705872019-02-08 13:26:09 -080029 void handleResponse(const boost::system::error_code& err);
James Feistce3fca42018-11-21 12:58:24 -080030 void checkThresholds(void) override;
Patrick Ventureca44b2f2019-10-31 11:02:26 -070031};