Enable multiple filters
Add support for specifying multiple filters for a given event.
All filters must evaluate true to trigger the associated action.
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
Change-Id: I86d3e98e5c9e23b65e2e9733c817b38d2ab59465
diff --git a/events.hpp b/events.hpp
index 65eb06a..e029a6f 100644
--- a/events.hpp
+++ b/events.hpp
@@ -52,7 +52,7 @@
*/
struct DbusSignal final :
public Event,
- public std::tuple<const char*, FilterBasePtr>
+ public std::tuple<const char*, std::vector<FilterBasePtr>>
{
virtual ~DbusSignal() = default;
DbusSignal(const DbusSignal&) = default;
@@ -65,10 +65,10 @@
* @param[in] sig - The DBus match signature.
* @param[in] filter - A DBus signal match callback filtering function.
*/
- DbusSignal(const char* sig, FilterBasePtr filter) :
+ DbusSignal(const char* sig, const std::vector<FilterBasePtr>& filters) :
Event(Type::DBUS_SIGNAL),
- std::tuple<const char*, FilterBasePtr>(
- sig, std::move(filter)) {}
+ std::tuple<const char*, std::vector<FilterBasePtr>>(
+ sig, std::move(filters)) {}
};
/** @brief make_filter
@@ -128,7 +128,7 @@
const char* iface = nullptr;
msg.read(iface);
- if (strcmp(iface, _iface))
+ if (!iface || strcmp(iface, _iface))
{
return false;
}