xref: /openbmc/dbus-sensors/src/NVMeSensor.hpp (revision 201a1015)
1 #pragma once
2 
3 #include <boost/asio/io_context.hpp>
4 #include <sensor.hpp>
5 
6 class NVMeSensor : public Sensor
7 {
8   public:
9     static constexpr const char* sensorType = "NVME1000";
10 
11     NVMeSensor(sdbusplus::asio::object_server& objectServer,
12                boost::asio::io_context& io,
13                std::shared_ptr<sdbusplus::asio::connection>& conn,
14                const std::string& sensorName,
15                std::vector<thresholds::Threshold>&& thresholds,
16                const std::string& sensorConfiguration, int busNumber,
17                uint8_t slaveAddr);
18     ~NVMeSensor() override;
19 
20     NVMeSensor& operator=(const NVMeSensor& other) = delete;
21 
22     bool sample();
23 
24     const int bus;
25     const uint8_t address;
26 
27   private:
28     const unsigned int scanDelayTicks = 5 * 60;
29     sdbusplus::asio::object_server& objServer;
30     unsigned int scanDelay{0};
31 
32     void checkThresholds() override;
33 };
34