1 /**
2  * Copyright © 2017 IBM Corporation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 #include "zone.hpp"
17 
18 namespace phosphor
19 {
20 namespace fan
21 {
22 namespace control
23 {
24 
25 
26 Zone::Zone(sdbusplus::bus::bus& bus,
27            const ZoneDefinition& def) :
28     _bus(bus),
29     _fullSpeed(std::get<fullSpeedPos>(def)),
30     _zoneNum(std::get<zoneNumPos>(def))
31 {
32     auto& fanDefs = std::get<fanListPos>(def);
33 
34     for (auto& def : fanDefs)
35     {
36         _fans.emplace_back(std::make_unique<Fan>(bus, def));
37     }
38 }
39 
40 
41 void Zone::setSpeed(uint64_t speed)
42 {
43     for (auto& fan : _fans)
44     {
45         fan->setSpeed(speed);
46     }
47 }
48 
49 }
50 }
51 }
52