| Tony Lee | 6c59501 | 2019-06-19 10:54:59 +0800 | [diff] [blame] | 1 | #pragma once | 
|  | 2 |  | 
| Tony Lee | 6c59501 | 2019-06-19 10:54:59 +0800 | [diff] [blame] | 3 | #include <sdbusplus/bus.hpp> | 
| Tony Lee | 6c59501 | 2019-06-19 10:54:59 +0800 | [diff] [blame] | 4 | #include <xyz/openbmc_project/Sensor/Threshold/Critical/server.hpp> | 
|  | 5 | #include <xyz/openbmc_project/Sensor/Threshold/Warning/server.hpp> | 
|  | 6 | #include <xyz/openbmc_project/Sensor/Value/server.hpp> | 
|  | 7 |  | 
|  | 8 | namespace phosphor | 
|  | 9 | { | 
|  | 10 | namespace nvme | 
|  | 11 | { | 
|  | 12 |  | 
|  | 13 | using ValueIface = sdbusplus::xyz::openbmc_project::Sensor::server::Value; | 
|  | 14 |  | 
|  | 15 | using CriticalInterface = | 
|  | 16 | sdbusplus::xyz::openbmc_project::Sensor::Threshold::server::Critical; | 
|  | 17 |  | 
|  | 18 | using WarningInterface = | 
|  | 19 | sdbusplus::xyz::openbmc_project::Sensor::Threshold::server::Warning; | 
|  | 20 |  | 
|  | 21 | using NvmeIfaces = | 
|  | 22 | sdbusplus::server::object::object<ValueIface, CriticalInterface, | 
|  | 23 | WarningInterface>; | 
|  | 24 |  | 
|  | 25 | class NvmeSSD : public NvmeIfaces | 
|  | 26 | { | 
|  | 27 | public: | 
|  | 28 | NvmeSSD() = delete; | 
|  | 29 | NvmeSSD(const NvmeSSD&) = delete; | 
|  | 30 | NvmeSSD& operator=(const NvmeSSD&) = delete; | 
|  | 31 | NvmeSSD(NvmeSSD&&) = delete; | 
|  | 32 | NvmeSSD& operator=(NvmeSSD&&) = delete; | 
|  | 33 | virtual ~NvmeSSD() = default; | 
|  | 34 |  | 
|  | 35 | /** @brief Constructs NvmeSSD | 
|  | 36 | * | 
|  | 37 | * @param[in] bus     - Handle to system dbus | 
|  | 38 | * @param[in] objPath - The Dbus path of nvme | 
|  | 39 | */ | 
|  | 40 | NvmeSSD(sdbusplus::bus::bus& bus, const char* objPath) : | 
|  | 41 | NvmeIfaces(bus, objPath), bus(bus) | 
|  | 42 | { | 
|  | 43 | } | 
|  | 44 |  | 
|  | 45 | /** @brief Set sensor value temperature to nvme D-bus  */ | 
|  | 46 | void setSensorValueToDbus(const int8_t value); | 
|  | 47 | /** @brief Check if sensor value higher or lower threshold */ | 
|  | 48 | void checkSensorThreshold(); | 
|  | 49 | /** @brief Set Sensor Threshold to D-bus at beginning */ | 
|  | 50 | void setSensorThreshold(int8_t criticalHigh, int8_t criticalLow, | 
| Tony Lee | 6c59501 | 2019-06-19 10:54:59 +0800 | [diff] [blame] | 51 | int8_t warningHigh, int8_t warningLow); | 
| George Hung | 831f204 | 2021-05-19 17:02:29 +0800 | [diff] [blame] | 52 | /** @brief Set Sensor Max/Min value to D-bus at beginning */ | 
|  | 53 | void setSensorMaxMin(int8_t maxValue, int8_t minValue); | 
| Tony Lee | 6c59501 | 2019-06-19 10:54:59 +0800 | [diff] [blame] | 54 |  | 
|  | 55 | private: | 
|  | 56 | sdbusplus::bus::bus& bus; | 
|  | 57 | }; | 
|  | 58 | } // namespace nvme | 
| Brandon Kim | d5838d1 | 2021-05-19 12:51:55 -0700 | [diff] [blame] | 59 | } // namespace phosphor |