James Feist | 6714a25 | 2018-09-10 15:26:18 -0700 | [diff] [blame^] | 1 | #pragma once |
| 2 | #include <boost/container/flat_map.hpp> |
| 3 | #include <experimental/filesystem> |
| 4 | #include <iostream> |
| 5 | #include <regex> |
| 6 | #include <sdbusplus/asio/connection.hpp> |
| 7 | #include <sdbusplus/message/types.hpp> |
| 8 | |
| 9 | const constexpr char* JSON_STORE = "/var/configuration/flattened.json"; |
| 10 | const constexpr char* INVENTORY_PATH = "/xyz/openbmc_project/inventory"; |
| 11 | const constexpr char* ENTITY_MANAGER_NAME = "xyz.openbmc_project.EntityManager"; |
| 12 | const std::regex ILLEGAL_DBUS_REGEX("[^A-Za-z0-9_]"); |
| 13 | |
| 14 | using BasicVariantType = |
| 15 | sdbusplus::message::variant<std::string, int64_t, uint64_t, double, int32_t, |
| 16 | uint32_t, int16_t, uint16_t, uint8_t, bool>; |
| 17 | |
| 18 | using ManagedObjectType = boost::container::flat_map< |
| 19 | sdbusplus::message::object_path, |
| 20 | boost::container::flat_map< |
| 21 | std::string, |
| 22 | boost::container::flat_map<std::string, BasicVariantType>>>; |
| 23 | using SensorData = boost::container::flat_map< |
| 24 | std::string, boost::container::flat_map<std::string, BasicVariantType>>; |
| 25 | |
| 26 | bool find_files(const std::experimental::filesystem::path dir_path, |
| 27 | const std::string& match_string, |
| 28 | std::vector<std::experimental::filesystem::path>& found_paths, |
| 29 | unsigned int symlink_depth = 1); |
| 30 | bool isPowerOn(const std::shared_ptr<sdbusplus::asio::connection>& conn); |
| 31 | bool getSensorConfiguration( |
| 32 | const std::string& type, |
| 33 | const std::shared_ptr<sdbusplus::asio::connection>& dbusConnection, |
| 34 | ManagedObjectType& resp, bool useCache = false); |