diff options
author | Matthew Barth <msbarth@us.ibm.com> | 2017-05-22 14:18:25 -0500 |
---|---|---|
committer | Matthew Barth <msbarth@us.ibm.com> | 2017-05-31 12:46:08 -0500 |
commit | 861d77c39a3b69d5be43aceca72602beb18165df (patch) | |
tree | 5f592d2cc58fbbafeb14c6312981e2bcef703d0c /control/zone.cpp | |
parent | 14184131ba863121ac0cda5d8cacfd9a18643fae (diff) | |
download | phosphor-fan-presence-861d77c39a3b69d5be43aceca72602beb18165df.tar.gz phosphor-fan-presence-861d77c39a3b69d5be43aceca72602beb18165df.zip |
Add an active state for automatic fan control
Each zone contains an active state that determines whether the
automatic fan control algorithm is active and controlling the fan speeds
dynamically or not.
This will be used to determine if the fan speeds within the zone are set
dynamically or rather held at another speed for a determined reason.
Change-Id: I2f81de168c5f7d859b3ec917022c4749e1a28d4e
Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
Diffstat (limited to 'control/zone.cpp')
-rw-r--r-- | control/zone.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/control/zone.cpp b/control/zone.cpp index 18fd627..35c7d2b 100644 --- a/control/zone.cpp +++ b/control/zone.cpp @@ -73,6 +73,23 @@ void Zone::setSpeed(uint64_t speed) } } +void Zone::setActiveAllow(const Group* group, bool isActiveAllow) +{ + _active[group] = isActiveAllow; + if (!isActiveAllow) + { + _isActive = false; + } + else + { + // Check all entries are set to allow control active + auto actPred = [](auto const& entry) {return entry.second;}; + _isActive = std::all_of(_active.begin(), + _active.end(), + actPred); + } +} + int Zone::signalHandler(sd_bus_message* msg, void* data, sd_bus_error* err) |