summaryrefslogtreecommitdiffstats
path: root/tach_detect.cpp
diff options
context:
space:
mode:
authorMatthew Barth <msbarth@us.ibm.com>2017-02-17 17:10:19 -0600
committerMatthew Barth <msbarth@us.ibm.com>2017-03-15 12:17:38 -0500
commitd64038262e4c8743ae774efde7a8e91544ed359b (patch)
treef72a9030e4fcf15bfe5641f1bedd255c3cce2c74 /tach_detect.cpp
parentb803445f7095c9b1e2ab40dc37526b15e7006393 (diff)
downloadphosphor-fan-presence-d64038262e4c8743ae774efde7a8e91544ed359b.tar.gz
phosphor-fan-presence-d64038262e4c8743ae774efde7a8e91544ed359b.zip
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>
Diffstat (limited to 'tach_detect.cpp')
-rw-r--r--tach_detect.cpp10
1 files changed, 9 insertions, 1 deletions
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 @@ int main(void)
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));
}
}
OpenPOWER on IntegriCloud