sensor-mon: Watch for InterfacesAdded
Start handling the InterfacesAdded signal for the threshold interfaces.
This is so that if a sensor has a threshold alarm set, but then restarts
and then doesn't have it set, sensor-monitor will get the update to the
new good value.
Previously, sensor-monitor would still log a threshold alarm on every
power on after a sensor daemon restarted and then showed no alarm.
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Change-Id: I691c8949165bc29ac2eab4190e5dc9a9283bd2e6
diff --git a/sensor-monitor/threshold_alarm_logger.hpp b/sensor-monitor/threshold_alarm_logger.hpp
index 8659ea7..f7b00c5 100644
--- a/sensor-monitor/threshold_alarm_logger.hpp
+++ b/sensor-monitor/threshold_alarm_logger.hpp
@@ -91,6 +91,28 @@
void interfacesRemoved(sdbusplus::message_t& msg);
/**
+ * @brief The interfacesAdded handler for the threshold
+ * interfaces.
+ *
+ * Checks the alarm when it shows up on D-Bus.
+ *
+ * @param[in] msg - The signal message payload.
+ */
+ void interfacesAdded(sdbusplus::message_t& msg);
+
+ /**
+ * @brief Checks for alarms in the D-Bus data passed in,
+ * and creates an event log if necessary.
+ *
+ * @param[in] sensorPath - D-Bus path of the sensor
+ * @param[in] interface - The threshold interface name
+ * @param[in] properties - The map of property values on the interface
+ */
+ void checkProperties(
+ const std::string& sensorPath, const std::string& interface,
+ const std::map<std::string, std::variant<bool>>& properties);
+
+ /**
* @brief Checks for active alarms on the path and threshold interface
* passed in and creates event logs if necessary.
*
@@ -202,6 +224,11 @@
sdbusplus::bus::match_t ifacesRemovedMatch;
/**
+ * @brief The InterfacesAdded match object
+ */
+ sdbusplus::bus::match_t ifacesAddedMatch;
+
+ /**
* @brief The current alarm values
*/
std::map<InterfaceKey, std::map<PropertyName, bool>> alarms;