blob: 5e43de013ae9a66d7979a302b486889da1da4401 [file] [log] [blame]
Matthew Barthd87f89f2020-07-30 10:41:32 -05001/**
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 Barthfcfa0522020-08-24 16:40:24 -050018#include "json/fan.hpp"
Matthew Bartha227a162020-08-05 10:51:45 -050019#include "json/manager.hpp"
Matthew Barth2331d182020-08-18 15:00:27 -050020#include "json/profile.hpp"
Matthew Barth23ac24c2020-08-04 13:55:43 -050021#include "types.hpp"
22
23#include <sdbusplus/bus.hpp>
24
Matthew Barthd87f89f2020-07-30 10:41:32 -050025namespace phosphor::fan::control
Matthew Barth23ac24c2020-08-04 13:55:43 -050026{
27
28const std::vector<ZoneGroup> getZoneGroups(sdbusplus::bus::bus& bus)
29{
30 std::vector<ZoneGroup> zoneGrps;
31
Matthew Barth2331d182020-08-18 15:00:27 -050032 // Profiles are optional
33 auto profiles = getConfig<json::Profile>(bus, true);
Matthew Barthfcfa0522020-08-24 16:40:24 -050034 // Fans to be controlled
35 auto fans = getConfig<json::Fan>(bus);
Matthew Barth2331d182020-08-18 15:00:27 -050036
37 // TODO Create zone groups after loading all JSON config files
38
Matthew Barth23ac24c2020-08-04 13:55:43 -050039 return zoneGrps;
40}
41
Matthew Barth2dc5aba2020-08-04 14:23:34 -050042const unsigned int getPowerOnDelay(sdbusplus::bus::bus& bus)
43{
Matthew Bartha227a162020-08-05 10:51:45 -050044 json::Manager mgr{bus};
45 return mgr.getPowerOnDelay();
Matthew Barth2dc5aba2020-08-04 14:23:34 -050046}
47
Matthew Barth23ac24c2020-08-04 13:55:43 -050048} // namespace phosphor::fan::control