control: Provide pointer to manager object to events

To setup triggers on events, a pointer to the manager where service and
property states are stored is needed.

Change-Id: Ic6e2ca81c83f4cfacf01b9cb09b08c9f50f35cb6
Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
diff --git a/control/json/event.cpp b/control/json/event.cpp
index 3db50aa..31db75f 100644
--- a/control/json/event.cpp
+++ b/control/json/event.cpp
@@ -35,11 +35,11 @@
 using json = nlohmann::json;
 using namespace phosphor::logging;
 
-Event::Event(const json& jsonObj, sdbusplus::bus::bus& bus,
+Event::Event(const json& jsonObj, sdbusplus::bus::bus& bus, Manager* mgr,
              std::map<configKey, std::unique_ptr<Group>>& groups,
              std::map<configKey, std::unique_ptr<Zone>>& zones) :
     ConfigBase(jsonObj),
-    _bus(bus), _zones(zones)
+    _bus(bus), _manager(mgr), _zones(zones)
 {
     // Event could have a precondition
     if (!jsonObj.contains("precondition"))
diff --git a/control/json/event.hpp b/control/json/event.hpp
index 4b18e98..9b108fe 100644
--- a/control/json/event.hpp
+++ b/control/json/event.hpp
@@ -75,10 +75,11 @@
      *
      * @param[in] jsonObj - JSON object
      * @param[in] bus - sdbusplus bus object
+     * @param[in] mgr - Manager of this event
      * @param[in] groups - Available groups that can be used
      * @param[in] zones - Reference to the configured zones
      */
-    Event(const json& jsonObj, sdbusplus::bus::bus& bus,
+    Event(const json& jsonObj, sdbusplus::bus::bus& bus, Manager* mgr,
           std::map<configKey, std::unique_ptr<Group>>& groups,
           std::map<configKey, std::unique_ptr<Zone>>& zones);
 
@@ -116,6 +117,9 @@
     /* The sdbusplus bus object */
     sdbusplus::bus::bus& _bus;
 
+    /* The event's manager */
+    Manager* _manager;
+
     /* A precondition the event has in order to be enabled */
     Precondition _precond;
 
diff --git a/control/json/manager.cpp b/control/json/manager.cpp
index ec15d18..a81940a 100644
--- a/control/json/manager.cpp
+++ b/control/json/manager.cpp
@@ -96,7 +96,7 @@
     auto groups = getConfig<Group>(true, bus);
 
     // Load any events configured
-    _events = getConfig<Event>(true, bus, bus, groups, _zones);
+    _events = getConfig<Event>(true, bus, bus, this, groups, _zones);
 
     bus.request_name(CONTROL_BUSNAME);
 }