blob: c756047365c6844bef9d4937ca8f331f94608a3a [file] [log] [blame]
Matthew Barthccc77702017-07-28 13:43:04 -05001#pragma once
2
Matthew Barth03aff082018-12-12 15:20:22 -06003#include "types.hpp"
Matthew Barth604329e2017-08-04 11:18:28 -05004
Matthew Barthccc77702017-07-28 13:43:04 -05005namespace phosphor
6{
7namespace fan
8{
9namespace control
10{
11namespace precondition
12{
13
Matthew Barth572d4062018-05-08 14:16:04 -050014using namespace phosphor::logging;
15
Matthew Barthccc77702017-07-28 13:43:04 -050016/**
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 */
Matthew Barth03aff082018-12-12 15:20:22 -060032Action property_states_match(std::vector<PrecondGroup>&& pg,
33 std::vector<SetSpeedEvent>&& sse);
Matthew Barthccc77702017-07-28 13:43:04 -050034
Matthew Barth36cfcec2018-12-14 10:18:53 -060035/**
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 */
49Action services_missing_owner(std::vector<SetSpeedEvent>&& sse);
50
Matthew Barthccc77702017-07-28 13:43:04 -050051} // namespace precondition
52} // namespace control
53} // namespace fan
54} // namespace phosphor