control: Add nameOwnerChanged signal support
Subscribe to and handle nameOwnerChanged signals to trigger event
actions.
Change-Id: I7d5a472d31a2af5297581c18d84ef4ac897ff3ea
Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
diff --git a/control/json/triggers/signal.hpp b/control/json/triggers/signal.hpp
index f382828..61b03e3 100644
--- a/control/json/triggers/signal.hpp
+++ b/control/json/triggers/signal.hpp
@@ -71,6 +71,16 @@
void interfacesRemoved(Manager* mgr, const std::string& eventName,
std::unique_ptr<ActionBase>& action);
+/**
+ * @brief Subscribes to a nameOwnerChanged signal
+ *
+ * @param[in] mgr - Pointer to manager of the trigger
+ * @param[in] eventName - Name of event associated to the signal
+ * @param[in] action - Action to be run when signal is received
+ */
+void nameOwnerChanged(Manager* mgr, const std::string& eventName,
+ std::unique_ptr<ActionBase>& actions);
+
// Match setup function for signals
using SignalMatch = std::function<void(Manager*, const std::string&,
std::unique_ptr<ActionBase>& action)>;
@@ -79,7 +89,8 @@
static const std::unordered_map<std::string, SignalMatch> signals = {
{"properties_changed", propertiesChanged},
{"interfaces_added", interfacesAdded},
- {"interfaces_removed", interfacesRemoved}};
+ {"interfaces_removed", interfacesRemoved},
+ {"name_owner_changed", nameOwnerChanged}};
/**
* @brief Trigger to process an event after a signal is received