blob: 8d9eac5cee82399b8986c7579c496583e08ef6c9 [file] [log] [blame]
James Feist139cb572018-09-10 15:26:18 -07001#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 Yoof78ec412018-10-25 10:42:39 -07009const constexpr char* jsonStore = "/var/configuration/flattened.json";
10const constexpr char* inventoryPath = "/xyz/openbmc_project/inventory";
11const constexpr char* entityManagerName = "xyz.openbmc_project.EntityManager";
12const std::regex illegalDbusRegex("[^A-Za-z0-9_]");
James Feist139cb572018-09-10 15:26:18 -070013
14using 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
18using 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>>>;
23using SensorData = boost::container::flat_map<
24 std::string, boost::container::flat_map<std::string, BasicVariantType>>;
25
Jae Hyun Yoof78ec412018-10-25 10:42:39 -070026bool 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 Feist139cb572018-09-10 15:26:18 -070030bool isPowerOn(const std::shared_ptr<sdbusplus::asio::connection>& conn);
31bool getSensorConfiguration(
32 const std::string& type,
33 const std::shared_ptr<sdbusplus::asio::connection>& dbusConnection,
34 ManagedObjectType& resp, bool useCache = false);