Monitor UCD90160 for faults at runtime

Add the RuntimeMonitor class that will monitor the
UCD90160 faults in 2 ways:

1) Watch for the PowerLost signal, meaning system
   PGOOD was lost.  When it occurs, analyze the
   chip for errors and then issue a proper shutdown
   so a faulted device doesn't keep getting power.

2) Poll on an interval for nonfatal errors that need
   to be logged but don't cause a PGOOD loss.

The main executable can now launch either the PGOODMonitor
or the RuntimeMonitor based on commandline arguments.

Change-Id: If2856f173d5d6288d8333538334b4b4cb4a60097
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
diff --git a/power-sequencer/main.cpp b/power-sequencer/main.cpp
index 074660d..f324d3e 100644
--- a/power-sequencer/main.cpp
+++ b/power-sequencer/main.cpp
@@ -18,6 +18,7 @@
 #include <phosphor-logging/log.hpp>
 #include "argument.hpp"
 #include "pgood_monitor.hpp"
+#include "runtime_monitor.hpp"
 #include "ucd90160.hpp"
 
 using namespace witherspoon::power;
@@ -28,7 +29,7 @@
     ArgumentParser args{argc, argv};
     auto action = args["action"];
 
-    if (action != "pgood-monitor")
+    if ((action != "pgood-monitor") && (action != "runtime-monitor"))
     {
         std::cerr << "Invalid action\n";
         args.usage(argv);
@@ -59,7 +60,22 @@
 
     auto device = std::make_unique<UCD90160>(0);
 
-    PGOODMonitor monitor{std::move(device), bus, event, interval};
+    std::unique_ptr<DeviceMonitor> monitor;
 
-    return monitor.run();
+    if (action == "pgood-monitor")
+    {
+        //If PGOOD doesn't turn on within a certain
+        //time, analyze the device for errors
+        monitor = std::make_unique<PGOODMonitor>(
+                std::move(device), bus, event, interval);
+    }
+    else //runtime-monitor
+    {
+        //Continuously monitor this device both by polling
+        //and on 'power lost' signals.
+        monitor = std::make_unique<RuntimeMonitor>(
+                std::move(device), bus, event, interval);
+    }
+
+    return monitor->run();
 }