blob: c046f0c33e41dfc09435878da868888000a27ff4 [file] [log] [blame]
Matthew Barth81748b12018-05-02 16:03:48 -05001#include <algorithm>
2#include "conditions.hpp"
3#include "sdbusplus.hpp"
4
5namespace phosphor
6{
7namespace fan
8{
9namespace monitor
10{
11namespace condition
12{
13
14Condition 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