Nikhil Potade | b669b6b | 2019-03-13 10:52:21 -0700 | [diff] [blame] | 1 | #pragma once |
| 2 | |
Ed Tanous | 1f97863 | 2023-02-28 18:16:39 -0800 | [diff] [blame] | 3 | #include <boost/asio/io_context.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: |
Zev Weiss | 054aad8 | 2022-08-18 01:37:34 -0700 | [diff] [blame] | 9 | static constexpr const char* sensorType = "NVME1000"; |
Andrew Jeffery | 0c23fc3 | 2021-12-08 16:48:30 +1030 | [diff] [blame] | 10 | |
Nikhil Potade | b669b6b | 2019-03-13 10:52:21 -0700 | [diff] [blame] | 11 | NVMeSensor(sdbusplus::asio::object_server& objectServer, |
Ed Tanous | 1f97863 | 2023-02-28 18:16:39 -0800 | [diff] [blame] | 12 | boost::asio::io_context& io, |
Nikhil Potade | b669b6b | 2019-03-13 10:52:21 -0700 | [diff] [blame] | 13 | std::shared_ptr<sdbusplus::asio::connection>& conn, |
| 14 | const std::string& sensorName, |
Ed Tanous | 8a57ec0 | 2020-10-09 12:46:52 -0700 | [diff] [blame] | 15 | std::vector<thresholds::Threshold>&& thresholds, |
Nnamdi Ajah | 06cd988 | 2023-02-15 13:21:32 +0100 | [diff] [blame] | 16 | const std::string& sensorConfiguration, int busNumber, |
| 17 | uint8_t slaveAddr); |
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 | |
Nnamdi Ajah | c54f6c5 | 2023-05-02 11:02:16 +0200 | [diff] [blame] | 24 | const int bus; |
| 25 | const uint8_t address; |
Nikhil Potade | b669b6b | 2019-03-13 10:52:21 -0700 | [diff] [blame] | 26 | |
| 27 | private: |
Andrew Jeffery | 14108bb | 2022-03-21 15:00:16 +1030 | [diff] [blame] | 28 | const unsigned int scanDelayTicks = 5 * 60; |
Nikhil Potade | b669b6b | 2019-03-13 10:52:21 -0700 | [diff] [blame] | 29 | sdbusplus::asio::object_server& objServer; |
Ed Tanous | b429f31 | 2022-06-27 16:09:53 -0700 | [diff] [blame] | 30 | unsigned int scanDelay{0}; |
Nikhil Potade | b669b6b | 2019-03-13 10:52:21 -0700 | [diff] [blame] | 31 | |
Ed Tanous | 201a101 | 2024-04-03 18:07:28 -0700 | [diff] [blame] | 32 | void checkThresholds() override; |
Nikhil Potade | b669b6b | 2019-03-13 10:52:21 -0700 | [diff] [blame] | 33 | }; |