regulators: Implements support for set_device action
Enhance the configuration file parser to support the set_device
action element.
Signed-off-by: Bob King <Bob_King@wistron.com>
Change-Id: If9d1e25dc35370536fab9ab4ef7f2bf269e46d20
diff --git a/phosphor-regulators/src/config_file_parser.cpp b/phosphor-regulators/src/config_file_parser.cpp
index 14bf942..b94e308 100644
--- a/phosphor-regulators/src/config_file_parser.cpp
+++ b/phosphor-regulators/src/config_file_parser.cpp
@@ -146,9 +146,8 @@
}
else if (element.contains("set_device"))
{
- // TODO: Not implemented yet
- // action = parseSetDevice(element["set_device"]);
- // ++propertyCount;
+ action = parseSetDevice(element["set_device"]);
+ ++propertyCount;
}
else
{
@@ -881,6 +880,14 @@
return std::make_unique<SensorMonitoring>(std::move(actions));
}
+std::unique_ptr<SetDeviceAction> parseSetDevice(const json& element)
+{
+ // String deviceID
+ std::string deviceID = parseString(element);
+
+ return std::make_unique<SetDeviceAction>(deviceID);
+}
+
} // namespace internal
} // namespace phosphor::power::regulators::config_file_parser