summaryrefslogtreecommitdiffstats
path: root/fan_enclosure.hpp
blob: 5c6a040f034de21ffb4e4889e29bc6dd192e34ae (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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#pragma once

#include <sdbusplus/bus.hpp>
#include "fan_properties.hpp"
#include "sensor_base.hpp"


namespace phosphor
{
namespace fan
{
namespace presence
{

class FanEnclosure
{
    public:
        FanEnclosure() = delete;
        FanEnclosure(const FanEnclosure&) = delete;
        FanEnclosure(FanEnclosure&&) = default;
        FanEnclosure& operator=(const FanEnclosure&) = delete;
        FanEnclosure& operator=(FanEnclosure&&) = delete;
        ~FanEnclosure() = default;

        FanEnclosure(sdbusplus::bus::bus& bus,
                     const phosphor::fan::Properties& fanProp) :
                        bus(bus),
                        invPath(std::get<0>(fanProp)),
                        fanDesc(std::get<1>(fanProp))
        {
            //Add this fan to inventory
            addInventory();
        }

        void updInventory();
        void addSensor(
            std::unique_ptr<Sensor>&& sensor);

    private:
        sdbusplus::bus::bus& bus;
        const std::string invPath;
        const std::string fanDesc;
        std::vector<std::unique_ptr<Sensor>> sensors;

        void addInventory();

};

} // namespace presence
} // namespace fan
} // namespace phosphor
OpenPOWER on IntegriCloud