| James Feist | 7136a5a | 2018-07-19 09:52:05 -0700 | [diff] [blame] | 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 | */ | 
| James Feist | 7136a5a | 2018-07-19 09:52:05 -0700 | [diff] [blame] | 16 | #pragma once | 
| Patrick Venture | 7e952d9 | 2020-10-05 15:58:52 -0700 | [diff] [blame] | 17 |  | 
| Patrick Venture | 0771659 | 2018-10-14 11:46:40 -0700 | [diff] [blame] | 18 | #include "conf.hpp" | 
 | 19 |  | 
| Patrick Venture | 7f837e0 | 2020-09-10 15:07:37 -0700 | [diff] [blame] | 20 | #include <boost/asio/steady_timer.hpp> | 
| James Feist | 7136a5a | 2018-07-19 09:52:05 -0700 | [diff] [blame] | 21 | #include <sdbusplus/bus.hpp> | 
 | 22 |  | 
| Patrick Venture | 7e952d9 | 2020-10-05 15:58:52 -0700 | [diff] [blame] | 23 | #include <cstdint> | 
| Patrick Venture | 7382318 | 2020-10-08 15:12:51 -0700 | [diff] [blame] | 24 | #include <map> | 
| Patrick Venture | 7e952d9 | 2020-10-05 15:58:52 -0700 | [diff] [blame] | 25 | #include <string> | 
 | 26 | #include <unordered_map> | 
 | 27 | #include <variant> | 
 | 28 | #include <vector> | 
 | 29 |  | 
 | 30 | using DbusVariantType = | 
| Alex.Song | 8f73ad7 | 2021-10-07 00:18:27 +0800 | [diff] [blame] | 31 |     std::variant<uint64_t, int64_t, double, std::string, bool, | 
| Patrick Venture | 7e952d9 | 2020-10-05 15:58:52 -0700 | [diff] [blame] | 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 |  | 
| Patrick Venture | a076487 | 2020-08-08 07:48:43 -0700 | [diff] [blame] | 39 | namespace pid_control | 
 | 40 | { | 
| James Feist | 7136a5a | 2018-07-19 09:52:05 -0700 | [diff] [blame] | 41 | namespace dbus_configuration | 
 | 42 | { | 
| Patrick Venture | 7382318 | 2020-10-08 15:12:51 -0700 | [diff] [blame] | 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 |  */ | 
| Patrick Williams | b228bc3 | 2022-07-22 19:26:56 -0500 | [diff] [blame] | 53 | bool init(sdbusplus::bus_t& bus, boost::asio::steady_timer& timer, | 
| Patrick Venture | 7382318 | 2020-10-08 15:12:51 -0700 | [diff] [blame] | 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 Venture | 0771659 | 2018-10-14 11:46:40 -0700 | [diff] [blame] | 58 | } // namespace dbus_configuration | 
| Patrick Venture | a076487 | 2020-08-08 07:48:43 -0700 | [diff] [blame] | 59 | } // namespace pid_control |