blob: fc2cef65e9142475c354e9d40fa765ca14a7f272 [file] [log] [blame]
George Liu2098aa62020-05-09 11:26:35 +08001#include "config.h"
2
Vishwanatha Subbanna4c8c72b2016-11-29 23:02:06 +05303#include "group.hpp"
Patrick Venture91ac8d32018-11-01 17:03:22 -07004
5#include <sdbusplus/message.hpp>
Vishwanatha Subbanna4c8c72b2016-11-29 23:02:06 +05306namespace phosphor
7{
8namespace led
9{
10
11/** @brief Overloaded Property Setter function */
12bool Group::asserted(bool value)
13{
Vishwanatha Subbannaed490732016-12-20 15:59:29 +053014 // Introducing these to enable gtest.
Patrick Venture91ac8d32018-11-01 17:03:22 -070015 Manager::group ledsAssert{};
16 Manager::group ledsDeAssert{};
Vishwanatha Subbannaed490732016-12-20 15:59:29 +053017
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 Venture91ac8d32018-11-01 17:03:22 -070021 auto result = manager.setGroupState(path, value, ledsAssert, ledsDeAssert);
Vishwanatha Subbannaed490732016-12-20 15:59:29 +053022
George Liu2098aa62020-05-09 11:26:35 +080023 // Store asserted state
24 serialize.storeGroups(path, result);
25
Vishwanatha Subbannaed490732016-12-20 15:59:29 +053026 // If something does not go right here, then there should be an sdbusplus
27 // exception thrown.
Vishwanatha Subbanna4b000d82017-05-03 18:44:16 +053028 manager.driveLEDs(ledsAssert, ledsDeAssert);
Vishwanatha Subbanna4c8c72b2016-11-29 23:02:06 +053029
30 // Set the base class's asserted to 'true' since the getter
31 // operation is handled there.
Patrick Venture91ac8d32018-11-01 17:03:22 -070032 return sdbusplus::xyz::openbmc_project::Led::server::Group::asserted(
33 result);
Vishwanatha Subbanna4c8c72b2016-11-29 23:02:06 +053034}
35
36} // namespace led
37} // namespace phosphor