blob: c87d0d896693092d6971f49dedf846b61f59dd4b [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 /**
Matthew Barth93af4192019-01-18 09:30:57 -060062 * The sdbusplus object manager
63 */
64 sdbusplus::server::manager::manager _objMgr;
65
66 /**
Matt Spinler57352a32017-04-10 14:48:35 -050067 * The fan zones in the system
68 */
69 ZoneMap _zones;
70
71 /**
Matt Spinlere10416e2017-04-10 14:15:53 -050072 * The fan zone layout for the system.
73 * This is generated data.
74 */
75 static const std::vector<ZoneGroup> _zoneLayouts;
Matt Spinleree7f6422017-05-09 11:03:14 -050076
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;
Matt Spinlere10416e2017-04-10 14:15:53 -050083};
84
85
86}
87}
88}