use sdbusplus unpack syntax
Rather than defining a variable and then reading it from a message,
sdbusplus also supports directly unpack-ing from the message. Use
this syntax instead as it is more efficient and succinct.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I59b1cef85e4e0e5dd14b33a4e1bc15aaef2a8aac
diff --git a/util.cpp b/util.cpp
index e106d26..f2205d2 100644
--- a/util.cpp
+++ b/util.cpp
@@ -104,8 +104,8 @@
properties.append("xyz.openbmc_project.State.Chassis");
properties.append("CurrentPowerState");
auto result = bus.call(properties);
- std::variant<std::string> val;
- result.read(val);
+ auto val = result.unpack<std::variant<std::string>>();
+
if (auto pVal = std::get_if<std::string>(&val))
{
powerState = *pVal;