blob: 61c027f213aafc9732728db16dfcbe0baa68420a [file] [log] [blame]
Tony Lee6c595012019-06-19 10:54:59 +08001#pragma once
2
Tony Lee6c595012019-06-19 10:54:59 +08003#include <sdbusplus/bus.hpp>
Tony Lee6c595012019-06-19 10:54:59 +08004#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
8namespace phosphor
9{
10namespace nvme
11{
12
13using ValueIface = sdbusplus::xyz::openbmc_project::Sensor::server::Value;
14
15using CriticalInterface =
16 sdbusplus::xyz::openbmc_project::Sensor::Threshold::server::Critical;
17
18using WarningInterface =
19 sdbusplus::xyz::openbmc_project::Sensor::Threshold::server::Warning;
20
21using NvmeIfaces =
22 sdbusplus::server::object::object<ValueIface, CriticalInterface,
23 WarningInterface>;
24
25class 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 Lee6c595012019-06-19 10:54:59 +080051 int8_t warningHigh, int8_t warningLow);
George Hung831f2042021-05-19 17:02:29 +080052 /** @brief Set Sensor Max/Min value to D-bus at beginning */
53 void setSensorMaxMin(int8_t maxValue, int8_t minValue);
Tony Lee6c595012019-06-19 10:54:59 +080054
55 private:
56 sdbusplus::bus::bus& bus;
57};
58} // namespace nvme
Brandon Kimd5838d12021-05-19 12:51:55 -070059} // namespace phosphor