Using sdbusplus::asio::getProperty

It simplifies a lot of code and after changing sdbusplus implementation
slightly reduces binary size if used together with:

https://gerrit.openbmc-project.xyz/c/openbmc/sdbusplus/+/49467

* Uncompressed size:    3033148 -> 3012164, -20984 B
* gzip compressed size: 1220586 -> 1214625, -5961 B

Tested:
- Redfish validator output is the same before and after the change

Change-Id: Ibe3227d3f4230de2363ba3d9396e51130c8240a5
Signed-off-by: Jonathan Doman <jonathan.doman@intel.com>
Signed-off-by: Krzysztof Grobelny <krzysztof.grobelny@intel.com>
diff --git a/redfish-core/lib/update_service.hpp b/redfish-core/lib/update_service.hpp
index f5528e1..fde878e 100644
--- a/redfish-core/lib/update_service.hpp
+++ b/redfish-core/lib/update_service.hpp
@@ -21,6 +21,7 @@
 #include <boost/container/flat_map.hpp>
 #include <dbus_utility.hpp>
 #include <registries/privilege_registry.hpp>
+#include <sdbusplus/asio/property.hpp>
 #include <utils/fw_utils.hpp>
 
 namespace redfish
@@ -542,9 +543,12 @@
                 {"TFTP"};
 #endif
             // Get the current ApplyTime value
-            crow::connections::systemBus->async_method_call(
+            sdbusplus::asio::getProperty<std::string>(
+                *crow::connections::systemBus, "xyz.openbmc_project.Settings",
+                "/xyz/openbmc_project/software/apply_time",
+                "xyz.openbmc_project.Software.ApplyTime", "RequestedApplyTime",
                 [asyncResp](const boost::system::error_code ec,
-                            const dbus::utility::DbusVariantType& applyTime) {
+                            const std::string& applyTime) {
                     if (ec)
                     {
                         BMCWEB_LOG_DEBUG << "DBUS response error " << ec;
@@ -552,34 +556,25 @@
                         return;
                     }
 
-                    const std::string* s = std::get_if<std::string>(&applyTime);
-                    if (s == nullptr)
-                    {
-                        return;
-                    }
                     // Store the ApplyTime Value
-                    if (*s ==
-                        "xyz.openbmc_project.Software.ApplyTime.RequestedApplyTimes.Immediate")
+                    if (applyTime == "xyz.openbmc_project.Software.ApplyTime."
+                                     "RequestedApplyTimes.Immediate")
                     {
                         asyncResp->res
                             .jsonValue["HttpPushUriOptions"]
                                       ["HttpPushUriApplyTime"]["ApplyTime"] =
                             "Immediate";
                     }
-                    else if (
-                        *s ==
-                        "xyz.openbmc_project.Software.ApplyTime.RequestedApplyTimes.OnReset")
+                    else if (applyTime ==
+                             "xyz.openbmc_project.Software.ApplyTime."
+                             "RequestedApplyTimes.OnReset")
                     {
                         asyncResp->res
                             .jsonValue["HttpPushUriOptions"]
                                       ["HttpPushUriApplyTime"]["ApplyTime"] =
                             "OnReset";
                     }
-                },
-                "xyz.openbmc_project.Settings",
-                "/xyz/openbmc_project/software/apply_time",
-                "org.freedesktop.DBus.Properties", "Get",
-                "xyz.openbmc_project.Software.ApplyTime", "RequestedApplyTime");
+                });
         });
     BMCWEB_ROUTE(app, "/redfish/v1/UpdateService/")
         .privileges(redfish::privileges::patchUpdateService)