diff options
author | Brad Bishop <bradleyb@fuzziesquirrel.com> | 2017-05-25 23:38:37 -0400 |
---|---|---|
committer | Brad Bishop <bradleyb@fuzziesquirrel.com> | 2017-06-19 16:26:48 -0400 |
commit | 0df00be00999bc3285b8b0a401b48e42fb862250 (patch) | |
tree | f1c9c332b7fede66daf5b42abc283fdbe190d98c /src/sdbusplus.hpp | |
parent | 01079892b1768be2b2f28a6a8ac56422792ff930 (diff) | |
download | phosphor-dbus-monitor-0df00be00999bc3285b8b0a401b48e42fb862250.tar.gz phosphor-dbus-monitor-0df00be00999bc3285b8b0a401b48e42fb862250.zip |
Method support
Add support for a method callback. The method callback enables
arbitrary DBus method calls. A sample use case could be
starting a systemd unit via the sytemd DBus API.
Change-Id: If25131d11497c82f862ae1f47da066c5fd8b2e2e
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
Diffstat (limited to 'src/sdbusplus.hpp')
-rw-r--r-- | src/sdbusplus.hpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/sdbusplus.hpp b/src/sdbusplus.hpp index 7dbf44d..8afb8b5 100644 --- a/src/sdbusplus.hpp +++ b/src/sdbusplus.hpp @@ -30,6 +30,28 @@ class SDBusPlus } public: + /** @brief Invoke a method; ignore reply. */ + template <typename ...Args> + static void callMethodNoReply( + const std::string& busName, + const std::string& path, + const std::string& interface, + const std::string& method, + Args&& ... args) + { + auto reqMsg = getBus().new_method_call( + busName.c_str(), + path.c_str(), + interface.c_str(), + method.c_str()); + reqMsg.append(std::forward<Args>(args)...); + getBus().call_noreply(reqMsg); + + // TODO: openbmc/openbmc#1719 + // invoke these methods async, with a callback + // handler that checks for errors and logs. + } + /** @brief Invoke a method. */ template <typename ...Args> static auto callMethod( |