gpio-presence: use aserver property constructor
Directly initialize the 'name' member instead of using a separate call.
This also avoids emitting 'PropertiesChanged' signal, which is not
needed since the ```emit_added()``` call follows directly.
Tested: Unit Tests Pass
Change-Id: I6db7d6196bacb9ee3fc9bb30b8148517870d08c4
Signed-off-by: Alexander Hansen <alexander.hansen@9elements.com>
diff --git a/src/gpio-presence/device_presence.cpp b/src/gpio-presence/device_presence.cpp
index 44d6e6a..1402996 100644
--- a/src/gpio-presence/device_presence.cpp
+++ b/src/gpio-presence/device_presence.cpp
@@ -16,6 +16,9 @@
PHOSPHOR_LOG2_USING;
+using DevicePresenceProperties = sdbusplus::common::xyz::openbmc_project::
+ inventory::source::DevicePresence::properties_t;
+
namespace gpio_presence
{
@@ -89,10 +92,8 @@
info("Detected {NAME} as present, adding dbus interface", "NAME",
deviceName);
- detectedIface =
- std::make_unique<DevicePresenceInterface>(ctx, objPath.str.c_str());
-
- detectedIface->name(deviceName);
+ detectedIface = std::make_unique<DevicePresenceInterface>(
+ ctx, objPath.str.c_str(), DevicePresenceProperties{deviceName});
detectedIface->emit_added();
}