psu-ng: Adjust power on monitoring window

Monitor both pgood and state properties from the power control d-bus
interface in order to adjust the window in which power supply monitoring
is done. Factor in both properties to determine when system is in power
failure and adjust which power supply failures are monitored in that
window.

Signed-off-by: Jim Wright <jlwright@us.ibm.com>
Change-Id: Ib13c9cc6689f0b67c4d396eabfcf50dcab155e9b
diff --git a/phosphor-power-supply/psu_manager.hpp b/phosphor-power-supply/psu_manager.hpp
index fff6a19..6f58eec 100644
--- a/phosphor-power-supply/psu_manager.hpp
+++ b/phosphor-power-supply/psu_manager.hpp
@@ -95,41 +95,7 @@
      *
      * Get current BMC state, ...
      */
-    void initialize()
-    {
-        // When state = 1, system is powered on
-        int32_t state = 0;
-
-        try
-        {
-            // Use getProperty utility function to get power state.
-            util::getProperty<int32_t>(POWER_IFACE, "state", POWER_OBJ_PATH,
-                                       powerService, bus, state);
-
-            if (state)
-            {
-                powerOn = true;
-                validationTimer->restartOnce(validationTimeout);
-            }
-            else
-            {
-                powerOn = false;
-                runValidateConfig = true;
-            }
-        }
-        catch (const std::exception& e)
-        {
-            log<level::INFO>("Failed to get power state. Assuming it is off.");
-            powerOn = false;
-            runValidateConfig = true;
-        }
-
-        onOffConfig(phosphor::pmbus::ON_OFF_CONFIG_CONTROL_PIN_ONLY);
-        clearFaults();
-        updateMissingPSUs();
-        updateInventory();
-        setPowerConfigGPIO();
-    }
+    void initialize();
 
     /**
      * Starts the timer to start monitoring the list of devices.
@@ -215,6 +181,10 @@
     /** @brief True if the power is on. */
     bool powerOn = false;
 
+    /** @brief True if power control is in the window between chassis pgood loss
+     * and power off. */
+    bool powerFaultOccurring = false;
+
     /** @brief True if an error for a brownout has already been logged. */
     bool brownoutLogged = false;