Add storeGroups/restoreGroups method to LED Manager
Use CEREAL to storeGroup/restoreGroups the current state of
asserted groups.
Call storeGroups() when the request comes to add to(remove from)
asserted group.
Call restoreGroups() as part of starting LED Manager daemon.
Tested: Manually set the Asserted property of each group to true,
after rebooting, all property values tested with the busctl command
are still true.
Signed-off-by: George Liu <liuxiwei@inspur.com>
Change-Id: Ibeb1de5f51e3d67e98eeea34764e9efc6d6d8b35
diff --git a/led-main.cpp b/led-main.cpp
index 53e3a71..0b060dc 100644
--- a/led-main.cpp
+++ b/led-main.cpp
@@ -8,6 +8,7 @@
#endif
#include "ledlayout.hpp"
#include "manager.hpp"
+#include "serialize.hpp"
#include <iostream>
@@ -29,11 +30,14 @@
/** @brief vector of led groups */
std::vector<std::unique_ptr<phosphor::led::Group>> groups;
+ /** @brief store and re-store Group */
+ phosphor::led::Serialize serialize(SAVED_GROUPS_FILE);
+
/** Now create so many dbus objects as there are groups */
for (auto& grp : systemLedMap)
{
- groups.emplace_back(
- std::make_unique<phosphor::led::Group>(bus, grp.first, manager));
+ groups.emplace_back(std::make_unique<phosphor::led::Group>(
+ bus, grp.first, manager, serialize));
}
/** @brief Claim the bus */