diff options
Diffstat (limited to 'monitor/conditions.cpp')
-rw-r--r-- | monitor/conditions.cpp | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/monitor/conditions.cpp b/monitor/conditions.cpp new file mode 100644 index 0000000..c046f0c --- /dev/null +++ b/monitor/conditions.cpp @@ -0,0 +1,35 @@ +#include <algorithm> +#include "conditions.hpp" +#include "sdbusplus.hpp" + +namespace phosphor +{ +namespace fan +{ +namespace monitor +{ +namespace condition +{ + +Condition propertiesMatch(std::vector<PropertyState>&& propStates) +{ + return [pStates = std::move(propStates)](sdbusplus::bus::bus& bus) + { + return std::all_of( + pStates.begin(), + pStates.end(), + [&bus](const auto& p) + { + return util::SDBusPlus::getPropertyVariant<PropertyValue>( + bus, + std::get<propObj>(p.first), + std::get<propIface>(p.first), + std::get<propName>(p.first)) == p.second; + }); + }; +} + +} // namespace condition +} // namespace monitor +} // namespace fan +} // namespace phosphor |