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/chassis_state_manager.cpp b/chassis_state_manager.cpp
index 0215535..9e298e9 100644
--- a/chassis_state_manager.cpp
+++ b/chassis_state_manager.cpp
@@ -270,8 +270,7 @@
using Property = std::string;
using Value = std::variant<bool, uint>;
using PropertyMap = std::map<Property, Value>;
- PropertyMap properties;
- response.read(properties);
+ auto properties = response.unpack<PropertyMap>();
if (std::get<uint>(properties["Type"]) != TYPE_UPS)
{
@@ -374,8 +373,7 @@
using Property = std::string;
using Value = std::variant<std::string>;
using PropertyMap = std::map<Property, Value>;
- PropertyMap properties;
- response.read(properties);
+ auto properties = response.unpack<PropertyMap>();
auto statusStr = std::get<std::string>(properties["Status"]);
auto status =