used sdbusplus::unpackPropertiesNoThrow part 7

used sdbusplus::unpackPropertiesNoThrow in cable.hpp,
metric_report_definition.hpp, telemetry_service.hpp and trigger.hpp,
also replaced all usages of "GetAll" with
sdbusplus::asio::getAllProperties

    bmcweb size: 2697624 -> 2693528 (-4096)
compressed size: 1129037 -> 1129322 (+285)

Tested:
  Performed get on one of the:
  - /redfish/v1/Cables
  - /redfish/v1/TelemetryService/MetricReportDefinitions
  - /redfish/v1/TelemetryService/Triggers
    (trigger was added using Dbus API)

  Get result before and after the change was in same format.

Change-Id: I24f001b4f52d8eb5f529b08de278a611f8fa22b2
Signed-off-by: Krzysztof Grobelny <krzysztof.grobelny@intel.com>
diff --git a/redfish-core/lib/telemetry_service.hpp b/redfish-core/lib/telemetry_service.hpp
index 72a1e1d..afedbc6 100644
--- a/redfish-core/lib/telemetry_service.hpp
+++ b/redfish-core/lib/telemetry_service.hpp
@@ -6,6 +6,9 @@
 #include <dbus_utility.hpp>
 #include <query.hpp>
 #include <registries/privilege_registry.hpp>
+#include <sdbusplus/asio/property.hpp>
+#include <sdbusplus/unpack_properties.hpp>
+#include <utils/dbus_utils.hpp>
 
 namespace redfish
 {
@@ -31,7 +34,10 @@
     asyncResp->res.jsonValue["Triggers"]["@odata.id"] =
         "/redfish/v1/TelemetryService/Triggers";
 
-    crow::connections::systemBus->async_method_call(
+    sdbusplus::asio::getAllProperties(
+        *crow::connections::systemBus, telemetry::service,
+        "/xyz/openbmc_project/Telemetry/Reports",
+        "xyz.openbmc_project.Telemetry.ReportManager",
         [asyncResp](const boost::system::error_code ec,
                     const dbus::utility::DBusPropertiesMap& ret) {
         if (ec == boost::system::errc::host_unreachable)
@@ -50,32 +56,29 @@
 
         const size_t* maxReports = nullptr;
         const uint64_t* minInterval = nullptr;
-        for (const auto& [key, var] : ret)
+
+        const bool success = sdbusplus::unpackPropertiesNoThrow(
+            dbus_utils::UnpackErrorPrinter(), ret, "MaxReports", maxReports,
+            "MinInterval", minInterval);
+
+        if (!success)
         {
-            if (key == "MaxReports")
-            {
-                maxReports = std::get_if<size_t>(&var);
-            }
-            else if (key == "MinInterval")
-            {
-                minInterval = std::get_if<uint64_t>(&var);
-            }
-        }
-        if (maxReports == nullptr || minInterval == nullptr)
-        {
-            BMCWEB_LOG_ERROR << "Property type mismatch or property is missing";
             messages::internalError(asyncResp->res);
             return;
         }
 
-        asyncResp->res.jsonValue["MaxReports"] = *maxReports;
-        asyncResp->res.jsonValue["MinCollectionInterval"] =
-            time_utils::toDurationString(
-                std::chrono::milliseconds(static_cast<time_t>(*minInterval)));
-        },
-        telemetry::service, "/xyz/openbmc_project/Telemetry/Reports",
-        "org.freedesktop.DBus.Properties", "GetAll",
-        "xyz.openbmc_project.Telemetry.ReportManager");
+        if (maxReports != nullptr)
+        {
+            asyncResp->res.jsonValue["MaxReports"] = *maxReports;
+        }
+
+        if (minInterval != nullptr)
+        {
+            asyncResp->res.jsonValue["MinCollectionInterval"] =
+                time_utils::toDurationString(std::chrono::milliseconds(
+                    static_cast<time_t>(*minInterval)));
+        }
+        });
 }
 
 inline void requestRoutesTelemetryService(App& app)