blob: d170d0bef54ef83a870bdb7adcb5d399217be8d1 [file] [log] [blame]
Matthew Barth1b4de262018-03-06 13:03:16 -06001#pragma once
2
3#include "types.hpp"
4#include "zone.hpp"
5
6namespace phosphor
7{
8namespace fan
9{
10namespace control
11{
12namespace trigger
13{
14
15/**
16 * @brief A trigger to start a timer for an event
17 * @details Creates and starts a timer according to the configuration given
18 * that will call an event's actions upon each timer expiration.
19 *
20 * @param[in] tConf - Timer configuration parameters
21 *
22 * @return Trigger lambda function
23 * A Trigger function that creates and starts a timer
24 */
25Trigger timer(TimerConf&& tConf);
26
Matthew Barth016bd242018-03-07 16:06:06 -060027/**
28 * @brief A trigger of a signal for an event
29 * @details Subscribes to the defined signal match.
30 *
31 * @param[in] match - Signal match to subscribe to
32 * @param[in] handler - Handler function for the received signal
33 *
34 * @return Trigger lambda function
35 * A Trigger function that subscribes to a signal
36 */
Matthew Barth926df662018-10-09 09:51:12 -050037Trigger signal(const std::string& match, SignalHandler&& handler);
Matthew Barth016bd242018-03-07 16:06:06 -060038
Matthew Barthcd3bfbc2018-03-07 16:26:03 -060039/**
40 * @brief A trigger for actions to run at event init
41 * @details Runs the event actions when the event is initialized. An event
42 * is initialized at application start or each time an event's precondition
43 * transitions to a valid state.
44 *
45 * @param[in] handler - Handler function to use for event init
46 *
47 * @return Trigger lambda function
48 * A Trigger function that runs actions at event init
49 */
Matthew Barth926df662018-10-09 09:51:12 -050050Trigger init(MethodHandler&& handler = nullptr);
Matthew Barthcd3bfbc2018-03-07 16:26:03 -060051
Matthew Barth1b4de262018-03-06 13:03:16 -060052} // namespace trigger
53} // namespace control
54} // namespace fan
55} // namespace phosphor