Matthew Barth | 81748b1 | 2018-05-02 16:03:48 -0500 | [diff] [blame] | 1 | #include <algorithm> |
| 2 | #include "conditions.hpp" |
| 3 | #include "sdbusplus.hpp" |
| 4 | |
| 5 | namespace phosphor |
| 6 | { |
| 7 | namespace fan |
| 8 | { |
| 9 | namespace monitor |
| 10 | { |
| 11 | namespace condition |
| 12 | { |
| 13 | |
| 14 | Condition propertiesMatch(std::vector<PropertyState>&& propStates) |
| 15 | { |
| 16 | return [pStates = std::move(propStates)](sdbusplus::bus::bus& bus) |
| 17 | { |
| 18 | return std::all_of( |
| 19 | pStates.begin(), |
| 20 | pStates.end(), |
| 21 | [&bus](const auto& p) |
| 22 | { |
| 23 | return util::SDBusPlus::getPropertyVariant<PropertyValue>( |
| 24 | bus, |
| 25 | std::get<propObj>(p.first), |
| 26 | std::get<propIface>(p.first), |
| 27 | std::get<propName>(p.first)) == p.second; |
| 28 | }); |
| 29 | }; |
| 30 | } |
| 31 | |
| 32 | } // namespace condition |
| 33 | } // namespace monitor |
| 34 | } // namespace fan |
| 35 | } // namespace phosphor |