summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Barth <msbarth@us.ibm.com>2018-05-11 09:38:29 -0500
committerMatthew Barth <msbarth@linux.ibm.com>2018-05-17 17:10:06 +0000
commit6f30fd61a91b345a00e49bd0c6460d6694ddf2e8 (patch)
tree79648314bfd1cdd709547f1f0eb7bc0f2c2f3f72
parent7c48d10d85916352563e4229c52bcd357563fb49 (diff)
downloadphosphor-fan-presence-6f30fd61a91b345a00e49bd0c6460d6694ddf2e8.tar.gz
phosphor-fan-presence-6f30fd61a91b345a00e49bd0c6460d6694ddf2e8.zip
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>
-rw-r--r--sdbusplus.hpp44
1 files changed, 44 insertions, 0 deletions
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<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(
OpenPOWER on IntegriCloud