Refactor the analyze() function to be less verbose
Split up the various fault checking sections of code to be there own
separate functions for checking the various fault bits/conditions and
logging of appropriate error with necessary metadata for debug.
Change-Id: I65e54f53b0089d82852bee398ebb7d2303f29b6c
Signed-off-by: Brandon Wyman <bjwyman@gmail.com>
diff --git a/power-supply/power_supply.hpp b/power-supply/power_supply.hpp
index d47ee3c..ae03ee9 100644
--- a/power-supply/power_supply.hpp
+++ b/power-supply/power_supply.hpp
@@ -185,6 +185,32 @@
*/
void powerStateChanged(sdbusplus::message::message& msg);
+ /**
+ * @brief Checks for input voltage faults and logs error if needed.
+ *
+ * Check for voltage input under voltage fault (VIN_UV_FAULT) and/or
+ * input fault or warning (INPUT_FAULT), and logs appropriate error(s).
+ *
+ * @param[in] statusWord - 2 byte STATUS_WORD value read from sysfs
+ */
+ void checkInputFault(const uint16_t statusWord);
+
+ /**
+ * @brief Checks for power good negated or unit is off in wrong state
+ *
+ * @param[in] statusWord - 2 byte STATUS_WORD value read from sysfs
+ */
+ void checkPGOrUnitOffFault(const uint16_t statusWord);
+
+ /**
+ * @brief Checks for output current over current fault.
+ *
+ * IOUT_OC_FAULT is checked, if on, appropriate error is logged.
+ *
+ * @param[in] statusWord - 2 byte STATUS_WORD value read from sysfs
+ */
+ void checkCurrentOutOverCurrentFault(const uint16_t statusWord);
+
};
}