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