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_sensor.hpp b/tach_sensor.hpp
index 0ef2b0a..24ee453 100644
--- a/tach_sensor.hpp
+++ b/tach_sensor.hpp
@@ -1,5 +1,6 @@
#pragma once
+#include <sdbusplus/bus.hpp>
#include "sensor_base.hpp"
@@ -20,9 +21,19 @@
TachSensor& operator=(TachSensor&&) = delete;
~TachSensor() = default;
+ TachSensor(sdbusplus::bus::bus& bus,
+ const std::string& id,
+ FanEnclosure& fanEnc) : Sensor(id, fanEnc),
+ bus(bus)
+ {
+ // Nothing to do here
+ }
+
bool isPresent();
private:
+ sdbusplus::bus::bus& bus;
+ int64_t tach = 0;
};