pseq: Add setPowerSupplyError D-Bus method

Add a setPowerSupplyError method to the org.openbmc.control.Power
D-Bus interface.  When a power supply error is detected which is severe
enough to cause a power good failure, that error should be used in
preference to the power good error. Add a D-Bus method to allow this to
be communicated between the applications.  The parameter passed should
be the power supply error to log, for example
"xyz.openbmc_project.Power.PowerSupply.Error.PSKillFault".

Signed-off-by: Jim Wright <jlwright@us.ibm.com>
Change-Id: I8500ace4638236dda2d7ff4361b61efa30a50ac1
diff --git a/phosphor-power-sequencer/src/power_control.hpp b/phosphor-power-sequencer/src/power_control.hpp
index 62dfce2..1bac68c 100644
--- a/phosphor-power-sequencer/src/power_control.hpp
+++ b/phosphor-power-sequencer/src/power_control.hpp
@@ -63,6 +63,9 @@
     /** @copydoc PowerInterface::setState() */
     void setState(int state) override;
 
+    /** @copydoc PowerInterface::setPowerSupplyError() */
+    void setPowerSupplyError(const std::string& error) override;
+
   private:
     /**
      * The D-Bus bus object
@@ -72,7 +75,13 @@
     /**
      * The power sequencer device to monitor.
      */
-    std::unique_ptr<PowerSequencerMonitor> device;
+    std::unique_ptr<PowerSequencerMonitor> device{
+        std::make_unique<PowerSequencerMonitor>()};
+
+    /**
+     * Indicates if a specific power sequencer device has already been found.
+     */
+    bool deviceFound{false};
 
     /**
      * Indicates if a state transistion is taking place
@@ -82,7 +91,7 @@
     /**
      * The match to Entity Manager interfaces added.
      */
-    std::unique_ptr<sdbusplus::bus::match_t> match;
+    sdbusplus::bus::match_t match;
 
     /**
      * Power good
@@ -117,6 +126,11 @@
     gpiod::line powerControlLine;
 
     /**
+     * Power supply error
+     */
+    std::string powerSupplyError;
+
+    /**
      * Power state
      */
     int state{0};