diff options
Diffstat (limited to 'control/handlers.hpp')
-rw-r--r-- | control/handlers.hpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/control/handlers.hpp b/control/handlers.hpp index 6661e1a..215662a 100644 --- a/control/handlers.hpp +++ b/control/handlers.hpp @@ -10,6 +10,26 @@ namespace handler { /** + * @brief A handler function to set/update a property on a zone + * @details Sets or updates a zone property to the given value using the + * provided zone dbus object's set property function + * + * @param[in] value - Value to set property to + * @param[in] func - Zone set property function pointer + * + * @return Lambda function + * A lambda function to set/update the zone property + */ +template <typename T> +auto setZoneProperty(T (Zone::*func)(T), T&& value) +{ + return [func, value = std::forward<T>(value)](auto& zone) + { + (zone.*func)(value); + }; +} + +/** * @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 |