blob: 318da6833d5cdf1f4712440e96c31d4ccd6b1279 [file] [log] [blame]
James Feist7136a5a2018-07-19 09:52:05 -07001/*
2// Copyright (c) 2018 Intel 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*/
James Feist7136a5a2018-07-19 09:52:05 -070016#pragma once
Patrick Venture7e952d92020-10-05 15:58:52 -070017
Patrick Venture07716592018-10-14 11:46:40 -070018#include "conf.hpp"
19
Patrick Venture7f837e02020-09-10 15:07:37 -070020#include <boost/asio/steady_timer.hpp>
James Feist7136a5a2018-07-19 09:52:05 -070021#include <sdbusplus/bus.hpp>
22
Patrick Venture7e952d92020-10-05 15:58:52 -070023#include <cstdint>
Patrick Venture73823182020-10-08 15:12:51 -070024#include <map>
Patrick Venture7e952d92020-10-05 15:58:52 -070025#include <string>
26#include <unordered_map>
27#include <variant>
28#include <vector>
29
30using DbusVariantType =
Alex.Song8f73ad72021-10-07 00:18:27 +080031 std::variant<uint64_t, int64_t, double, std::string, bool,
Patrick Venture7e952d92020-10-05 15:58:52 -070032 std::vector<std::string>, std::vector<double>>;
33
34using ManagedObjectType = std::unordered_map<
35 sdbusplus::message::object_path,
36 std::unordered_map<std::string,
37 std::unordered_map<std::string, DbusVariantType>>>;
38
Patrick Venturea0764872020-08-08 07:48:43 -070039namespace pid_control
40{
James Feist7136a5a2018-07-19 09:52:05 -070041namespace dbus_configuration
42{
Patrick Venture73823182020-10-08 15:12:51 -070043
44/**
45 * Initialize a dbus-based configuration.
46 *
47 * @param bus - the sdbusplus connection to use
48 * @param timer - the timer to use
49 * @param sensorConfig - The configuration converted sensor list.
50 * @param zoneConfig - The configuration converted PID list.
51 * @param zoneDetailsConfig - The configuration converted Zone configuration.
52 */
53bool init(sdbusplus::bus::bus& bus, boost::asio::steady_timer& timer,
54 std::map<std::string, conf::SensorConfig>& sensorConfig,
55 std::map<int64_t, conf::PIDConf>& zoneConfig,
56 std::map<int64_t, conf::ZoneConfig>& zoneDetailsConfig);
57
Patrick Venture07716592018-10-14 11:46:40 -070058} // namespace dbus_configuration
Patrick Venturea0764872020-08-08 07:48:43 -070059} // namespace pid_control