Add tach sensors to each fan enclosure
Create a tach sensor instance for each sensor listed within a fan
enclosure that uses 'tach' based presence detection. Each tach sensor
has a pointer to the fan it's associated with and is added to the list
of sensors for that fan enclosure.
Change-Id: I9a83ec52d1a5d01e39702e185336a09edeb4d158
Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
diff --git a/tach_detect.cpp b/tach_detect.cpp
index e3d2389..5da1b48 100644
--- a/tach_detect.cpp
+++ b/tach_detect.cpp
@@ -2,6 +2,7 @@
#include <sdbusplus/bus.hpp>
#include "fan_enclosure.hpp"
#include "fan_detect_defs.hpp"
+#include "tach_sensor.hpp"
int main(void)
@@ -19,7 +20,14 @@
auto fan = std::make_unique<
phosphor::fan::presence::FanEnclosure>(bus,
fanProp);
- // TODO Add sensors to fan object
+ for (auto const &fanSensor: std::get<2>(fanProp))
+ {
+ auto sensor = std::make_unique<
+ phosphor::fan::presence::TachSensor>(bus,
+ fanSensor,
+ *fan);
+ fan->addSensor(std::move(sensor));
+ }
fans.push_back(std::move(fan));
}
}