regulators: Implements support for not action
Enhance the configuration file parser to support the not action element.
Signed-off-by: Bob King <Bob_King@wistron.com>
Change-Id: Ia88eee705a9fae28a816aeb6dff9e0b6f0deba39
diff --git a/phosphor-regulators/src/config_file_parser.cpp b/phosphor-regulators/src/config_file_parser.cpp
index e458ba7..5f0181e 100644
--- a/phosphor-regulators/src/config_file_parser.cpp
+++ b/phosphor-regulators/src/config_file_parser.cpp
@@ -120,9 +120,8 @@
}
else if (element.contains("not"))
{
- // TODO: Not implemented yet
- // action = parseNot(element["not"]);
- // ++propertyCount;
+ action = parseNot(element["not"]);
+ ++propertyCount;
}
else if (element.contains("or"))
{
@@ -576,6 +575,14 @@
return std::make_unique<I2CWriteBytesAction>(reg, values, masks);
}
+std::unique_ptr<NotAction> parseNot(const json& element)
+{
+ // Required action to execute
+ std::unique_ptr<Action> action = parseAction(element);
+
+ return std::make_unique<NotAction>(std::move(action));
+}
+
std::unique_ptr<PMBusWriteVoutCommandAction>
parsePMBusWriteVoutCommand(const json& element)
{