summaryrefslogtreecommitdiffstats
path: root/monitor/tach_sensor.hpp
diff options
context:
space:
mode:
authorMatt Spinler <spinler@us.ibm.com>2017-04-27 14:21:48 -0500
committerMatt Spinler <spinler@us.ibm.com>2017-05-11 13:52:50 -0500
commitebaae6115ff5248d7f46d065ca96229c1f4e583d (patch)
tree2c8771ab9f47db9c3a07aceb5cb2bba533346ba8 /monitor/tach_sensor.hpp
parentabf8da369cb1e7094cc00295131502c73ed5cbc1 (diff)
downloadphosphor-fan-presence-ebaae6115ff5248d7f46d065ca96229c1f4e583d.tar.gz
phosphor-fan-presence-ebaae6115ff5248d7f46d065ca96229c1f4e583d.zip
Add dbus support to TachSensor
TachSensor will match on properties changed signals for the Value and Target properties. When these occur, it will load in those properties and then tell the Fan class there was a change. Also, TachSensor will read in the Target property during construction so it will have a valid value to check against right away. Change-Id: I2dc2cacf5804826c6b0e0ea91196cbdaa4d5b893 Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Diffstat (limited to 'monitor/tach_sensor.hpp')
-rw-r--r--monitor/tach_sensor.hpp66
1 files changed, 66 insertions, 0 deletions
diff --git a/monitor/tach_sensor.hpp b/monitor/tach_sensor.hpp
index df340f5..003763c 100644
--- a/monitor/tach_sensor.hpp
+++ b/monitor/tach_sensor.hpp
@@ -97,6 +97,62 @@ class TachSensor
private:
/**
+ * @brief Returns the service name for reading the sensor
+ */
+ std::string getService();
+
+ /**
+ * @brief Returns the match string to use for matching
+ * on a properties changed signal.
+ */
+ std::string getMatchString(const std::string& interface);
+
+ /**
+ * @brief Callback function for a tach input properties
+ * changed signal
+ *
+ * @param[in] msg - the dbus message
+ * @param[in] data - user data
+ * @param[in] err - dbus error
+ */
+ static int handleTachChangeSignal(sd_bus_message* msg,
+ void* data,
+ sd_bus_error* err);
+
+ /**
+ * @brief Callback function for a Target properties
+ * changed signal
+ *
+ * @param[in] msg - the dbus message
+ * @param[in] data - user data
+ * @param[in] err - dbus error
+ */
+ static int handleTargetChangeSignal(sd_bus_message* msg,
+ void* data,
+ sd_bus_error* err);
+
+ /**
+ * @brief Reads the Target property and stores in _tachTarget.
+ * Also calls Fan::tachChanged().
+ *
+ * @param[in] msg - the dbus message
+ * @param[in] err - dbus error
+ */
+ void handleTargetChange(sdbusplus::message::message& msg,
+ sd_bus_error* err);
+
+ /**
+ * @brief Reads the Value property and stores in _tachInput.
+ * Also calls Fan::tachChanged().
+ *
+ * @param[in] msg - the dbus message
+ * @param[in] err - dbus error
+ */
+ void handleTachChange(sdbusplus::message::message& msg,
+ sd_bus_error* err);
+
+
+ /**
* @brief the dbus object
*/
sdbusplus::bus::bus& _bus;
@@ -139,6 +195,16 @@ class TachSensor
* @brief The timeout value to use
*/
const size_t _timeout;
+
+ /**
+ * @brief The match object for the Value properties changed signal
+ */
+ std::unique_ptr<sdbusplus::server::match::match> tachSignal;
+
+ /**
+ * @brief The match object for the Target properties changed signal
+ */
+ std::unique_ptr<sdbusplus::server::match::match> targetSignal;
};
}
OpenPOWER on IntegriCloud