James Feist | 139cb57 | 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 | |
Jae Hyun Yoo | f78ec41 | 2018-10-25 10:42:39 -0700 | [diff] [blame] | 9 | const constexpr char* jsonStore = "/var/configuration/flattened.json"; |
| 10 | const constexpr char* inventoryPath = "/xyz/openbmc_project/inventory"; |
| 11 | const constexpr char* entityManagerName = "xyz.openbmc_project.EntityManager"; |
| 12 | const std::regex illegalDbusRegex("[^A-Za-z0-9_]"); |
James Feist | 139cb57 | 2018-09-10 15:26:18 -0700 | [diff] [blame] | 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 | |
Jae Hyun Yoo | f78ec41 | 2018-10-25 10:42:39 -0700 | [diff] [blame] | 26 | bool findFiles(const std::experimental::filesystem::path dirPath, |
| 27 | const std::string& matchString, |
| 28 | std::vector<std::experimental::filesystem::path>& foundPaths, |
| 29 | unsigned int symlinkDepth = 1); |
James Feist | 139cb57 | 2018-09-10 15:26:18 -0700 | [diff] [blame] | 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); |