Fill in witherspoon-pseq-monitor main()
Call run() on an instance of the PGOODMonitor class.
Change-Id: I1ec693ece7dd6034c513d2ca6b294e5b0a1e0e6d
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
diff --git a/power-sequencer/main.cpp b/power-sequencer/main.cpp
index 889340e..1f77e55 100644
--- a/power-sequencer/main.cpp
+++ b/power-sequencer/main.cpp
@@ -15,9 +15,12 @@
*/
#include <chrono>
#include <iostream>
+#include <phosphor-logging/log.hpp>
#include "argument.hpp"
+#include "pgood_monitor.hpp"
using namespace witherspoon::power;
+using namespace phosphor::logging;
int main(int argc, char** argv)
{
@@ -40,5 +43,20 @@
std::chrono::seconds interval{i};
- return EXIT_SUCCESS;
+ sd_event* e = nullptr;
+ auto r = sd_event_default(&e);
+ if (r < 0)
+ {
+ log<level::ERR>("sd_event_default() failed",
+ entry("ERROR=%s", strerror(-r)));
+ exit(EXIT_FAILURE);
+ }
+
+ event::Event event{e};
+ auto bus = sdbusplus::bus::new_default();
+ bus.attach_event(event.get(), SD_EVENT_PRIORITY_NORMAL);
+
+ PGOODMonitor monitor{bus, event, interval};
+
+ return monitor.run();
}