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