summaryrefslogtreecommitdiffstats
path: root/control/handlers.hpp
diff options
context:
space:
mode:
authorMatthew Barth <msbarth@us.ibm.com>2017-05-11 14:12:27 -0500
committerMatthew Barth <msbarth@us.ibm.com>2017-05-31 10:48:10 -0500
commit38a93a8aa2feea7f4e785db6b4ff6d9e81f6020d (patch)
tree93131bf528c712fd9c95c353a23db9ab365d59c1 /control/handlers.hpp
parent06bae85443fdb1e5e9540280a7aeac2f36ffaa7b (diff)
downloadphosphor-fan-presence-38a93a8aa2feea7f4e785db6b4ff6d9e81f6020d.tar.gz
phosphor-fan-presence-38a93a8aa2feea7f4e785db6b4ff6d9e81f6020d.zip
Add property changed signal handler
Enable the control application to handle property changed signals to set or update a cached set of these properties Change-Id: Ib84ffe1e801ee7dd85d17fdbb122d124d307dbd3 Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
Diffstat (limited to 'control/handlers.hpp')
-rw-r--r--control/handlers.hpp35
1 files changed, 35 insertions, 0 deletions
diff --git a/control/handlers.hpp b/control/handlers.hpp
new file mode 100644
index 0000000..0503c53
--- /dev/null
+++ b/control/handlers.hpp
@@ -0,0 +1,35 @@
+#pragma once
+
+namespace phosphor
+{
+namespace fan
+{
+namespace control
+{
+namespace handler
+{
+
+/**
+ * @brief A handler function to set/update a property
+ * @details Sets or updates a property's value determined by a combination of
+ * an object's path and property names
+ *
+ * @param[in] path - Object's path name
+ * @param[in] property - Object's property name
+ *
+ * @return Lambda function
+ * A lambda function to set/update the property value
+ */
+template <typename T>
+auto setProperty(const char* path, const char* property)
+{
+ return [=](auto& zone, T&& arg)
+ {
+ zone.setPropertyValue(path, property, std::forward<T>(arg));
+ };
+}
+
+} // namespace handler
+} // namespace control
+} // namespace fan
+} // namespace phosphor
OpenPOWER on IntegriCloud