Add event init trigger
An event defined with an init trigger will run the event's actions
upon the event initializing. An event initializes when the fan control
application starts or at anytime an event's precondition is valid.
Tested:
Used missing fan action to set a speed at application start
Used missing fan action to set a speed upon valid precondition
Change-Id: I96a36425a2ca345371c27d7b580070bec28acaa1
Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
diff --git a/control/triggers.hpp b/control/triggers.hpp
index aad64d4..35c3091 100644
--- a/control/triggers.hpp
+++ b/control/triggers.hpp
@@ -36,6 +36,19 @@
*/
Trigger signal(const std::string& match, Handler&& handler);
+/**
+ * @brief A trigger for actions to run at event init
+ * @details Runs the event actions when the event is initialized. An event
+ * is initialized at application start or each time an event's precondition
+ * transitions to a valid state.
+ *
+ * @param[in] handler - Handler function to use for event init
+ *
+ * @return Trigger lambda function
+ * A Trigger function that runs actions at event init
+ */
+Trigger init(Handler&& handler = nullptr);
+
} // namespace trigger
} // namespace control
} // namespace fan