blob: 992a51a1289bcc970e10409d2cdda7f58eb7173c [file] [log] [blame]
Matt Spinlere10416e2017-04-10 14:15:53 -05001#pragma once
2
Matt Spinlere10416e2017-04-10 14:15:53 -05003#include "types.hpp"
Matt Spinler57352a32017-04-10 14:48:35 -05004#include "zone.hpp"
Matt Spinlere10416e2017-04-10 14:15:53 -05005
Matthew Barth3e1bb272020-05-26 11:09:21 -05006#include <sdbusplus/bus.hpp>
7#include <sdeventplus/event.hpp>
8
9#include <memory>
10#include <vector>
11
Matt Spinlere10416e2017-04-10 14:15:53 -050012namespace phosphor
13{
14namespace fan
15{
16namespace control
17{
18
Matthew Barth3e1bb272020-05-26 11:09:21 -050019using ZoneMap = std::map<unsigned int, std::unique_ptr<Zone>>;
Matt Spinler57352a32017-04-10 14:48:35 -050020
Matt Spinlere10416e2017-04-10 14:15:53 -050021/**
22 * @class Fan control manager
23 */
24class Manager
25{
Matthew Barth3e1bb272020-05-26 11:09:21 -050026 public:
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;
Matt Spinlere10416e2017-04-10 14:15:53 -050033
Matthew Barth3e1bb272020-05-26 11:09:21 -050034 /**
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 */
Patrick Williamscb356d42022-07-22 19:26:53 -050043 Manager(sdbusplus::bus_t& bus, const sdeventplus::Event& event, Mode mode);
Matt Spinlere10416e2017-04-10 14:15:53 -050044
Matthew Barth3e1bb272020-05-26 11:09:21 -050045 /**
46 * Does the fan control inititialization, which is
47 * setting fans to full, delaying so they
48 * can get there, and starting a target.
49 */
Matthew Barth06764942021-03-04 09:28:40 -060050 void doInit(const sdeventplus::Event& event);
Matt Spinleree7f6422017-05-09 11:03:14 -050051
Matthew Barth3e1bb272020-05-26 11:09:21 -050052 private:
53 /**
54 * The dbus object
55 */
Patrick Williamscb356d42022-07-22 19:26:53 -050056 sdbusplus::bus_t& _bus;
Matt Spinlere10416e2017-04-10 14:15:53 -050057
Matthew Barth3e1bb272020-05-26 11:09:21 -050058 /**
59 * The sdbusplus object manager
60 */
Patrick Williamscb356d42022-07-22 19:26:53 -050061 sdbusplus::server::manager_t _objMgr;
Matt Spinlere10416e2017-04-10 14:15:53 -050062
Matthew Barth3e1bb272020-05-26 11:09:21 -050063 /**
64 * The fan zones in the system
65 */
66 ZoneMap _zones;
Matthew Barthf8ae7a52021-03-05 10:23:43 -060067
Matthew Barth3e1bb272020-05-26 11:09:21 -050068 /**
69 * The fan zone layout for the system.
70 * This is generated data.
71 */
72 static const std::vector<ZoneGroup> _zoneLayouts;
Matthew Barth93af4192019-01-18 09:30:57 -060073
Matthew Barth3e1bb272020-05-26 11:09:21 -050074 /**
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;
Matt Spinlere10416e2017-04-10 14:15:53 -050080};
81
Matthew Barth3e1bb272020-05-26 11:09:21 -050082} // namespace control
83} // namespace fan
84} // namespace phosphor