1 #pragma once 2 #include <vector> 3 #include <sdbusplus/bus.hpp> 4 #include "fan.hpp" 5 #include "types.hpp" 6 7 namespace phosphor 8 { 9 namespace fan 10 { 11 namespace control 12 { 13 14 /** 15 * @class Represents a fan control zone, which is a group of fans 16 * that behave the same. 17 */ 18 class Zone 19 { 20 public: 21 22 Zone() = delete; 23 Zone(const Zone&) = delete; 24 Zone(Zone&&) = default; 25 Zone& operator=(const Zone&) = delete; 26 Zone& operator=(Zone&&) = delete; 27 ~Zone() = default; 28 29 /** 30 * Constructor 31 * Creates the appropriate fan objects based on 32 * the zone definition data passed in. 33 * 34 * @param[in] bus - the dbus object 35 * @param[in] def - the fan zone definition data 36 */ 37 Zone(sdbusplus::bus::bus& bus, 38 const ZoneDefinition& def); 39 40 /** 41 * Sets all fans in the zone to the speed 42 * passed in 43 * 44 * @param[in] speed - the fan speed 45 */ 46 void setSpeed(uint64_t speed); 47 48 /** 49 * Sets the zone to full speed 50 */ 51 inline void setFullSpeed() 52 { 53 if (_fullSpeed != 0) 54 { 55 setSpeed(_fullSpeed); 56 } 57 } 58 59 private: 60 61 /** 62 * The dbus object 63 */ 64 sdbusplus::bus::bus& _bus; 65 66 /** 67 * Full speed for the zone 68 */ 69 const uint64_t _fullSpeed; 70 71 /** 72 * The zone number 73 */ 74 const size_t _zoneNum; 75 76 /** 77 * The vector of fans in this zone 78 */ 79 std::vector<std::unique_ptr<Fan>> _fans; 80 }; 81 82 } 83 } 84 } 85