#pragma once #include #include #include #include namespace phosphor::virtualSensor { template using ServerObject = typename sdbusplus::server::object::object; namespace threshold_ns = sdbusplus::xyz::openbmc_project::Sensor::Threshold::server; using CriticalObject = ServerObject; using WarningObject = ServerObject; using SoftShutdownObject = ServerObject; using HardShutdownObject = ServerObject; template struct Threshold; template <> struct Threshold : public WarningObject { static constexpr auto name = "Warning"; using WarningObject::WarningObject; auto high() { return warningHigh(); } auto low() { return warningLow(); } template auto alarmHigh(Args... args) { return warningAlarmHigh(std::forward(args)...); } template auto alarmLow(Args... args) { return warningAlarmLow(std::forward(args)...); } }; template <> struct Threshold : public CriticalObject { static constexpr auto name = "Critical"; using CriticalObject::CriticalObject; auto high() { return criticalHigh(); } auto low() { return criticalLow(); } template auto alarmHigh(Args... args) { return criticalAlarmHigh(std::forward(args)...); } template auto alarmLow(Args... args) { return criticalAlarmLow(std::forward(args)...); } }; template <> struct Threshold : public SoftShutdownObject { static constexpr auto name = "SoftShutdown"; using SoftShutdownObject::SoftShutdownObject; auto high() { return softShutdownHigh(); } auto low() { return softShutdownLow(); } template auto alarmHigh(Args... args) { return softShutdownAlarmHigh(std::forward(args)...); } template auto alarmLow(Args... args) { return softShutdownAlarmLow(std::forward(args)...); } }; template <> struct Threshold : public HardShutdownObject { static constexpr auto name = "HardShutdown"; using HardShutdownObject::HardShutdownObject; auto high() { return hardShutdownHigh(); } auto low() { return hardShutdownLow(); } template auto alarmHigh(Args... args) { return hardShutdownAlarmHigh(std::forward(args)...); } template auto alarmLow(Args... args) { return hardShutdownAlarmLow(std::forward(args)...); } }; } // namespace phosphor::virtualSensor