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 
23 #include <cstdint>
24 #include <map>
25 #include <string>
26 #include <unordered_map>
27 #include <variant>
28 #include <vector>
29 
30 using DbusVariantType =
31     std::variant<uint64_t, int64_t, double, std::string, bool,
32                  std::vector<std::string>, std::vector<double>>;
33 
34 using ManagedObjectType = std::unordered_map<
35     sdbusplus::message::object_path,
36     std::unordered_map<std::string,
37                        std::unordered_map<std::string, DbusVariantType>>>;
38 
39 namespace pid_control
40 {
41 namespace dbus_configuration
42 {
43 
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  */
53 bool init(sdbusplus::bus_t& 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 
58 } // namespace dbus_configuration
59 } // namespace pid_control
60