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