summaryrefslogtreecommitdiffstats
path: root/monitor/conditions.cpp
blob: c046f0c33e41dfc09435878da868888000a27ff4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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
OpenPOWER on IntegriCloud