diff options
author | Matt Spinler <spinler@us.ibm.com> | 2017-04-27 14:29:24 -0500 |
---|---|---|
committer | Matt Spinler <spinler@us.ibm.com> | 2017-05-11 13:52:50 -0500 |
commit | a9406a774a35c02fabc94ab842788dd9891f59e8 (patch) | |
tree | ea5e5cfd98ba88f293ba31137e697903237d92d5 /monitor/tach_sensor.hpp | |
parent | ebaae6115ff5248d7f46d065ca96229c1f4e583d (diff) | |
download | phosphor-fan-presence-a9406a774a35c02fabc94ab842788dd9891f59e8.tar.gz phosphor-fan-presence-a9406a774a35c02fabc94ab842788dd9891f59e8.zip |
Add Timer support to TachSensor
Add a Timer object to the TachSensor class
Change-Id: I419b5712de9e8e94f2a08de84d13170e44c33c7a
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Diffstat (limited to 'monitor/tach_sensor.hpp')
-rw-r--r-- | monitor/tach_sensor.hpp | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/monitor/tach_sensor.hpp b/monitor/tach_sensor.hpp index 003763c..7a65b64 100644 --- a/monitor/tach_sensor.hpp +++ b/monitor/tach_sensor.hpp @@ -3,6 +3,7 @@ #include <chrono> #include <sdbusplus/bus.hpp> #include <sdbusplus/server.hpp> +#include "timer.hpp" namespace phosphor { @@ -46,12 +47,14 @@ class TachSensor * @param[in] hasTarget - if the sensor supports * setting the speed * @param[in] timeout - Normal timeout value to use + * @param[in] events - sd_event pointer */ TachSensor(sdbusplus::bus::bus& bus, Fan& fan, const std::string& id, bool hasTarget, - size_t timeout); + size_t timeout, + std::shared_ptr<sd_event>& events); /** * @brief Returns the target speed value @@ -94,6 +97,19 @@ class TachSensor _functional = functional; } + /** + * Returns the timer object for this sensor + */ + inline phosphor::fan::util::Timer& getTimer() + { + return _timer; + } + + /** + * @brief Returns the timeout value to use for the sensor + */ + std::chrono::microseconds getTimeout(); + private: /** @@ -197,6 +213,11 @@ class TachSensor const size_t _timeout; /** + * The timer object + */ + phosphor::fan::util::Timer _timer; + + /** * @brief The match object for the Value properties changed signal */ std::unique_ptr<sdbusplus::server::match::match> tachSignal; |