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: I5ff2aa545ba88d06ea6ac95b83a329c7dfe8594e
diff --git a/host_check.cpp b/host_check.cpp
index bc1ade1..436bd92 100644
--- a/host_check.cpp
+++ b/host_check.cpp
@@ -98,8 +98,9 @@
HostFirmware::property_names::current_firmware_condition);
auto response = bus.call(method);
- std::variant<HostFirmware::FirmwareCondition> currentFwCondV;
- response.read(currentFwCondV);
+ auto currentFwCondV = response.unpack<
+ std::variant<HostFirmware::FirmwareCondition>>();
+
auto currentFwCond =
std::get<HostFirmware::FirmwareCondition>(currentFwCondV);
@@ -141,8 +142,8 @@
Chassis::property_names::current_power_state);
auto response = bus.call(method);
- std::variant<Chassis::PowerState> currentPowerStateV;
- response.read(currentPowerStateV);
+ auto currentPowerStateV =
+ response.unpack<std::variant<Chassis::PowerState>>();
auto currentPowerState =
std::get<Chassis::PowerState>(currentPowerStateV);