blob: d5b75fcd6acc251d7f399f118e5802d2ac1429de [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>
6#include "types.hpp"
Matt Spinler57352a32017-04-10 14:48:35 -05007#include "zone.hpp"
Matt Spinlere10416e2017-04-10 14:15:53 -05008
9namespace phosphor
10{
11namespace fan
12{
13namespace control
14{
15
Matt Spinler57352a32017-04-10 14:48:35 -050016using ZoneMap = std::map<unsigned int,
17 std::unique_ptr<Zone>>;
18
Matt Spinlere10416e2017-04-10 14:15:53 -050019/**
20 * @class Fan control manager
21 */
22class Manager
23{
24 public:
25
26 Manager() = delete;
27 Manager(const Manager&) = delete;
28 Manager(Manager&&) = default;
29 Manager& operator=(const Manager&) = delete;
30 Manager& operator=(Manager&&) = delete;
31 ~Manager() = default;
32
33 /**
34 * Constructor
35 * Creates the Zone objects based on the
36 * _zoneLayouts data.
37 *
38 * @param[in] bus - The dbus object
Matthew Barth8600d9a2017-06-23 14:38:05 -050039 * @param[in] events - The sd_event pointer
Matt Spinleree7f6422017-05-09 11:03:14 -050040 * @param[in] mode - The control mode
Matt Spinlere10416e2017-04-10 14:15:53 -050041 */
Matt Spinleree7f6422017-05-09 11:03:14 -050042 Manager(sdbusplus::bus::bus& bus,
Matthew Barth8600d9a2017-06-23 14:38:05 -050043 phosphor::fan::event::EventPtr& events,
Matt Spinleree7f6422017-05-09 11:03:14 -050044 Mode mode);
45
46 /**
47 * Does the fan control inititialization, which is
48 * setting fans to full, delaying so they
49 * can get there, and starting a target.
50 */
51 void doInit();
Matt Spinlere10416e2017-04-10 14:15:53 -050052
53 private:
54
55 /**
Matt Spinleree7f6422017-05-09 11:03:14 -050056 * Starts the obmc-fan-control-ready dbus target
57 */
58 void startFanControlReadyTarget();
59
60 /**
Matt Spinlere10416e2017-04-10 14:15:53 -050061 * The dbus object
62 */
63 sdbusplus::bus::bus& _bus;
64
65 /**
Matt Spinler57352a32017-04-10 14:48:35 -050066 * The fan zones in the system
67 */
68 ZoneMap _zones;
69
70 /**
Matt Spinlere10416e2017-04-10 14:15:53 -050071 * The fan zone layout for the system.
72 * This is generated data.
73 */
74 static const std::vector<ZoneGroup> _zoneLayouts;
Matt Spinleree7f6422017-05-09 11:03:14 -050075
76 /**
77 * The number of seconds to delay after
78 * fans get set to high speed on a power on
79 * to give them a chance to get there.
80 */
81 static const unsigned int _powerOnDelay;
Matt Spinlere10416e2017-04-10 14:15:53 -050082};
83
84
85}
86}
87}