blob: 5c708556574b394f23eae75f6f20cb81212f58fe [file] [log] [blame]
Nikhil Potadeb669b6b2019-03-13 10:52:21 -07001#pragma once
2
Zhikui Renf57836b2020-09-25 15:33:55 -07003#include <boost/asio/io_service.hpp>
Nikhil Potadeb669b6b2019-03-13 10:52:21 -07004#include <sensor.hpp>
5
6class NVMeSensor : public Sensor
7{
8 public:
Ed Tanous74cffa82022-01-25 13:00:28 -08009 static constexpr const char* configType =
Andrew Jeffery0c23fc32021-12-08 16:48:30 +103010 "xyz.openbmc_project.Configuration.NVME1000";
11
Nikhil Potadeb669b6b2019-03-13 10:52:21 -070012 NVMeSensor(sdbusplus::asio::object_server& objectServer,
13 boost::asio::io_service& io,
14 std::shared_ptr<sdbusplus::asio::connection>& conn,
15 const std::string& sensorName,
Ed Tanous8a57ec02020-10-09 12:46:52 -070016 std::vector<thresholds::Threshold>&& thresholds,
Nikhil Potadeb669b6b2019-03-13 10:52:21 -070017 const std::string& sensorConfiguration, const int busNumber);
Ed Tanous74cffa82022-01-25 13:00:28 -080018 ~NVMeSensor() override;
Nikhil Potadeb669b6b2019-03-13 10:52:21 -070019
20 NVMeSensor& operator=(const NVMeSensor& other) = delete;
21
Andrew Jeffery14108bb2022-03-21 15:00:16 +103022 bool sample();
23
Nikhil Potadeb669b6b2019-03-13 10:52:21 -070024 int bus;
25
26 private:
Andrew Jeffery14108bb2022-03-21 15:00:16 +103027 const unsigned int scanDelayTicks = 5 * 60;
Nikhil Potadeb669b6b2019-03-13 10:52:21 -070028 sdbusplus::asio::object_server& objServer;
Ed Tanousb429f312022-06-27 16:09:53 -070029 unsigned int scanDelay{0};
Nikhil Potadeb669b6b2019-03-13 10:52:21 -070030
31 void checkThresholds(void) override;
32};