1 #pragma once
2 
3 #include "types.hpp"
4 
5 namespace phosphor
6 {
7 namespace fan
8 {
9 namespace control
10 {
11 namespace precondition
12 {
13 
14 /**
15  * @brief A precondition to compare a group of property values and
16  * subscribe/unsubscribe a set speed event group
17  * @details Compares each entry within the precondition group to a given value
18  * that when each entry's property value matches the given value, the set speed
19  * event is then initialized. At any point a precondition entry's value no
20  * longer matches, the set speed event is removed from being active and fans
21  * are set to full speed.
22  *
23  * @param[in] pg - Precondition property group of property values
24  * @param[in] sse - Set speed event definition
25  *
26  * @return Lambda function
27  *     A lambda function to compare precondition property value states
28  *     and either subscribe or unsubscribe a set speed event group.
29  */
30 Action property_states_match(std::vector<PrecondGroup>&& pg,
31                              std::vector<SetSpeedEvent>&& sse);
32 
33 /**
34  * @brief A precondition to determine if there are any missing owners
35  * of the services for the group to init/remove a set speed event
36  * @details Checks each service associated with a group has an owner and
37  * if any of the services are missing an owner, the precondition passes
38  * and the events are initialized. Once all services associated with a
39  * group have an owner, the events are removed from being active.
40  *
41  * @param[in] sse - Set speed event definitions
42  *
43  * @return Lambda function
44  *     A lambda function precondition to check for group member services
45  *     that are not owned to either initialize or remove set speed events.
46  */
47 Action services_missing_owner(std::vector<SetSpeedEvent>&& sse);
48 
49 } // namespace precondition
50 } // namespace control
51 } // namespace fan
52 } // namespace phosphor
53