Pass a bus connection to actions and filters
Prepare for outgoing calls from filters and actions.
Change-Id: Ic6255f51f8f4be9f25f2fd5321ee0b7703d60179
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
diff --git a/actions.hpp b/actions.hpp
index ea7f247..dfa1d00 100644
--- a/actions.hpp
+++ b/actions.hpp
@@ -14,10 +14,10 @@
class Manager;
namespace details
{
-using ActionBase = holder::CallableBase<void, Manager&>;
+using ActionBase = holder::CallableBase<void, sdbusplus::bus::bus&, Manager&>;
using ActionBasePtr = std::shared_ptr<ActionBase>;
template <typename T>
-using Action = holder::CallableHolder<T, void, Manager&>;
+using Action = holder::CallableHolder<T, void, sdbusplus::bus::bus&, Manager&>;
/** @brief make_action
*
@@ -42,7 +42,7 @@
/** @brief Destroy objects action. */
inline auto destroyObjects(std::vector<const char*> paths)
{
- return [paths = std::move(paths)](auto & m)
+ return [paths = std::move(paths)](auto&, auto & m)
{
m.destroyObjects(paths);
};
@@ -77,7 +77,7 @@
// and value to a lambda. When it is called, forward the
// path, interface and value on to the manager member function.
return [path, iface, member,
- value = std::forward<V>(value)](auto & m)
+ value = std::forward<V>(value)](auto&, auto & m)
{
m.template invokeMethod<T>(
path, iface, member, value);
diff --git a/events.hpp b/events.hpp
index f591c42..80fcdae 100644
--- a/events.hpp
+++ b/events.hpp
@@ -16,11 +16,11 @@
namespace details
{
using FilterBase = holder::CallableBase <
- bool, sdbusplus::message::message&, Manager& >;
+ bool, sdbusplus::bus::bus&, sdbusplus::message::message&, Manager& >;
using FilterBasePtr = std::shared_ptr<FilterBase>;
template <typename T>
using Filter = holder::CallableHolder <
- T, bool, sdbusplus::message::message&, Manager& >;
+ T, bool, sdbusplus::bus::bus&, sdbusplus::message::message&, Manager& >;
/** @struct Event
* @brief Event object interface.
@@ -121,7 +121,10 @@
* Extract the property from the PropertiesChanged
* message and run the condition test.
*/
- bool operator()(sdbusplus::message::message& msg, Manager&) const
+ bool operator()(
+ sdbusplus::bus::bus&,
+ sdbusplus::message::message& msg,
+ Manager&) const
{
std::map <
std::string,
diff --git a/manager.cpp b/manager.cpp
index a5cdf89..16ed30a 100644
--- a/manager.cpp
+++ b/manager.cpp
@@ -188,14 +188,14 @@
for (auto& f : filters)
{
- if (!(*f)(msg, *this))
+ if (!(*f)(_bus, msg, *this))
{
return;
}
}
for (auto& action : actions)
{
- (*action)(*this);
+ (*action)(_bus, *this);
}
}