blob: 4e0000f7f6cec05fcc11cf11be865451f311248e [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:
Zev Weiss054aad82022-08-18 01:37:34 -07009 static constexpr const char* sensorType = "NVME1000";
Andrew Jeffery0c23fc32021-12-08 16:48:30 +103010
Nikhil Potadeb669b6b2019-03-13 10:52:21 -070011 NVMeSensor(sdbusplus::asio::object_server& objectServer,
12 boost::asio::io_service& io,
13 std::shared_ptr<sdbusplus::asio::connection>& conn,
14 const std::string& sensorName,
Ed Tanous8a57ec02020-10-09 12:46:52 -070015 std::vector<thresholds::Threshold>&& thresholds,
Ed Tanous2049bd22022-07-09 07:20:26 -070016 const std::string& sensorConfiguration, int busNumber);
Ed Tanous74cffa82022-01-25 13:00:28 -080017 ~NVMeSensor() override;
Nikhil Potadeb669b6b2019-03-13 10:52:21 -070018
19 NVMeSensor& operator=(const NVMeSensor& other) = delete;
20
Andrew Jeffery14108bb2022-03-21 15:00:16 +103021 bool sample();
22
Nikhil Potadeb669b6b2019-03-13 10:52:21 -070023 int bus;
24
25 private:
Andrew Jeffery14108bb2022-03-21 15:00:16 +103026 const unsigned int scanDelayTicks = 5 * 60;
Nikhil Potadeb669b6b2019-03-13 10:52:21 -070027 sdbusplus::asio::object_server& objServer;
Ed Tanousb429f312022-06-27 16:09:53 -070028 unsigned int scanDelay{0};
Nikhil Potadeb669b6b2019-03-13 10:52:21 -070029
30 void checkThresholds(void) override;
31};