regs: Add an event timer for monitoring

Create and enable a repeating 1 second timer when monitoring is enabled.
Delete the timer when monitoring is disabled.

Tested:
    Timer created when monitoring is enabled
    Each timer expiration calls bound callback function
    Timer stopped/deleted when monitoring is disabled

Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
Change-Id: I990124fb727bb0a0545ce06f9c878e81b572c7a5
diff --git a/phosphor-regulators/src/manager.hpp b/phosphor-regulators/src/manager.hpp
index 1c680ce..2b38821 100644
--- a/phosphor-regulators/src/manager.hpp
+++ b/phosphor-regulators/src/manager.hpp
@@ -3,6 +3,8 @@
 #include <interfaces/manager_interface.hpp>
 #include <sdbusplus/bus.hpp>
 #include <sdbusplus/server/object.hpp>
+#include <sdeventplus/event.hpp>
+#include <sdeventplus/utility/timer.hpp>
 
 namespace phosphor::power::regulators
 {
@@ -10,6 +12,8 @@
 constexpr auto busName = "xyz.openbmc_project.Power.Regulators";
 constexpr auto objPath = "/xyz/openbmc_project/power/regulators/manager";
 
+using Timer = sdeventplus::utility::Timer<sdeventplus::ClockId::Monotonic>;
+
 using ManagerObject = sdbusplus::server::object::object<
     phosphor::power::regulators::interface::ManagerInterface>;
 
@@ -28,8 +32,9 @@
      * Creates a manager over the regulators.
      *
      * @param[in] bus - the dbus bus
+     * @param[in] event - the sdevent event
      */
-    Manager(sdbusplus::bus::bus& bus);
+    Manager(sdbusplus::bus::bus& bus, const sdeventplus::Event& event);
 
     /**
      * @brief Overridden manager object's configure method
@@ -43,11 +48,26 @@
      */
     void monitor(bool enable) override;
 
+    /**
+     * @brief Timer expired callback function
+     */
+    void timerExpired();
+
   private:
     /**
      * The dbus bus
      */
     sdbusplus::bus::bus& bus;
+
+    /**
+     * Event to loop on
+     */
+    sdeventplus::Event eventLoop;
+
+    /**
+     * List of event timers
+     */
+    std::vector<Timer> timers;
 };
 
 } // namespace phosphor::power::regulators