regulators: Implements support for device
Enhance the configuration file parser to support the device and
i2c_interface elements.
Signed-off-by: Bob King <Bob_King@wistron.com>
Change-Id: I8cf55d4fc793357113cdfcb6c543556b5eb09a8d
diff --git a/phosphor-regulators/src/config_file_parser.hpp b/phosphor-regulators/src/config_file_parser.hpp
index 3ebab4b..35178ea 100644
--- a/phosphor-regulators/src/config_file_parser.hpp
+++ b/phosphor-regulators/src/config_file_parser.hpp
@@ -17,11 +17,15 @@
#include "action.hpp"
#include "chassis.hpp"
+#include "configuration.hpp"
#include "device.hpp"
+#include "i2c_interface.hpp"
#include "i2c_write_bit_action.hpp"
#include "i2c_write_byte_action.hpp"
#include "i2c_write_bytes_action.hpp"
#include "pmbus_write_vout_command_action.hpp"
+#include "presence_detection.hpp"
+#include "rail.hpp"
#include "rule.hpp"
#include "run_rule_action.hpp"
@@ -198,6 +202,18 @@
parseChassisArray(const nlohmann::json& element);
/**
+ * Parses a JSON element containing a device.
+ *
+ * Returns the corresponding C++ Device object.
+ *
+ * Throws an exception if parsing fails.
+ *
+ * @param element JSON element
+ * @return Device object
+ */
+std::unique_ptr<Device> parseDevice(const nlohmann::json& element);
+
+/**
* Parses a JSON element containing an array of devices.
*
* Returns the corresponding C++ Device objects.
@@ -278,6 +294,19 @@
std::vector<uint8_t> parseHexByteArray(const nlohmann::json& element);
/**
+ * Parses a JSON element containing an i2c_interface.
+ *
+ * Returns the corresponding C++ i2c::I2CInterface object.
+ *
+ * Throws an exception if parsing fails.
+ *
+ * @param element JSON element
+ * @return i2c::I2CInterface object
+ */
+std::unique_ptr<i2c::I2CInterface>
+ parseI2CInterface(const nlohmann::json& element);
+
+/**
* Parses a JSON element containing an i2c_write_bit action.
*
* Returns the corresponding C++ I2CWriteBitAction object.
@@ -355,6 +384,19 @@
parsePMBusWriteVoutCommand(const nlohmann::json& element);
/**
+ * Parses a JSON element containing an array of rails.
+ *
+ * Returns the corresponding C++ Rail objects.
+ *
+ * Throws an exception if parsing fails.
+ *
+ * @param element JSON element
+ * @return vector of Rail objects
+ */
+std::vector<std::unique_ptr<Rail>>
+ parseRailArray(const nlohmann::json& element);
+
+/**
* Parses the JSON root element of the entire configuration file.
*
* Returns the corresponding C++ Rule and Chassis objects.