blob: fd4dde2d18d3d0de9686246144664790bb4c5584 [file] [log] [blame]
James Feist6714a252018-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 Yoo9ced0a32018-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 Feist6714a252018-09-10 15:26:18 -070013
14using BasicVariantType =
James Feistbc896df2018-11-26 16:28:17 -080015 sdbusplus::message::variant<std::vector<std::string>, std::string, int64_t,
16 uint64_t, double, int32_t, uint32_t, int16_t,
17 uint16_t, uint8_t, bool>;
James Feist6714a252018-09-10 15:26:18 -070018
19using ManagedObjectType = boost::container::flat_map<
20 sdbusplus::message::object_path,
21 boost::container::flat_map<
22 std::string,
23 boost::container::flat_map<std::string, BasicVariantType>>>;
24using SensorData = boost::container::flat_map<
25 std::string, boost::container::flat_map<std::string, BasicVariantType>>;
26
Jae Hyun Yoo9ced0a32018-10-25 10:42:39 -070027bool findFiles(const std::experimental::filesystem::path dirPath,
28 const std::string& matchString,
29 std::vector<std::experimental::filesystem::path>& foundPaths,
30 unsigned int symlinkDepth = 1);
James Feist6714a252018-09-10 15:26:18 -070031bool isPowerOn(const std::shared_ptr<sdbusplus::asio::connection>& conn);
32bool getSensorConfiguration(
33 const std::string& type,
34 const std::shared_ptr<sdbusplus::asio::connection>& dbusConnection,
35 ManagedObjectType& resp, bool useCache = false);