blob: 0b96bfccf1f7eeae429bfa9ea2a9724d68d38d78 [file] [log] [blame]
Matthew Barth293477d2017-02-17 15:39:36 -06001#pragma once
2
Matthew Barthb8034452017-02-17 16:39:46 -06003#include <sdbusplus/bus.hpp>
4#include "fan_properties.hpp"
Matthew Barthd6403822017-02-17 17:10:19 -06005#include "sensor_base.hpp"
Matthew Barthb8034452017-02-17 16:39:46 -06006
Matthew Barth293477d2017-02-17 15:39:36 -06007
8namespace phosphor
9{
10namespace fan
11{
12namespace presence
13{
14
15class FanEnclosure
16{
17 public:
18 FanEnclosure() = delete;
19 FanEnclosure(const FanEnclosure&) = delete;
20 FanEnclosure(FanEnclosure&&) = default;
21 FanEnclosure& operator=(const FanEnclosure&) = delete;
Matthew Barthb8034452017-02-17 16:39:46 -060022 FanEnclosure& operator=(FanEnclosure&&) = delete;
Matthew Barth293477d2017-02-17 15:39:36 -060023 ~FanEnclosure() = default;
24
Matthew Barthb8034452017-02-17 16:39:46 -060025 FanEnclosure(sdbusplus::bus::bus& bus,
26 const phosphor::fan::Properties& fanProp) :
27 bus(bus),
28 invPath(std::get<0>(fanProp)),
29 fanDesc(std::get<1>(fanProp))
30 {
31 //Add this fan to inventory
32 addInventory();
33 }
34
Matthew Barthd6403822017-02-17 17:10:19 -060035 void addSensor(
36 std::unique_ptr<Sensor>&& sensor);
37
Matthew Barth293477d2017-02-17 15:39:36 -060038 private:
Matthew Barthb8034452017-02-17 16:39:46 -060039 sdbusplus::bus::bus& bus;
40 const std::string invPath;
41 const std::string fanDesc;
Matthew Barthd6403822017-02-17 17:10:19 -060042 std::vector<std::unique_ptr<Sensor>> sensors;
Matthew Barthb8034452017-02-17 16:39:46 -060043
44 void addInventory();
Matthew Barth293477d2017-02-17 15:39:36 -060045
46};
47
48} // namespace presence
49} // namespace fan
50} // namespace phosphor