From 6f30fd61a91b345a00e49bd0c6460d6694ddf2e8 Mon Sep 17 00:00:00 2001 From: Matthew Barth Date: Fri, 11 May 2018 09:38:29 -0500 Subject: Add set property functions without mapper lookup Tested: Property set with provided service name Change-Id: I158d33f85602f48d1dfe8baa7ce54eec6e8f8296 Signed-off-by: Matthew Barth --- sdbusplus.hpp | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/sdbusplus.hpp b/sdbusplus.hpp index eb380cc..5842133 100644 --- a/sdbusplus.hpp +++ b/sdbusplus.hpp @@ -471,6 +471,50 @@ class SDBusPlus std::forward(value)); } + /** @brief Set a property without mapper lookup. */ + template + 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 varValue( + std::forward(value)); + + callMethod( + bus, + service, + path, + "org.freedesktop.DBus.Properties"s, + "Set"s, + interface, + property, + varValue); + } + + /** @brief Set a property without mapper lookup. */ + template + 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(value)); + } + /** @brief Invoke method with mapper lookup. */ template static auto lookupAndCallMethod( -- cgit v1.2.1