1 #pragma once
2 
3 #include <memory>
4 #include <vector>
5 #include <sdbusplus/bus.hpp>
6 #include "types.hpp"
7 #include "zone.hpp"
8 
9 namespace phosphor
10 {
11 namespace fan
12 {
13 namespace control
14 {
15 
16 using ZoneMap = std::map<unsigned int,
17                          std::unique_ptr<Zone>>;
18 
19 /**
20  * @class Fan control manager
21  */
22 class Manager
23 {
24     public:
25 
26         Manager() = delete;
27         Manager(const Manager&) = delete;
28         Manager(Manager&&) = default;
29         Manager& operator=(const Manager&) = delete;
30         Manager& operator=(Manager&&) = delete;
31         ~Manager() = default;
32 
33         /**
34          * Constructor
35          * Creates the Zone objects based on the
36          * _zoneLayouts data.
37          *
38          * @param[in] bus - The dbus object
39          * @param[in] mode - The control mode
40          */
41         Manager(sdbusplus::bus::bus& bus,
42                 Mode mode);
43 
44         /**
45          * Does the fan control inititialization, which is
46          * setting fans to full, delaying so they
47          * can get there, and starting a target.
48          */
49         void doInit();
50 
51     private:
52 
53         /**
54          * Starts the obmc-fan-control-ready dbus target
55          */
56         void startFanControlReadyTarget();
57 
58         /**
59          * The dbus object
60          */
61         sdbusplus::bus::bus& _bus;
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 
83 }
84 }
85 }
86