utils: Add setProperty support

Signed-off-by: Lei YU <yulei.sh@bytedance.com>
Change-Id: Iac2c5b90a4a8ed07210a564dbd6048c37b5e34c3
diff --git a/src/utils.cpp b/src/utils.cpp
index 70a4e61..f745a26 100644
--- a/src/utils.cpp
+++ b/src/utils.cpp
@@ -91,4 +91,24 @@
     }
 }
 
+void Utils::setPropertyImpl(sdbusplus::bus::bus& bus, const char* service,
+                            const char* path, const char* interface,
+                            const char* propertyName, ValueType&& value) const
+{
+    auto method = bus.new_method_call(service, path,
+                                      "org.freedesktop.DBus.Properties", "Set");
+    method.append(interface, propertyName, value);
+    try
+    {
+        bus.call_noreply(method);
+    }
+    catch (const sdbusplus::exception::SdBusError& ex)
+    {
+        log<level::ERR>("SetProperty call failed", entry("PATH=%s", path),
+                        entry("INTERFACE=%s", interface),
+                        entry("PROPERTY=%s", propertyName));
+        throw std::runtime_error("SetProperty call failed");
+    }
+}
+
 } // namespace utils