Matthew Barth | d87f89f | 2020-07-30 10:41:32 -0500 | [diff] [blame] | 1 | /** |
| 2 | * Copyright © 2020 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 "json_parser.hpp" |
| 17 | |
Matthew Barth | fcfa052 | 2020-08-24 16:40:24 -0500 | [diff] [blame] | 18 | #include "json/fan.hpp" |
Matthew Barth | dfd4a05 | 2020-09-02 16:31:51 -0500 | [diff] [blame^] | 19 | #include "json/group.hpp" |
Matthew Barth | a227a16 | 2020-08-05 10:51:45 -0500 | [diff] [blame] | 20 | #include "json/manager.hpp" |
Matthew Barth | 2331d18 | 2020-08-18 15:00:27 -0500 | [diff] [blame] | 21 | #include "json/profile.hpp" |
Matthew Barth | 4f0d3b7 | 2020-08-27 14:32:15 -0500 | [diff] [blame] | 22 | #include "json/zone.hpp" |
Matthew Barth | 23ac24c | 2020-08-04 13:55:43 -0500 | [diff] [blame] | 23 | #include "types.hpp" |
| 24 | |
| 25 | #include <sdbusplus/bus.hpp> |
| 26 | |
Matthew Barth | d87f89f | 2020-07-30 10:41:32 -0500 | [diff] [blame] | 27 | namespace phosphor::fan::control |
Matthew Barth | 23ac24c | 2020-08-04 13:55:43 -0500 | [diff] [blame] | 28 | { |
| 29 | |
| 30 | const std::vector<ZoneGroup> getZoneGroups(sdbusplus::bus::bus& bus) |
| 31 | { |
| 32 | std::vector<ZoneGroup> zoneGrps; |
| 33 | |
Matthew Barth | 2331d18 | 2020-08-18 15:00:27 -0500 | [diff] [blame] | 34 | // Profiles are optional |
| 35 | auto profiles = getConfig<json::Profile>(bus, true); |
Matthew Barth | fcfa052 | 2020-08-24 16:40:24 -0500 | [diff] [blame] | 36 | // Fans to be controlled |
| 37 | auto fans = getConfig<json::Fan>(bus); |
Matthew Barth | 4f0d3b7 | 2020-08-27 14:32:15 -0500 | [diff] [blame] | 38 | // Zones within the system |
| 39 | auto zones = getConfig<json::Zone>(bus); |
Matthew Barth | dfd4a05 | 2020-09-02 16:31:51 -0500 | [diff] [blame^] | 40 | // Groups to include in events |
| 41 | auto groups = getConfig<json::Group>(bus); |
Matthew Barth | 2331d18 | 2020-08-18 15:00:27 -0500 | [diff] [blame] | 42 | |
| 43 | // TODO Create zone groups after loading all JSON config files |
| 44 | |
Matthew Barth | 23ac24c | 2020-08-04 13:55:43 -0500 | [diff] [blame] | 45 | return zoneGrps; |
| 46 | } |
| 47 | |
Matthew Barth | 2dc5aba | 2020-08-04 14:23:34 -0500 | [diff] [blame] | 48 | const unsigned int getPowerOnDelay(sdbusplus::bus::bus& bus) |
| 49 | { |
Matthew Barth | a227a16 | 2020-08-05 10:51:45 -0500 | [diff] [blame] | 50 | json::Manager mgr{bus}; |
| 51 | return mgr.getPowerOnDelay(); |
Matthew Barth | 2dc5aba | 2020-08-04 14:23:34 -0500 | [diff] [blame] | 52 | } |
| 53 | |
Matthew Barth | 23ac24c | 2020-08-04 13:55:43 -0500 | [diff] [blame] | 54 | } // namespace phosphor::fan::control |