event: Remove in favor of sdeventplus

Use the new library provided to all openbmc projects instead of rolling
our own managed pointer.

Tested: Compiled

Change-Id: I4993d4340e0e0aa5898e73ef815baa81b0e8a2bc
Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/power-supply/main.cpp b/power-supply/main.cpp
index ee93f74..62249c5 100644
--- a/power-supply/main.cpp
+++ b/power-supply/main.cpp
@@ -15,10 +15,9 @@
  */
 #include <iostream>
 #include <phosphor-logging/log.hpp>
-#include <systemd/sd-daemon.h>
+#include <sdeventplus/event.hpp>
 #include "argument.hpp"
 #include "config.h"
-#include "event.hpp"
 #include "power_supply.hpp"
 #include "device_monitor.hpp"
 
@@ -57,22 +56,12 @@
         return -4;
     }
 
-    sd_event* events = nullptr;
-
-    auto r = sd_event_default(&events);
-    if (r < 0)
-    {
-        log<level::ERR>("Failed call to sd_event_default()",
-                        entry("ERROR=%s", strerror(-r)));
-        return -5;
-    }
-
     auto bus = sdbusplus::bus::new_default();
-    witherspoon::power::event::Event eventPtr{events};
+    auto event = sdeventplus::Event::get_default();
 
-    //Attach the event object to the bus object so we can
-    //handle both sd_events (for the timers) and dbus signals.
-    bus.attach_event(eventPtr.get(), SD_EVENT_PRIORITY_NORMAL);
+    // Attach the event object to the bus object so we can
+    // handle both sd_events (for the timers) and dbus signals.
+    bus.attach_event(event.get(), SD_EVENT_PRIORITY_NORMAL);
 
     auto objname = "power_supply" + instnum;
     auto instance = std::stoul(instnum);
@@ -94,7 +83,7 @@
                                                         std::move(objpath),
                                                         std::move(invpath),
                                                         bus,
-                                                        eventPtr,
+                                                        event,
                                                         powerOnDelay,
                                                         presentDelay);
 
@@ -151,8 +140,5 @@
     }
 
     auto pollInterval = std::chrono::milliseconds(1000);
-    DeviceMonitor mainloop(std::move(psuDevice), eventPtr, pollInterval);
-    mainloop.run();
-
-    return 0;
+    return DeviceMonitor(std::move(psuDevice), event, pollInterval).run();
 }
diff --git a/power-supply/power_supply.cpp b/power-supply/power_supply.cpp
index d4c5f74..f5187f0 100644
--- a/power-supply/power_supply.cpp
+++ b/power-supply/power_supply.cpp
@@ -68,11 +68,11 @@
                          const std::string& objpath,
                          const std::string& invpath,
                          sdbusplus::bus::bus& bus,
-                         event::Event& e,
+                         const sdeventplus::Event& e,
                          std::chrono::seconds& t,
                          std::chrono::seconds& p)
     : Device(name, inst), monitorPath(objpath), pmbusIntf(objpath),
-      inventoryPath(INVENTORY_OBJ_PATH + invpath), bus(bus), event(e),
+      inventoryPath(INVENTORY_OBJ_PATH + invpath), bus(bus),
       presentInterval(p),
       presentTimer(e, [this]()
                    {
diff --git a/power-supply/power_supply.hpp b/power-supply/power_supply.hpp
index e88e257..30f660f 100644
--- a/power-supply/power_supply.hpp
+++ b/power-supply/power_supply.hpp
@@ -1,5 +1,6 @@
 #pragma once
 #include <sdbusplus/bus/match.hpp>
+#include <sdeventplus/event.hpp>
 #include "average.hpp"
 #include "device.hpp"
 #include "maximum.hpp"
@@ -51,7 +52,7 @@
                     const std::string& objpath,
                     const std::string& invpath,
                     sdbusplus::bus::bus& bus,
-                    event::Event& e,
+                    const sdeventplus::Event& e,
                     std::chrono::seconds& t,
                     std::chrono::seconds& p);
 
@@ -126,10 +127,6 @@
         /** @brief Used to subscribe to D-Bus property changes for Present */
         std::unique_ptr<sdbusplus::bus::match_t> presentMatch;
 
-        /** @brief The sd_event structure used by the power on and present
-         *  timers. */
-        event::Event& event;
-
         /**
          * @brief Interval for setting present to true.
          *