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>
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