Add in support for power supply over-temperature

If a power supply encounters an over-temperature condition, the FAN
FAULT OR WARNING bit of the STATUS_WORD (low byte) command response
should be turned on. Ideally, when this is encountered, both power
supplies would be called out, as one condition that could lead to this
is due to the other supply putting out less current. Since each
monitoring application of the power supplies only knows its own
information, just the power supply indicating the condition will be
called out along with metadata containing potentially relevant command
response data.

Change-Id: I8f96828f85161050f73bb080392e1e8fef4a179b
Signed-off-by: Brandon Wyman <bjwyman@gmail.com>
diff --git a/power-supply/power_supply.hpp b/power-supply/power_supply.hpp
index a3cea2d..379a937 100644
--- a/power-supply/power_supply.hpp
+++ b/power-supply/power_supply.hpp
@@ -90,7 +90,7 @@
         /** @brief True if the power supply is present. */
         bool present = false;
 
-        /** @brief Used to subscribe to D-Bus property changes to Present **/
+        /** @brief Used to subscribe to D-Bus property changes for Present */
         std::unique_ptr<sdbusplus::bus::match_t> presentMatch;
 
         /** @brief True if the power is on. */
@@ -119,7 +119,7 @@
          */
         Timer powerOnTimer;
 
-        /** @brief Used to subscribe to D-Bus power on state changes **/
+        /** @brief Used to subscribe to D-Bus power on state changes */
         std::unique_ptr<sdbusplus::bus::match_t> powerOnMatch;
 
         /** @brief Has a PMBus read failure already been logged? */
@@ -160,6 +160,11 @@
         bool fanFault = false;
 
         /**
+         * @brief Set to true during a temperature fault or warn condition.
+         */
+        bool temperatureFault = false;
+
+        /**
          * @brief Callback for inventory property changes
          *
          * Process change of Present property for power supply.
@@ -181,7 +186,7 @@
         /**
          * @brief Updates the poweredOn status by querying D-Bus
          *
-         * The D-Bus property for the sytem power state will be read to
+         * The D-Bus property for the system power state will be read to
          * determine if the system is powered on or not.
          */
         void updatePowerState();
@@ -240,6 +245,17 @@
          */
         void checkFanFault(const uint16_t statusWord);
 
+        /**
+         * @brief Checks for a temperature fault or warning condition.
+         *
+         * The low byte of STATUS_WORD is checked to see if the "TEMPERATURE
+         * FAULT OR WARNING" bit is turned on. If it is on, log an error,
+         * call out the power supply indicating the fault/warning condition.
+         *
+         * @parma[in] statusWord - 2 byte STATUS_WORD value read from sysfs
+         */
+        void checkTemperatureFault(const uint16_t statusWord);
+
 };
 
 }