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