blob: e11c891bc2af552fe859cf263cc8de50a1f5de5b [file] [log] [blame]
#pragma once
#include <sdbusplus/bus.hpp>
#include <xyz/openbmc_project/Sensor/Threshold/Critical/server.hpp>
#include <xyz/openbmc_project/Sensor/Threshold/Warning/server.hpp>
#include <xyz/openbmc_project/Sensor/Value/server.hpp>
namespace phosphor
{
namespace nvme
{
using ValueIface = sdbusplus::xyz::openbmc_project::Sensor::server::Value;
using CriticalInterface =
sdbusplus::xyz::openbmc_project::Sensor::Threshold::server::Critical;
using WarningInterface =
sdbusplus::xyz::openbmc_project::Sensor::Threshold::server::Warning;
using NvmeIfaces = sdbusplus::server::object_t<ValueIface, CriticalInterface,
WarningInterface>;
class NvmeSSD : public NvmeIfaces
{
public:
NvmeSSD() = delete;
NvmeSSD(const NvmeSSD&) = delete;
NvmeSSD& operator=(const NvmeSSD&) = delete;
NvmeSSD(NvmeSSD&&) = delete;
NvmeSSD& operator=(NvmeSSD&&) = delete;
virtual ~NvmeSSD() = default;
/** @brief Constructs NvmeSSD
*
* @param[in] bus - Handle to system dbus
* @param[in] objPath - The Dbus path of nvme
*/
NvmeSSD(sdbusplus::bus_t& bus, const char* objPath) :
NvmeIfaces(bus, objPath), bus(bus)
{
ValueIface::unit(Unit::DegreesC);
}
/** @brief Set sensor value temperature to nvme D-bus */
void setSensorValueToDbus(const int8_t value);
/** @brief Check if sensor value higher or lower threshold */
void checkSensorThreshold();
/** @brief Set Sensor Threshold to D-bus at beginning */
void setSensorThreshold(int8_t criticalHigh, int8_t criticalLow,
int8_t warningHigh, int8_t warningLow);
/** @brief Set Sensor Max/Min value to D-bus at beginning */
void setSensorMaxMin(int8_t maxValue, int8_t minValue);
private:
sdbusplus::bus_t& bus;
};
} // namespace nvme
} // namespace phosphor