Add set property functions without mapper lookup
Tested:
Property set with provided service name
Change-Id: I158d33f85602f48d1dfe8baa7ce54eec6e8f8296
Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
diff --git a/sdbusplus.hpp b/sdbusplus.hpp
index eb380cc..5842133 100644
--- a/sdbusplus.hpp
+++ b/sdbusplus.hpp
@@ -471,6 +471,50 @@
std::forward<Property>(value));
}
+ /** @brief Set a property without mapper lookup. */
+ template <typename Property>
+ static void setProperty(
+ sdbusplus::bus::bus& bus,
+ const std::string& service,
+ const std::string& path,
+ const std::string& interface,
+ const std::string& property,
+ Property&& value)
+ {
+ using namespace std::literals::string_literals;
+
+ sdbusplus::message::variant<Property> varValue(
+ std::forward<Property>(value));
+
+ callMethod(
+ bus,
+ service,
+ path,
+ "org.freedesktop.DBus.Properties"s,
+ "Set"s,
+ interface,
+ property,
+ varValue);
+ }
+
+ /** @brief Set a property without mapper lookup. */
+ template <typename Property>
+ static void setProperty(
+ const std::string& service,
+ const std::string& path,
+ const std::string& interface,
+ const std::string& property,
+ Property&& value)
+ {
+ return setProperty(
+ getBus(),
+ service,
+ path,
+ interface,
+ property,
+ std::forward<Property>(value));
+ }
+
/** @brief Invoke method with mapper lookup. */
template <typename ...Args>
static auto lookupAndCallMethod(