xref: /openbmc/phosphor-fan-presence/control/triggers.hpp (revision 926df663de38c4ab643a7d7f1556b2a8dd3e5d9f)
11b4de26aSMatthew Barth #pragma once
21b4de26aSMatthew Barth 
31b4de26aSMatthew Barth #include "types.hpp"
41b4de26aSMatthew Barth #include "zone.hpp"
51b4de26aSMatthew Barth 
61b4de26aSMatthew Barth namespace phosphor
71b4de26aSMatthew Barth {
81b4de26aSMatthew Barth namespace fan
91b4de26aSMatthew Barth {
101b4de26aSMatthew Barth namespace control
111b4de26aSMatthew Barth {
121b4de26aSMatthew Barth namespace trigger
131b4de26aSMatthew Barth {
141b4de26aSMatthew Barth 
151b4de26aSMatthew Barth /**
161b4de26aSMatthew Barth  * @brief A trigger to start a timer for an event
171b4de26aSMatthew Barth  * @details Creates and starts a timer according to the configuration given
181b4de26aSMatthew Barth  * that will call an event's actions upon each timer expiration.
191b4de26aSMatthew Barth  *
201b4de26aSMatthew Barth  * @param[in] tConf - Timer configuration parameters
211b4de26aSMatthew Barth  *
221b4de26aSMatthew Barth  * @return Trigger lambda function
231b4de26aSMatthew Barth  *     A Trigger function that creates and starts a timer
241b4de26aSMatthew Barth  */
251b4de26aSMatthew Barth Trigger timer(TimerConf&& tConf);
261b4de26aSMatthew Barth 
27016bd24cSMatthew Barth /**
28016bd24cSMatthew Barth  * @brief A trigger of a signal for an event
29016bd24cSMatthew Barth  * @details Subscribes to the defined signal match.
30016bd24cSMatthew Barth  *
31016bd24cSMatthew Barth  * @param[in] match - Signal match to subscribe to
32016bd24cSMatthew Barth  * @param[in] handler - Handler function for the received signal
33016bd24cSMatthew Barth  *
34016bd24cSMatthew Barth  * @return Trigger lambda function
35016bd24cSMatthew Barth  *     A Trigger function that subscribes to a signal
36016bd24cSMatthew Barth  */
37*926df663SMatthew Barth Trigger signal(const std::string& match, SignalHandler&& handler);
38016bd24cSMatthew Barth 
39cd3bfbc1SMatthew Barth /**
40cd3bfbc1SMatthew Barth  * @brief A trigger for actions to run at event init
41cd3bfbc1SMatthew Barth  * @details Runs the event actions when the event is initialized. An event
42cd3bfbc1SMatthew Barth  * is initialized at application start or each time an event's precondition
43cd3bfbc1SMatthew Barth  * transitions to a valid state.
44cd3bfbc1SMatthew Barth  *
45cd3bfbc1SMatthew Barth  * @param[in] handler - Handler function to use for event init
46cd3bfbc1SMatthew Barth  *
47cd3bfbc1SMatthew Barth  * @return Trigger lambda function
48cd3bfbc1SMatthew Barth  *     A Trigger function that runs actions at event init
49cd3bfbc1SMatthew Barth  */
50*926df663SMatthew Barth Trigger init(MethodHandler&& handler = nullptr);
51cd3bfbc1SMatthew Barth 
521b4de26aSMatthew Barth } // namespace trigger
531b4de26aSMatthew Barth } // namespace control
541b4de26aSMatthew Barth } // namespace fan
551b4de26aSMatthew Barth } // namespace phosphor
56