control: Setup to subscribe and handle signals

Create the signal object, actions, and handler framework to store
subscribed to signals and the callback to handle the signal.

Change-Id: I2ae94c2216c2a99fa2d5aa2028ef09b473c3c76a
Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
diff --git a/control/json/manager.cpp b/control/json/manager.cpp
index 973d1c9..3582bf5 100644
--- a/control/json/manager.cpp
+++ b/control/json/manager.cpp
@@ -324,6 +324,24 @@
     }
 }
 
+void Manager::handleSignal(sdbusplus::message::message& msg,
+                           const std::vector<SignalPkg>* pkgs)
+{
+    for (auto& pkg : *pkgs)
+    {
+        // Handle the signal callback and only run the actions if the handler
+        // updated the cache for the given SignalObject
+        if (std::get<SignalHandler>(pkg)(msg, std::get<SignalObject>(pkg),
+                                         *this))
+        {
+            // Perform the actions in the handler package
+            auto& actions = std::get<SignalActions>(pkg);
+            std::for_each(actions.begin(), actions.end(),
+                          [](auto& action) { action.get()->run(); });
+        }
+    }
+}
+
 unsigned int Manager::getPowerOnDelay()
 {
     auto powerOnDelay = 0;