George Liu | 2098aa6 | 2020-05-09 11:26:35 +0800 | [diff] [blame^] | 1 | #include "config.h" |
| 2 | |
Vishwanatha Subbanna | 4c8c72b | 2016-11-29 23:02:06 +0530 | [diff] [blame] | 3 | #include "group.hpp" |
Patrick Venture | 91ac8d3 | 2018-11-01 17:03:22 -0700 | [diff] [blame] | 4 | |
| 5 | #include <sdbusplus/message.hpp> |
Vishwanatha Subbanna | 4c8c72b | 2016-11-29 23:02:06 +0530 | [diff] [blame] | 6 | namespace phosphor |
| 7 | { |
| 8 | namespace led |
| 9 | { |
| 10 | |
| 11 | /** @brief Overloaded Property Setter function */ |
| 12 | bool Group::asserted(bool value) |
| 13 | { |
Vishwanatha Subbanna | ed49073 | 2016-12-20 15:59:29 +0530 | [diff] [blame] | 14 | // Introducing these to enable gtest. |
Patrick Venture | 91ac8d3 | 2018-11-01 17:03:22 -0700 | [diff] [blame] | 15 | Manager::group ledsAssert{}; |
| 16 | Manager::group ledsDeAssert{}; |
Vishwanatha Subbanna | ed49073 | 2016-12-20 15:59:29 +0530 | [diff] [blame] | 17 | |
| 18 | // Group management is handled by Manager. The populated leds* sets are not |
| 19 | // really used by production code. They are there to enable gtest for |
| 20 | // validation. |
Patrick Venture | 91ac8d3 | 2018-11-01 17:03:22 -0700 | [diff] [blame] | 21 | auto result = manager.setGroupState(path, value, ledsAssert, ledsDeAssert); |
Vishwanatha Subbanna | ed49073 | 2016-12-20 15:59:29 +0530 | [diff] [blame] | 22 | |
George Liu | 2098aa6 | 2020-05-09 11:26:35 +0800 | [diff] [blame^] | 23 | // Store asserted state |
| 24 | serialize.storeGroups(path, result); |
| 25 | |
Vishwanatha Subbanna | ed49073 | 2016-12-20 15:59:29 +0530 | [diff] [blame] | 26 | // If something does not go right here, then there should be an sdbusplus |
| 27 | // exception thrown. |
Vishwanatha Subbanna | 4b000d8 | 2017-05-03 18:44:16 +0530 | [diff] [blame] | 28 | manager.driveLEDs(ledsAssert, ledsDeAssert); |
Vishwanatha Subbanna | 4c8c72b | 2016-11-29 23:02:06 +0530 | [diff] [blame] | 29 | |
| 30 | // Set the base class's asserted to 'true' since the getter |
| 31 | // operation is handled there. |
Patrick Venture | 91ac8d3 | 2018-11-01 17:03:22 -0700 | [diff] [blame] | 32 | return sdbusplus::xyz::openbmc_project::Led::server::Group::asserted( |
| 33 | result); |
Vishwanatha Subbanna | 4c8c72b | 2016-11-29 23:02:06 +0530 | [diff] [blame] | 34 | } |
| 35 | |
| 36 | } // namespace led |
| 37 | } // namespace phosphor |