use PDI constants for ObjectMapper
PDI already defines the constants we need here, use those instead of
duplicating.
Tested: Inspection only.
Change-Id: I86ad46a4aac757aa7b377b1e1709088a1e457102
Signed-off-by: Alexander Hansen <alexander.hansen@9elements.com>
diff --git a/libipmid/utils.cpp b/libipmid/utils.cpp
index 02d6758..e2fb65c 100644
--- a/libipmid/utils.cpp
+++ b/libipmid/utils.cpp
@@ -13,6 +13,7 @@
#include <phosphor-logging/lg2.hpp>
#include <sdbusplus/message/types.hpp>
#include <xyz/openbmc_project/Common/error.hpp>
+#include <xyz/openbmc_project/ObjectMapper/common.hpp>
#include <algorithm>
#include <chrono>
@@ -24,6 +25,8 @@
using namespace phosphor::logging;
using namespace sdbusplus::error::xyz::openbmc_project::common;
+using ObjectMapper = sdbusplus::common::xyz::openbmc_project::ObjectMapper;
+
namespace network
{
@@ -200,10 +203,9 @@
std::string getService(sdbusplus::bus_t& bus, const std::string& intf,
const std::string& path)
{
- auto mapperCall =
- bus.new_method_call("xyz.openbmc_project.ObjectMapper",
- "/xyz/openbmc_project/object_mapper",
- "xyz.openbmc_project.ObjectMapper", "GetObject");
+ auto mapperCall = bus.new_method_call(
+ ObjectMapper::default_service, ObjectMapper::instance_path,
+ ObjectMapper::interface, ObjectMapper::method_names::get_object);
mapperCall.append(path);
mapperCall.append(std::vector<std::string>({intf}));
@@ -225,8 +227,9 @@
ObjectTree getSubTree(sdbusplus::bus_t& bus, const InterfaceList& interfaces,
const std::string& subtreePath, int32_t depth)
{
- auto mapperCall = bus.new_method_call(MAPPER_BUS_NAME, MAPPER_OBJ,
- MAPPER_INTF, "GetSubTree");
+ auto mapperCall = bus.new_method_call(
+ ObjectMapper::default_service, ObjectMapper::instance_path,
+ ObjectMapper::interface, ObjectMapper::method_names::get_sub_tree);
mapperCall.append(subtreePath, depth, interfaces);
@@ -283,9 +286,9 @@
boost::system::error_code ec;
std::map<std::string, std::vector<std::string>> mapperResponse =
ctx->bus->yield_method_call<decltype(mapperResponse)>(
- ctx->yield, ec, "xyz.openbmc_project.ObjectMapper",
- "/xyz/openbmc_project/object_mapper",
- "xyz.openbmc_project.ObjectMapper", "GetObject", path,
+ ctx->yield, ec, ObjectMapper::default_service,
+ ObjectMapper::instance_path, ObjectMapper::interface,
+ ObjectMapper::method_names::get_object, path,
std::vector<std::string>({intf}));
if (!ec)
@@ -301,8 +304,10 @@
{
boost::system::error_code ec;
objectTree = ctx->bus->yield_method_call<ObjectTree>(
- ctx->yield, ec, MAPPER_BUS_NAME, MAPPER_OBJ, MAPPER_INTF, "GetSubTree",
- subtreePath, depth, interfaces);
+ ctx->yield, ec, ObjectMapper::default_service,
+ ObjectMapper::instance_path, ObjectMapper::interface,
+ ObjectMapper::method_names::get_sub_tree, subtreePath, depth,
+ interfaces);
return ec;
}