xref: /openbmc/phosphor-pid-control/dbus/dbusconfiguration.hpp (revision f8b6e55147148c3cfb42327ff267197a460b411c)
1 /*
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 */
16 #pragma once
17 
18 #include "conf.hpp"
19 
20 #include <boost/asio/steady_timer.hpp>
21 #include <sdbusplus/bus.hpp>
22 #include <sdbusplus/message/native_types.hpp>
23 
24 #include <cstdint>
25 #include <map>
26 #include <string>
27 #include <unordered_map>
28 #include <variant>
29 #include <vector>
30 
31 using DbusVariantType =
32     std::variant<uint64_t, int64_t, double, std::string, bool,
33                  std::vector<std::string>, std::vector<double>>;
34 
35 using ManagedObjectType = std::unordered_map<
36     sdbusplus::message::object_path,
37     std::unordered_map<std::string,
38                        std::unordered_map<std::string, DbusVariantType>>>;
39 
40 namespace pid_control
41 {
42 namespace dbus_configuration
43 {
44 
45 /**
46  * Initialize a dbus-based configuration.
47  *
48  * @param bus - the sdbusplus connection to use
49  * @param timer - the timer to use
50  * @param sensorConfig - The configuration converted sensor list.
51  * @param zoneConfig - The configuration converted PID list.
52  * @param zoneDetailsConfig - The configuration converted Zone configuration.
53  */
54 bool init(sdbusplus::bus_t& bus, boost::asio::steady_timer& timer,
55           std::map<std::string, conf::SensorConfig>& sensorConfig,
56           std::map<int64_t, conf::PIDConf>& zoneConfig,
57           std::map<int64_t, conf::ZoneConfig>& zoneDetailsConfig);
58 
59 } // namespace dbus_configuration
60 } // namespace pid_control
61