monitor: Add thermal fault alert D-Bus property
Add a new property to alert of a thermal fault. In this context, it
means an imminent power off due to fan faults. On certain IBM systems
it will be used as a mechanism to alert the host of the power off when
the 'epow_power_off' power off rule is used.
Service: xyz.openbmc_project.Thermal.Alert
Path: /xyz/openbmc_project/alerts/thermal_fault_alert
Interface: xyz.openbmc_project.Object.Enable
Property: Enabled
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Change-Id: I0531de9ce40b6148244fda18a20e144bad85d830
diff --git a/monitor/system.cpp b/monitor/system.cpp
index 229eca8..dbb9b73 100644
--- a/monitor/system.cpp
+++ b/monitor/system.cpp
@@ -24,6 +24,8 @@
#include "json_parser.hpp"
#endif
+#include "config.h"
+
#include <nlohmann/json.hpp>
#include <phosphor-logging/log.hpp>
#include <sdbusplus/bus.hpp>
@@ -41,11 +43,12 @@
System::System(Mode mode, sdbusplus::bus::bus& bus,
const sdeventplus::Event& event) :
_mode(mode),
- _bus(bus), _event(event)
-{
- _powerState = std::make_unique<PGoodState>(
+ _bus(bus), _event(event),
+ _powerState(std::make_unique<PGoodState>(
bus, std::bind(std::mem_fn(&System::powerStateChanged), this,
- std::placeholders::_1));
+ std::placeholders::_1))),
+ _thermalAlert(bus, THERMAL_ALERT_OBJPATH)
+{
json jsonObj = json::object();
#ifdef MONITOR_USE_JSON
@@ -212,6 +215,8 @@
}
else
{
+ _thermalAlert.enabled(false);
+
// Cancel any in-progress power off actions
std::for_each(_powerOffRules.begin(), _powerOffRules.end(),
[this](auto& rule) { rule->cancel(); });