Nikhil Potade | b669b6b | 2019-03-13 10:52:21 -0700 | [diff] [blame] | 1 | #pragma once |
| 2 | |
Zhikui Ren | f57836b | 2020-09-25 15:33:55 -0700 | [diff] [blame] | 3 | #include <boost/asio/io_service.hpp> |
Nikhil Potade | b669b6b | 2019-03-13 10:52:21 -0700 | [diff] [blame] | 4 | #include <sensor.hpp> |
| 5 | |
| 6 | class NVMeSensor : public Sensor |
| 7 | { |
| 8 | public: |
Ed Tanous | 74cffa8 | 2022-01-25 13:00:28 -0800 | [diff] [blame] | 9 | static constexpr const char* configType = |
Andrew Jeffery | 0c23fc3 | 2021-12-08 16:48:30 +1030 | [diff] [blame] | 10 | "xyz.openbmc_project.Configuration.NVME1000"; |
| 11 | |
Nikhil Potade | b669b6b | 2019-03-13 10:52:21 -0700 | [diff] [blame] | 12 | 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 Tanous | 8a57ec0 | 2020-10-09 12:46:52 -0700 | [diff] [blame] | 16 | std::vector<thresholds::Threshold>&& thresholds, |
Nikhil Potade | b669b6b | 2019-03-13 10:52:21 -0700 | [diff] [blame] | 17 | const std::string& sensorConfiguration, const int busNumber); |
Ed Tanous | 74cffa8 | 2022-01-25 13:00:28 -0800 | [diff] [blame] | 18 | ~NVMeSensor() override; |
Nikhil Potade | b669b6b | 2019-03-13 10:52:21 -0700 | [diff] [blame] | 19 | |
| 20 | NVMeSensor& operator=(const NVMeSensor& other) = delete; |
| 21 | |
Andrew Jeffery | 14108bb | 2022-03-21 15:00:16 +1030 | [diff] [blame] | 22 | bool sample(); |
| 23 | |
Nikhil Potade | b669b6b | 2019-03-13 10:52:21 -0700 | [diff] [blame] | 24 | int bus; |
| 25 | |
| 26 | private: |
Andrew Jeffery | 14108bb | 2022-03-21 15:00:16 +1030 | [diff] [blame] | 27 | const unsigned int scanDelayTicks = 5 * 60; |
Nikhil Potade | b669b6b | 2019-03-13 10:52:21 -0700 | [diff] [blame] | 28 | sdbusplus::asio::object_server& objServer; |
Ed Tanous | b429f31 | 2022-06-27 16:09:53 -0700 | [diff] [blame^] | 29 | unsigned int scanDelay{0}; |
Nikhil Potade | b669b6b | 2019-03-13 10:52:21 -0700 | [diff] [blame] | 30 | |
| 31 | void checkThresholds(void) override; |
| 32 | }; |