Update analyze function to check STATUS_WORD

The STATUS_WORD PMBus command response will be the start of the power
supply fault analysis. Update the analyze() function to read its value
and process (select) fault bits.

Signed-off-by: Brandon Wyman <bjwyman@gmail.com>
Change-Id: If7274ad237c0604a56008676ae64804a5fd2854e
diff --git a/phosphor-power-supply/psu_manager.hpp b/phosphor-power-supply/psu_manager.hpp
index a4628c4..a3bcae0 100644
--- a/phosphor-power-supply/psu_manager.hpp
+++ b/phosphor-power-supply/psu_manager.hpp
@@ -111,6 +111,8 @@
         {
             psu->clearFaults();
         }
+
+        faultLogged = false;
     }
 
   private:
@@ -135,11 +137,36 @@
         {
             psu->analyze();
         }
+
+        for (auto& psu : psus)
+        {
+            // TODO: Fault priorities #918
+            if (!faultLogged && psu->isFaulted())
+            {
+                if (psu->hasInputFault())
+                {
+                    // TODO: Create error log
+                }
+
+                if (psu->hasMFRFault())
+                {
+                    // TODO: Create error log
+                }
+
+                if (psu->hasVINUVFault())
+                {
+                    // TODO: Create error log
+                }
+            }
+        }
     }
 
     /** @brief True if the power is on. */
     bool powerOn = false;
 
+    /** @brief True if fault logged. Clear in clearFaults(). */
+    bool faultLogged = false;
+
     /** @brief Used as part of subscribing to power on state changes*/
     std::string powerService;