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