Add in a delay before setting present to true

When a power supply is inserted, allow for a time delay before starting
the fault checks. This will give the individual servicing a power supply
some time to insert the supply and then apply power.

Change-Id: Ic957be927cea26a6c011a0a634f84093e040b454
Signed-off-by: Brandon Wyman <bjwyman@gmail.com>
diff --git a/power-supply/power_supply.hpp b/power-supply/power_supply.hpp
index a77912e..3da02b4 100644
--- a/power-supply/power_supply.hpp
+++ b/power-supply/power_supply.hpp
@@ -40,13 +40,17 @@
          * @param[in] bus - D-Bus bus object
          * @param[in] e - event object
          * @param[in] t - time to allow power supply to assert PG#
+         * @param[in] p - time to allow power supply presence state to
+         *                settle/deglitch and allow for application of power
+         *                prior to fault checking
          */
         PowerSupply(const std::string& name, size_t inst,
                     const std::string& objpath,
                     const std::string& invpath,
                     sdbusplus::bus::bus& bus,
                     event::Event& e,
-                    std::chrono::seconds& t);
+                    std::chrono::seconds& t,
+                    std::chrono::seconds& p);
 
         /**
          * Power supply specific function to analyze for faults/errors.
@@ -96,6 +100,27 @@
         /** @brief Used to subscribe to D-Bus property changes for Present */
         std::unique_ptr<sdbusplus::bus::match_t> presentMatch;
 
+        /** @brief The sd_event structure used by the power on and present
+         *  timers. */
+        event::Event& event;
+
+        /**
+         * @brief Interval for setting present to true.
+         *
+         * The amount of time to wait from not present to present change before
+         * updating the internal present indicator. Allows person servicing
+         * the power supply some time to plug in the cable.
+         */
+        std::chrono::seconds presentInterval;
+
+        /**
+         * @brief Timer used to delay setting the internal present state.
+         *
+         * The timer used to do the callback after the present property has
+         * changed.
+         */
+        Timer presentTimer;
+
         /** @brief True if the power is on. */
         bool powerOn = false;
 
@@ -105,9 +130,6 @@
          */
         size_t powerOnFault = 0;
 
-        /** @brief The sd_event structure used by the power on timer. */
-        event::Event& event;
-
         /**
          * @brief Interval to setting powerOn to true.
          *