Separate handlers for signals and method calls
Signals and method calls have different parameter structures. When the
associated event trigger is chosen, what's generated to retrieve the
dbus data is specific to that trigger event. For signals, the data is
read from the given signal message. A method call is method specific and
is called to be done against all of the members within the event group.
Change-Id: I92cbdbf05852fbaa7f1b56ed518e30278cdf840b
Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
diff --git a/control/triggers.cpp b/control/triggers.cpp
index 3cddce6..5662f3f 100644
--- a/control/triggers.cpp
+++ b/control/triggers.cpp
@@ -23,7 +23,7 @@
};
}
-Trigger signal(const std::string& match, Handler&& handler)
+Trigger signal(const std::string& match, SignalHandler&& handler)
{
return [match = std::move(match),
handler = std::move(handler)](control::Zone& zone,
@@ -77,7 +77,7 @@
};
}
-Trigger init(Handler&& handler)
+Trigger init(MethodHandler&& handler)
{
return [handler = std::move(handler)](control::Zone& zone,
const Group& group,
@@ -86,10 +86,9 @@
// A handler function is optional
if (handler)
{
- sdbusplus::message::message nullMsg{nullptr};
- // Execute the given handler function prior to running the actions
- handler(zone.getBus(), nullMsg, zone);
+ handler(zone, group);
}
+
// Run action functions for initial event state
std::for_each(
actions.begin(),