psu-ng: Create errors for detected faults

Add in a function for creating errors using the Create D-Bus call.

Update the analyze function to create errors when faults are found.

We would want to log a fault per power supply, so move the faultLogged
concept down to the PowerSupply object itself.

Signed-off-by: Brandon Wyman <bjwyman@gmail.com>
Change-Id: I94d22b2b8a495abde87fb921c9177c6d25225ef7
diff --git a/phosphor-power-supply/power_supply.hpp b/phosphor-power-supply/power_supply.hpp
index c94871f..f1220fd 100644
--- a/phosphor-power-supply/power_supply.hpp
+++ b/phosphor-power-supply/power_supply.hpp
@@ -152,6 +152,22 @@
     }
 
     /**
+     * @brief Return whether a fault has been logged for this power supply
+     */
+    bool isFaultLogged() const
+    {
+        return faultLogged;
+    }
+
+    /**
+     * @brief Called when a fault for this power supply has been logged.
+     */
+    void setFaultLogged()
+    {
+        faultLogged = true;
+    }
+
+    /**
      * @brief Returns true if INPUT fault occurred.
      */
     bool hasInputFault() const
@@ -190,6 +206,9 @@
     /** @brief True if a fault has already been found and not cleared */
     bool faultFound = false;
 
+    /** @brief True if an error for a fault has already been logged. */
+    bool faultLogged = false;
+
     /** @brief True if bit 5 of STATUS_WORD high byte is on. */
     bool inputFault = false;