Matt Spinler | e10416e | 2017-04-10 14:15:53 -0500 | [diff] [blame] | 1 | #pragma once |
| 2 | |
| 3 | #include <memory> |
| 4 | #include <vector> |
| 5 | #include <sdbusplus/bus.hpp> |
| 6 | #include "types.hpp" |
Matt Spinler | 57352a3 | 2017-04-10 14:48:35 -0500 | [diff] [blame] | 7 | #include "zone.hpp" |
Matt Spinler | e10416e | 2017-04-10 14:15:53 -0500 | [diff] [blame] | 8 | |
| 9 | namespace phosphor |
| 10 | { |
| 11 | namespace fan |
| 12 | { |
| 13 | namespace control |
| 14 | { |
| 15 | |
Matt Spinler | 57352a3 | 2017-04-10 14:48:35 -0500 | [diff] [blame] | 16 | using ZoneMap = std::map<unsigned int, |
| 17 | std::unique_ptr<Zone>>; |
| 18 | |
Matt Spinler | e10416e | 2017-04-10 14:15:53 -0500 | [diff] [blame] | 19 | /** |
| 20 | * @class Fan control manager |
| 21 | */ |
| 22 | class 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 Barth | 8600d9a | 2017-06-23 14:38:05 -0500 | [diff] [blame] | 39 | * @param[in] events - The sd_event pointer |
Matt Spinler | ee7f642 | 2017-05-09 11:03:14 -0500 | [diff] [blame] | 40 | * @param[in] mode - The control mode |
Matt Spinler | e10416e | 2017-04-10 14:15:53 -0500 | [diff] [blame] | 41 | */ |
Matt Spinler | ee7f642 | 2017-05-09 11:03:14 -0500 | [diff] [blame] | 42 | Manager(sdbusplus::bus::bus& bus, |
Matthew Barth | 8600d9a | 2017-06-23 14:38:05 -0500 | [diff] [blame] | 43 | phosphor::fan::event::EventPtr& events, |
Matt Spinler | ee7f642 | 2017-05-09 11:03:14 -0500 | [diff] [blame] | 44 | 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 Spinler | e10416e | 2017-04-10 14:15:53 -0500 | [diff] [blame] | 52 | |
| 53 | private: |
| 54 | |
| 55 | /** |
| 56 | * The dbus object |
| 57 | */ |
| 58 | sdbusplus::bus::bus& _bus; |
| 59 | |
| 60 | /** |
Matt Spinler | 57352a3 | 2017-04-10 14:48:35 -0500 | [diff] [blame] | 61 | * The fan zones in the system |
| 62 | */ |
| 63 | ZoneMap _zones; |
| 64 | |
| 65 | /** |
Matt Spinler | e10416e | 2017-04-10 14:15:53 -0500 | [diff] [blame] | 66 | * The fan zone layout for the system. |
| 67 | * This is generated data. |
| 68 | */ |
| 69 | static const std::vector<ZoneGroup> _zoneLayouts; |
Matt Spinler | ee7f642 | 2017-05-09 11:03:14 -0500 | [diff] [blame] | 70 | |
| 71 | /** |
| 72 | * The number of seconds to delay after |
| 73 | * fans get set to high speed on a power on |
| 74 | * to give them a chance to get there. |
| 75 | */ |
| 76 | static const unsigned int _powerOnDelay; |
Matt Spinler | e10416e | 2017-04-10 14:15:53 -0500 | [diff] [blame] | 77 | }; |
| 78 | |
| 79 | |
| 80 | } |
| 81 | } |
| 82 | } |