Lei YU | 5e0dcb3 | 2019-08-02 18:04:34 +0800 | [diff] [blame^] | 1 | #include "config.h" |
| 2 | |
| 3 | #include "utils.hpp" |
| 4 | |
| 5 | #include <fstream> |
| 6 | |
| 7 | namespace utils |
| 8 | { |
| 9 | |
| 10 | namespace // anonymous |
| 11 | { |
| 12 | constexpr auto MAPPER_BUSNAME = "xyz.openbmc_project.ObjectMapper"; |
| 13 | constexpr auto MAPPER_PATH = "/xyz/openbmc_project/object_mapper"; |
| 14 | constexpr auto MAPPER_INTERFACE = "xyz.openbmc_project.ObjectMapper"; |
| 15 | } // namespace |
| 16 | |
| 17 | std::vector<std::string> getPSUInventoryPath(sdbusplus::bus::bus& bus) |
| 18 | { |
| 19 | std::vector<std::string> paths; |
| 20 | auto method = bus.new_method_call(MAPPER_BUSNAME, MAPPER_PATH, |
| 21 | MAPPER_INTERFACE, "GetSubTreePaths"); |
| 22 | method.append(PSU_INVENTORY_PATH_BASE); |
| 23 | method.append(0); // Depth 0 to search all |
| 24 | method.append(std::vector<std::string>({PSU_INVENTORY_IFACE})); |
| 25 | auto reply = bus.call(method); |
| 26 | |
| 27 | reply.read(paths); |
| 28 | return paths; |
| 29 | } |
| 30 | |
| 31 | } // namespace utils |