blob: deb5eeef7f6a66963eda341129b4b6db512fa791 [file] [log] [blame]
#include "config.h"
#include "utils.hpp"
#include <fstream>
namespace utils
{
namespace // anonymous
{
constexpr auto MAPPER_BUSNAME = "xyz.openbmc_project.ObjectMapper";
constexpr auto MAPPER_PATH = "/xyz/openbmc_project/object_mapper";
constexpr auto MAPPER_INTERFACE = "xyz.openbmc_project.ObjectMapper";
} // namespace
std::vector<std::string> getPSUInventoryPath(sdbusplus::bus::bus& bus)
{
std::vector<std::string> paths;
auto method = bus.new_method_call(MAPPER_BUSNAME, MAPPER_PATH,
MAPPER_INTERFACE, "GetSubTreePaths");
method.append(PSU_INVENTORY_PATH_BASE);
method.append(0); // Depth 0 to search all
method.append(std::vector<std::string>({PSU_INVENTORY_IFACE}));
auto reply = bus.call(method);
reply.read(paths);
return paths;
}
} // namespace utils