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