make getproperty a templated function

This will make it more generic so other types of properties can be read

Signed-off-by: Andrew Geissler <geissonator@yahoo.com>
Change-Id: Icc7c040ec44d470b6b62d8b74200c7e35012e25c
diff --git a/utils.hpp b/utils.hpp
index 1a695f4..2174938 100644
--- a/utils.hpp
+++ b/utils.hpp
@@ -30,10 +30,26 @@
  *
  *  @throw sdbusplus::exception::exception when it fails
  */
-const PropertyValue getProperty(sdbusplus::bus::bus& bus,
-                                const std::string& objectPath,
-                                const std::string& interface,
-                                const std::string& propertyName);
+template <typename T>
+T getProperty(sdbusplus::bus::bus& bus, const std::string& objectPath,
+              const std::string& interface, const std::string& propertyName)
+{
+    std::variant<T> value{};
+    auto service = getService(bus, objectPath, interface);
+    if (service.empty())
+    {
+        return std::get<T>(value);
+    }
+
+    auto method = bus.new_method_call(service.c_str(), objectPath.c_str(),
+                                      "org.freedesktop.DBus.Properties", "Get");
+    method.append(interface, propertyName);
+
+    auto reply = bus.call(method);
+    reply.read(value);
+
+    return std::get<T>(value);
+}
 
 /** @brief Set D-Bus property
  *