1 #include "config.h" 2 3 #include "group.hpp" 4 5 #include "ledlayout.hpp" 6 7 #include <sdbusplus/message.hpp> 8 namespace phosphor 9 { 10 namespace led 11 { 12 13 /** @brief Overloaded Property Setter function */ 14 bool Group::asserted(bool value) 15 { 16 // If the value is already what is before, return right away 17 if (value == 18 sdbusplus::xyz::openbmc_project::Led::server::Group::asserted()) 19 { 20 return value; 21 } 22 23 if (customCallBack != nullptr) 24 { 25 // Call the custom callback method 26 customCallBack(this, value); 27 28 return sdbusplus::xyz::openbmc_project::Led::server::Group::asserted( 29 value); 30 } 31 32 // Introducing these to enable gtest. 33 ActionSet ledsAssert{}; 34 ActionSet ledsDeAssert{}; 35 36 // Group management is handled by Manager. The populated leds* sets are not 37 // really used by production code. They are there to enable gtest for 38 // validation. 39 auto result = manager.setGroupState(path, value, ledsAssert, ledsDeAssert); 40 41 // Store asserted state 42 serialize.storeGroups(path, result); 43 44 // If something does not go right here, then there should be an sdbusplus 45 // exception thrown. 46 manager.driveLEDs(ledsAssert, ledsDeAssert); 47 48 // Set the base class's asserted to 'true' since the getter 49 // operation is handled there. 50 return sdbusplus::xyz::openbmc_project::Led::server::Group::asserted( 51 result); 52 } 53 54 } // namespace led 55 } // namespace phosphor 56