diff options
author | Matthew Barth <msbarth@us.ibm.com> | 2017-08-04 11:18:28 -0500 |
---|---|---|
committer | Matthew Barth <msbarth@us.ibm.com> | 2017-08-07 15:30:10 -0500 |
commit | 604329ef36d8ba2cd324f7132427d7e5724c074e (patch) | |
tree | 20b319dc2ff32e408ef0cb6bad272d2ea749c299 /control/zone.cpp | |
parent | eb639c575a7964b849117cc70b6102f17a2dc32a (diff) | |
download | phosphor-fan-presence-604329ef36d8ba2cd324f7132427d7e5724c074e.tar.gz phosphor-fan-presence-604329ef36d8ba2cd324f7132427d7e5724c074e.zip |
Add precondition that checks property states
The property state check precondition validates that each given property
matches the defined value. When all the precondition groups' property
states match, the given set speed event is initialized and activated
allowing the zone speeds to be active controlled.
Change-Id: Ic16a0e1fc584c6fa695e354fa80fb1993002ffc7
Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
Diffstat (limited to 'control/zone.cpp')
-rw-r--r-- | control/zone.cpp | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/control/zone.cpp b/control/zone.cpp index 4fb60cd..55aae9d 100644 --- a/control/zone.cpp +++ b/control/zone.cpp @@ -175,12 +175,23 @@ void Zone::decTimerExpired() void Zone::initEvent(const SetSpeedEvent& event) { // Get the current value for each property - for (auto& entry : std::get<groupPos>(event)) + for (auto& group : std::get<groupPos>(event)) { - refreshProperty(_bus, - entry.first, - std::get<intfPos>(entry.second), - std::get<propPos>(entry.second)); + try + { + refreshProperty(_bus, + group.first, + std::get<intfPos>(group.second), + std::get<propPos>(group.second)); + } + catch (const InternalFailure& ife) + { + log<level::ERR>( + "Unable to find property: ", + entry("PATH=%s", group.first.c_str()), + entry("INTERFACE=%s", std::get<intfPos>(group.second).c_str()), + entry("PROPERTY=%s", std::get<propPos>(group.second).c_str())); + } } // Setup signal matches for property change events for (auto& prop : std::get<propChangeListPos>(event)) |