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::bus& bus, const sdeventplus::Event& event,
44             Mode mode);
45 
46     /**
47      * Does the fan control inititialization, which is
48      * setting fans to full, delaying so they
49      * can get there, and starting a target.
50      */
51     void doInit();
52 
53   private:
54     /**
55      * The dbus object
56      */
57     sdbusplus::bus::bus& _bus;
58 
59     /**
60      * The sdbusplus object manager
61      */
62     sdbusplus::server::manager::manager _objMgr;
63 
64     /**
65      * The fan zones in the system
66      */
67     ZoneMap _zones;
68 
69     /**
70      * The fan zone layout for the system.
71      * This is generated data.
72      */
73     static const std::vector<ZoneGroup> _zoneLayouts;
74 
75     /**
76      * The number of seconds to delay after
77      * fans get set to high speed on a power on
78      * to give them a chance to get there.
79      */
80     static const unsigned int _powerOnDelay;
81 };
82 
83 } // namespace control
84 } // namespace fan
85 } // namespace phosphor
86