blob: a2e44f5afacc1367d0f52024bf183ba43797781b [file] [log] [blame]
Matt Spinlere10416e2017-04-10 14:15:53 -05001#pragma once
2
Matthew Barthd87f89f2020-07-30 10:41:32 -05003#include "config.h"
4
Matt Spinlere10416e2017-04-10 14:15:53 -05005#include "types.hpp"
Matt Spinler57352a32017-04-10 14:48:35 -05006#include "zone.hpp"
Matt Spinlere10416e2017-04-10 14:15:53 -05007
Matthew Barth3e1bb272020-05-26 11:09:21 -05008#include <sdbusplus/bus.hpp>
9#include <sdeventplus/event.hpp>
10
11#include <memory>
12#include <vector>
13
Matt Spinlere10416e2017-04-10 14:15:53 -050014namespace phosphor
15{
16namespace fan
17{
18namespace control
19{
20
Matthew Barth3e1bb272020-05-26 11:09:21 -050021using ZoneMap = std::map<unsigned int, std::unique_ptr<Zone>>;
Matt Spinler57352a32017-04-10 14:48:35 -050022
Matt Spinlere10416e2017-04-10 14:15:53 -050023/**
24 * @class Fan control manager
25 */
26class Manager
27{
Matthew Barth3e1bb272020-05-26 11:09:21 -050028 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;
Matt Spinlere10416e2017-04-10 14:15:53 -050035
Matthew Barth3e1bb272020-05-26 11:09:21 -050036 /**
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);
Matt Spinlere10416e2017-04-10 14:15:53 -050047
Matthew Barth3e1bb272020-05-26 11:09:21 -050048 /**
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();
Matt Spinleree7f6422017-05-09 11:03:14 -050054
Matthew Barth3e1bb272020-05-26 11:09:21 -050055 private:
56 /**
57 * The dbus object
58 */
59 sdbusplus::bus::bus& _bus;
Matt Spinlere10416e2017-04-10 14:15:53 -050060
Matthew Barth3e1bb272020-05-26 11:09:21 -050061 /**
62 * The sdbusplus object manager
63 */
64 sdbusplus::server::manager::manager _objMgr;
Matt Spinlere10416e2017-04-10 14:15:53 -050065
Matthew Barth3e1bb272020-05-26 11:09:21 -050066 /**
67 * The fan zones in the system
68 */
69 ZoneMap _zones;
Matthew Barthd87f89f2020-07-30 10:41:32 -050070#ifndef CONTROL_USE_JSON
Matthew Barth3e1bb272020-05-26 11:09:21 -050071 /**
72 * The fan zone layout for the system.
73 * This is generated data.
74 */
75 static const std::vector<ZoneGroup> _zoneLayouts;
Matthew Barth93af4192019-01-18 09:30:57 -060076
Matthew Barth3e1bb272020-05-26 11:09:21 -050077 /**
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;
Matthew Barthd87f89f2020-07-30 10:41:32 -050083#endif
Matt Spinlere10416e2017-04-10 14:15:53 -050084};
85
Matthew Barth3e1bb272020-05-26 11:09:21 -050086} // namespace control
87} // namespace fan
88} // namespace phosphor