summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sdbusplus.hpp40
1 files changed, 40 insertions, 0 deletions
diff --git a/sdbusplus.hpp b/sdbusplus.hpp
index 3fc9b9e..0c70b9c 100644
--- a/sdbusplus.hpp
+++ b/sdbusplus.hpp
@@ -245,6 +245,46 @@ class SDBusPlus
property);
}
+ /** @brief Get a property without mapper lookup. */
+ template <typename Property>
+ static auto getProperty(
+ sdbusplus::bus::bus& bus,
+ const std::string& service,
+ const std::string& path,
+ const std::string& interface,
+ const std::string& property)
+ {
+ using namespace std::literals::string_literals;
+
+ auto msg = callMethod(
+ bus,
+ service,
+ path,
+ "org.freedesktop.DBus.Properties"s,
+ "Get"s,
+ interface,
+ property);
+ sdbusplus::message::variant<Property> value;
+ msg.read(value);
+ return value.template get<Property>();
+ }
+
+ /** @brief Get a property without mapper lookup. */
+ template <typename Property>
+ static auto getProperty(
+ const std::string& service,
+ const std::string& path,
+ const std::string& interface,
+ const std::string& property)
+ {
+ return getProperty<Property>(
+ getBus(),
+ service,
+ path,
+ interface,
+ property);
+ }
+
/** @brief Set a property with mapper lookup. */
template <typename Property>
static void setProperty(
OpenPOWER on IntegriCloud