1 #pragma once
2 
3 #include "types.hpp"
4 #include "zone.hpp"
5 
6 #include <sdbusplus/bus.hpp>
7 #include <sdeventplus/event.hpp>
8 
9 #include <memory>
10 #include <vector>
11 
12 namespace phosphor
13 {
14 namespace fan
15 {
16 namespace control
17 {
18 
19 using ZoneMap = std::map<unsigned int, std::unique_ptr<Zone>>;
20 
21 /**
22  * @class Fan control manager
23  */
24 class Manager
25 {
26   public:
27     Manager() = delete;
28     Manager(const Manager&) = delete;
29     Manager(Manager&&) = default;
30     Manager& operator=(const Manager&) = delete;
31     Manager& operator=(Manager&&) = delete;
32     ~Manager() = default;
33 
34     /**
35      * Constructor
36      * Creates the Zone objects based on the
37      * _zoneLayouts data.
38      *
39      * @param[in] bus - The dbus object
40      * @param[in] event - The event loop
41      * @param[in] mode - The control mode
42      */
43     Manager(sdbusplus::bus_t& bus, const sdeventplus::Event& event, Mode mode);
44 
45     /**
46      * Does the fan control inititialization, which is
47      * setting fans to full, delaying so they
48      * can get there, and starting a target.
49      */
50     void doInit(const sdeventplus::Event& event);
51 
52   private:
53     /**
54      * The dbus object
55      */
56     sdbusplus::bus_t& _bus;
57 
58     /**
59      * The sdbusplus object manager
60      */
61     sdbusplus::server::manager_t _objMgr;
62 
63     /**
64      * The fan zones in the system
65      */
66     ZoneMap _zones;
67 
68     /**
69      * The fan zone layout for the system.
70      * This is generated data.
71      */
72     static const std::vector<ZoneGroup> _zoneLayouts;
73 
74     /**
75      * The number of seconds to delay after
76      * fans get set to high speed on a power on
77      * to give them a chance to get there.
78      */
79     static const unsigned int _powerOnDelay;
80 };
81 
82 } // namespace control
83 } // namespace fan
84 } // namespace phosphor
85