reduce dbus string constants
There are a large number of dbus constants scattered throughout the
code that could/should be obtained from phosphor-dbus-interface values.
Perform minor refactoring to greatly reduce the number of string
constants.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: Ie8700bc90611d21eee7160f4686bc978fe0a0eb4
diff --git a/systemd_target_signal.cpp b/systemd_target_signal.cpp
index 8c76b97..2014045 100644
--- a/systemd_target_signal.cpp
+++ b/systemd_target_signal.cpp
@@ -8,6 +8,8 @@
#include <sdbusplus/server/manager.hpp>
#include <sdeventplus/event.hpp>
#include <xyz/openbmc_project/Common/error.hpp>
+#include <xyz/openbmc_project/Logging/Create/client.hpp>
+#include <xyz/openbmc_project/Logging/Entry/client.hpp>
namespace phosphor
{
@@ -21,6 +23,10 @@
using sdbusplus::xyz::openbmc_project::Common::Error::InternalFailure;
+using LoggingCreate =
+ sdbusplus::client::xyz::openbmc_project::logging::Create<>;
+using LoggingEntry = sdbusplus::client::xyz::openbmc_project::logging::Entry<>;
+
void SystemdTargetLogging::startBmcQuiesceTarget()
{
auto method = this->bus.new_method_call(
@@ -49,15 +55,15 @@
const std::string& result,
const std::string& unit)
{
- auto method = this->bus.new_method_call(
- "xyz.openbmc_project.Logging", "/xyz/openbmc_project/logging",
- "xyz.openbmc_project.Logging.Create", "Create");
+ auto method = this->bus.new_method_call(LoggingCreate::default_service,
+ LoggingCreate::instance_path,
+ LoggingCreate::interface, "Create");
// Signature is ssa{ss}
- method.append(errorLog);
- method.append("xyz.openbmc_project.Logging.Entry.Level.Critical");
- method.append(std::array<std::pair<std::string, std::string>, 2>(
- {std::pair<std::string, std::string>({"SYSTEMD_RESULT", result}),
- std::pair<std::string, std::string>({"SYSTEMD_UNIT", unit})}));
+ method.append(
+ errorLog, LoggingEntry::Level::Critical,
+ std::array<std::pair<std::string, std::string>, 2>(
+ {std::pair<std::string, std::string>({"SYSTEMD_RESULT", result}),
+ std::pair<std::string, std::string>({"SYSTEMD_UNIT", unit})}));
try
{
this->bus.call_noreply(method);