control: Add net target decrease action
Add the YAML based set_net_speed_decrease action function as an action
class for JSON configs to use.
Change-Id: Ibbd784586318dffd795123128f0988faec46ce8f
Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
diff --git a/control/json/zone.cpp b/control/json/zone.cpp
index 6dd4618..e11e6fc 100644
--- a/control/json/zone.cpp
+++ b/control/json/zone.cpp
@@ -51,8 +51,8 @@
Zone::Zone(sdbusplus::bus::bus& bus, const json& jsonObj) :
ConfigBase(jsonObj),
ThermalObject(bus, (fs::path{CONTROL_OBJPATH} /= getName()).c_str(), true),
- _incDelay(0), _floor(0), _target(0), _incDelta(0), _requestTargetBase(0),
- _isActive(true)
+ _incDelay(0), _floor(0), _target(0), _incDelta(0), _decDelta(0),
+ _requestTargetBase(0), _isActive(true)
{
// Increase delay is optional, defaults to 0
if (jsonObj.contains("increase_delay"))
@@ -136,6 +136,15 @@
}
}
+void Zone::requestDecrease(uint64_t targetDelta)
+{
+ // Only decrease the lowest target delta requested
+ if (_decDelta == 0 || targetDelta < _decDelta)
+ {
+ _decDelta = targetDelta;
+ }
+}
+
void Zone::setPersisted(const std::string& intf, const std::string& prop)
{
if (std::find_if(_propsPersisted[intf].begin(), _propsPersisted[intf].end(),