regulators: Add i2c_capture_bytes to parser
Enhance the JSON configuration file parser to support the new
i2c_capture_bytes action.
Add gtest test cases to exercise new code.
Signed-off-by: Shawn McCarney <shawnmm@us.ibm.com>
Change-Id: I92f50fe3df9b3469e16e03b04ae5d0df464eb3e2
diff --git a/phosphor-regulators/src/config_file_parser.hpp b/phosphor-regulators/src/config_file_parser.hpp
index 63dcfd6..1062ced 100644
--- a/phosphor-regulators/src/config_file_parser.hpp
+++ b/phosphor-regulators/src/config_file_parser.hpp
@@ -22,6 +22,7 @@
#include "compare_vpd_action.hpp"
#include "configuration.hpp"
#include "device.hpp"
+#include "i2c_capture_bytes_action.hpp"
#include "i2c_compare_bit_action.hpp"
#include "i2c_compare_byte_action.hpp"
#include "i2c_compare_bytes_action.hpp"
@@ -358,6 +359,19 @@
std::vector<uint8_t> parseHexByteArray(const nlohmann::json& element);
/**
+ * Parses a JSON element containing an i2c_capture_bytes action.
+ *
+ * Returns the corresponding C++ I2CCaptureBytesAction object.
+ *
+ * Throws an exception if parsing fails.
+ *
+ * @param element JSON element
+ * @return I2CCaptureBytesAction object
+ */
+std::unique_ptr<I2CCaptureBytesAction>
+ parseI2CCaptureBytes(const nlohmann::json& element);
+
+/**
* Parses a JSON element containing an i2c_compare_bit action.
*
* Returns the corresponding C++ I2CCompareBitAction object.