blob: 5b748a2fb0b09d133bdc5827c9d50ef13182ba68 [file] [log] [blame]
Matt Spinlere10416e2017-04-10 14:15:53 -05001#pragma once
2
3#include <memory>
4#include <vector>
5#include <sdbusplus/bus.hpp>
William A. Kennington III1cfc2f12018-10-19 17:29:46 -07006#include <sdeventplus/event.hpp>
Matt Spinlere10416e2017-04-10 14:15:53 -05007#include "types.hpp"
Matt Spinler57352a32017-04-10 14:48:35 -05008#include "zone.hpp"
Matt Spinlere10416e2017-04-10 14:15:53 -05009
10namespace phosphor
11{
12namespace fan
13{
14namespace control
15{
16
Matt Spinler57352a32017-04-10 14:48:35 -050017using ZoneMap = std::map<unsigned int,
18 std::unique_ptr<Zone>>;
19
Matt Spinlere10416e2017-04-10 14:15:53 -050020/**
21 * @class Fan control manager
22 */
23class 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
William A. Kennington III1cfc2f12018-10-19 17:29:46 -070040 * @param[in] event - The event loop
Matt Spinleree7f6422017-05-09 11:03:14 -050041 * @param[in] mode - The control mode
Matt Spinlere10416e2017-04-10 14:15:53 -050042 */
Matt Spinleree7f6422017-05-09 11:03:14 -050043 Manager(sdbusplus::bus::bus& bus,
William A. Kennington III1cfc2f12018-10-19 17:29:46 -070044 const sdeventplus::Event& event,
Matt Spinleree7f6422017-05-09 11:03:14 -050045 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();
Matt Spinlere10416e2017-04-10 14:15:53 -050053
54 private:
55
56 /**
57 * The dbus object
58 */
59 sdbusplus::bus::bus& _bus;
60
61 /**
Matt Spinler57352a32017-04-10 14:48:35 -050062 * The fan zones in the system
63 */
64 ZoneMap _zones;
65
66 /**
Matt Spinlere10416e2017-04-10 14:15:53 -050067 * The fan zone layout for the system.
68 * This is generated data.
69 */
70 static const std::vector<ZoneGroup> _zoneLayouts;
Matt Spinleree7f6422017-05-09 11:03:14 -050071
72 /**
73 * The number of seconds to delay after
74 * fans get set to high speed on a power on
75 * to give them a chance to get there.
76 */
77 static const unsigned int _powerOnDelay;
Matt Spinlere10416e2017-04-10 14:15:53 -050078};
79
80
81}
82}
83}