Add assertValue in thresholdAsserted signal
When threshold property changes, send thresholdAsserted signal
that includes threshold properties and sensor value that caused
the property change. This enables the SEL logger to record the
correct sensor reading in the SEL messages.
Tested:
busctl set-property xyz.openbmc_project.ADCSensor
/xyz/openbmc_project/sensors/voltage/P1V8_PCH xyz.openbmc_project.Sensor.Value
Value d 1.97
thresholdAsserted signal is received with the below data:
assertSignal from P1V8_PCH interface xyz.openbmc_project.Sensor.Threshold.Critical
event CriticalAlarmHighassert 1 assertValue 1.97
assertSignal from P1V8_PCH interface xyz.openbmc_project.Sensor.Threshold.Warning
event WarningAlarmHighassert 1 assertValue 1.97
Signed-off-by: Zhikui Ren <zhikui.ren@intel.com>
Change-Id: I0de317dd716f71acdcd6f12e43dbd239232fea86
diff --git a/include/Thresholds.hpp b/include/Thresholds.hpp
index 183fa34..57d6f52 100644
--- a/include/Thresholds.hpp
+++ b/include/Thresholds.hpp
@@ -42,8 +42,9 @@
}
};
-void assertThresholds(Sensor* sensor, thresholds::Level level,
- thresholds::Direction direction, bool assert);
+void assertThresholds(Sensor* sensor, double assertValue,
+ thresholds::Level level, thresholds::Direction direction,
+ bool assert);
struct TimerUsed
{
@@ -78,7 +79,7 @@
}
}
- void startTimer(const Threshold& threshold)
+ void startTimer(const Threshold& threshold, double assertValue)
{
struct TimerUsed timerUsed = {};
constexpr const size_t waitTime = 5;
@@ -102,7 +103,7 @@
pair->first.direction = threshold.direction;
pair->second.expires_from_now(boost::posix_time::seconds(waitTime));
pair->second.async_wait(
- [this, pair, threshold](boost::system::error_code ec) {
+ [this, pair, threshold, assertValue](boost::system::error_code ec) {
pair->first.used = false;
if (ec == boost::asio::error::operation_aborted)
@@ -116,7 +117,7 @@
}
if (isPowerOn())
{
- assertThresholds(sensor, threshold.level,
+ assertThresholds(sensor, assertValue, threshold.level,
threshold.direction, true);
}
});