Matthew Barth | 38a93a8 | 2017-05-11 14:12:27 -0500 | [diff] [blame] | 1 | #pragma once |
| 2 | |
| 3 | namespace phosphor |
| 4 | { |
| 5 | namespace fan |
| 6 | { |
| 7 | namespace control |
| 8 | { |
| 9 | namespace handler |
| 10 | { |
| 11 | |
| 12 | /** |
| 13 | * @brief A handler function to set/update a property |
| 14 | * @details Sets or updates a property's value determined by a combination of |
| 15 | * an object's path and property names |
| 16 | * |
| 17 | * @param[in] path - Object's path name |
Matthew Barth | cec5ab7 | 2017-06-02 15:20:56 -0500 | [diff] [blame] | 18 | * @param[in] interface - Object's interface name |
Matthew Barth | 38a93a8 | 2017-05-11 14:12:27 -0500 | [diff] [blame] | 19 | * @param[in] property - Object's property name |
| 20 | * |
| 21 | * @return Lambda function |
| 22 | * A lambda function to set/update the property value |
| 23 | */ |
| 24 | template <typename T> |
Matthew Barth | cec5ab7 | 2017-06-02 15:20:56 -0500 | [diff] [blame] | 25 | auto setProperty(const char* path, const char* interface, const char* property) |
Matthew Barth | 38a93a8 | 2017-05-11 14:12:27 -0500 | [diff] [blame] | 26 | { |
| 27 | return [=](auto& zone, T&& arg) |
| 28 | { |
Matthew Barth | cec5ab7 | 2017-06-02 15:20:56 -0500 | [diff] [blame] | 29 | zone.setPropertyValue(path, interface, property, std::forward<T>(arg)); |
Matthew Barth | 38a93a8 | 2017-05-11 14:12:27 -0500 | [diff] [blame] | 30 | }; |
| 31 | } |
| 32 | |
Matthew Barth | 8fa02da | 2017-09-28 12:18:20 -0500 | [diff] [blame^] | 33 | /** |
| 34 | * @brief A handler function to set/update service name owner state |
| 35 | * @details Sets or updates service name owner state used by a group where |
| 36 | * a service name without an owner represents the service no longer exists |
| 37 | * |
| 38 | * @param[in] group - Group associated with a service |
| 39 | * |
| 40 | * @return Lambda function |
| 41 | * A lambda function to set/update the service name owner state |
| 42 | */ |
| 43 | auto setService(Group&& group) |
| 44 | { |
| 45 | return [group = std::move(group)](auto& zone, auto& name, bool hasOwner) |
| 46 | { |
| 47 | // TODO Update service name owner state list of a group |
| 48 | }; |
| 49 | } |
| 50 | |
Matthew Barth | 38a93a8 | 2017-05-11 14:12:27 -0500 | [diff] [blame] | 51 | } // namespace handler |
| 52 | } // namespace control |
| 53 | } // namespace fan |
| 54 | } // namespace phosphor |