summaryrefslogtreecommitdiffstats
path: root/tach_detect.cpp
blob: e3d23890fa6a201bb3ca9735282834f59dcf15c4 (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 <vector>
#include <sdbusplus/bus.hpp>
#include "fan_enclosure.hpp"
#include "fan_detect_defs.hpp"


int main(void)
{
    auto bus = sdbusplus::bus::new_default();

    std::vector<std::unique_ptr<phosphor::fan::presence::FanEnclosure>> fans;

    for (auto const& detectMap: fanDetectMap)
    {
        if (detectMap.first == "tach")
        {
            for (auto const& fanProp: detectMap.second)
            {
                auto fan = std::make_unique<
                    phosphor::fan::presence::FanEnclosure>(bus,
                                                           fanProp);
                // TODO Add sensors to fan object
                fans.push_back(std::move(fan));
            }
        }
    }

    while (true)
    {
        // Respond to dbus signals
        bus.process_discard();
        bus.wait();
    }
    return 0;
}
OpenPOWER on IntegriCloud