Move getProperty calls to utility

Having all dbus calls run through the same utility reduces the amount of
generated code, and more importantly, gives us a place where we can log
the requests and responses to help with debugging.

Tested: Redfish service validator passes.

Change-Id: Ic1bf45130b5069cd57f7af26e12c8d3159c87c67
Signed-off-by: Ed Tanous <etanous@nvidia.com>
diff --git a/include/dbus_utility.hpp b/include/dbus_utility.hpp
index efeb2a0..68b3930 100644
--- a/include/dbus_utility.hpp
+++ b/include/dbus_utility.hpp
@@ -140,13 +140,57 @@
     return count >= index;
 }
 
+inline void
+    getAllProperties(const std::string& service, const std::string& objectPath,
+                     const std::string& interface,
+                     std::function<void(const boost::system::error_code&,
+                                        const DBusPropertiesMap&)>&& callback)
+{
+    sdbusplus::asio::getAllProperties(*crow::connections::systemBus, service,
+                                      objectPath, interface,
+                                      std::move(callback));
+}
+
+template <typename PropertyType>
+inline void getProperty(
+    const std::string& service, const std::string& objectPath,
+    const std::string& interface, const std::string& propertyName,
+    std::function<void(const boost::system::error_code&, const PropertyType&)>&&
+        callback)
+{
+    sdbusplus::asio::getProperty<PropertyType>(
+        *crow::connections::systemBus, service, objectPath, interface,
+        propertyName, std::move(callback));
+}
+
+template <typename PropertyType>
+inline void getProperty(
+    sdbusplus::asio::connection& /*conn*/, const std::string& service,
+    const std::string& objectPath, const std::string& interface,
+    const std::string& propertyName,
+    std::function<void(const boost::system::error_code&, const PropertyType&)>&&
+        callback)
+{
+    getProperty(service, objectPath, interface, propertyName,
+                std::move(callback));
+}
+
+inline void getAllProperties(
+    sdbusplus::asio::connection& /*conn*/, const std::string& service,
+    const std::string& objectPath, const std::string& interface,
+    std::function<void(const boost::system::error_code&,
+                       const DBusPropertiesMap&)>&& callback)
+{
+    getAllProperties(service, objectPath, interface, std::move(callback));
+}
+
 template <typename Callback>
 inline void checkDbusPathExists(const std::string& path, Callback&& callback)
 {
     crow::connections::systemBus->async_method_call(
         [callback = std::forward<Callback>(callback)](
             const boost::system::error_code& ec,
-            const dbus::utility::MapperGetObject& objectNames) {
+            const MapperGetObject& objectNames) {
             callback(!ec && !objectNames.empty());
         },
         "xyz.openbmc_project.ObjectMapper",
@@ -283,9 +327,9 @@
     std::function<void(const boost::system::error_code&,
                        const MapperEndPoints&)>&& callback)
 {
-    sdbusplus::asio::getProperty<MapperEndPoints>(
-        *crow::connections::systemBus, "xyz.openbmc_project.ObjectMapper", path,
-        "xyz.openbmc_project.Association", "endpoints", std::move(callback));
+    getProperty<MapperEndPoints>("xyz.openbmc_project.ObjectMapper", path,
+                                 "xyz.openbmc_project.Association", "endpoints",
+                                 std::move(callback));
 }
 
 inline void getManagedObjects(