summaryrefslogtreecommitdiffstats
path: root/control/types.hpp
blob: f565333e2e5162cd52406203c2025edd9487180b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
#pragma once
#include <string>
#include <tuple>
#include <vector>
#include <sdbusplus/server.hpp>
#include "timer.hpp"

namespace phosphor
{
namespace fan
{
namespace control
{

class Zone;

constexpr auto propertyNamePos = 0;
constexpr auto propertyInterfacePos = 1;
constexpr auto propertyPathPos = 2;
constexpr auto propertyValuePos = 3;

// TODO openbmc/openbmc#1769: Support more property types.
using ConditionProperty = std::tuple<std::string,
                          std::string,
                          std::string,
                          bool>;

constexpr auto conditionTypePos = 0;
constexpr auto conditionPropertyListPos = 1;
using Condition = std::tuple<std::string,
                             std::vector<ConditionProperty>>;

using PropertyVariantType = sdbusplus::message::variant<bool,
                                                        int64_t,
                                                        std::string>;

constexpr auto fanNamePos = 0;
constexpr auto sensorListPos = 1;
constexpr auto targetInterfacePos = 2;
using FanDefinition = std::tuple<std::string,
                                 std::vector<std::string>,
                                 std::string>;

constexpr auto intfPos = 0;
constexpr auto propPos = 1;
using Group = std::map<std::string, std::tuple<std::string, std::string>>;
using Handler = std::function<void(sdbusplus::bus::bus&,
                                   sdbusplus::message::message&,
                                   Zone&)>;
using Action = std::function<void(Zone&, const Group&)>;

constexpr auto pcPathPos = 0;
constexpr auto pcIntfPos = 1;
constexpr auto pcPropPos = 2;
constexpr auto pcValuePos = 3;
using PrecondGroup = std::tuple<std::string,
                                std::string,
                                std::string,
                                PropertyVariantType>;

constexpr auto namePos = 0;
constexpr auto hasOwnerPos = 1;
using Service = std::tuple<std::string, bool>;

constexpr auto intervalPos = 0;
constexpr auto typePos = 1;
using TimerType = phosphor::fan::util::Timer::TimerType;
using Timer = std::tuple<std::chrono::seconds,
                         TimerType>;

constexpr auto sigMatchPos = 0;
constexpr auto sigHandlerPos = 1;
using Signal = std::tuple<std::string, Handler>;

constexpr auto groupPos = 0;
constexpr auto actionsPos = 1;
constexpr auto timerPos = 2;
constexpr auto signalsPos = 3;
using SetSpeedEvent = std::tuple<Group,
                                 std::vector<Action>,
                                 Timer,
                                 std::vector<Signal>>;

constexpr auto eventGroupPos = 0;
constexpr auto eventMatchPos = 1;
constexpr auto eventHandlerPos = 2;
constexpr auto eventActionsPos = 3;
using EventData = std::tuple<Group, std::string, Handler, std::vector<Action>>;

constexpr auto timerEventDataPos = 0;
constexpr auto timerTimerPos = 1;
using TimerEvent =
    std::tuple<std::unique_ptr<EventData>,
               std::unique_ptr<phosphor::fan::util::Timer>>;

constexpr auto signalEventDataPos = 0;
constexpr auto signalMatchPos = 1;
using SignalEvent =
    std::tuple<std::unique_ptr<EventData>,
               std::unique_ptr<sdbusplus::server::match::match>>;

constexpr auto zoneNumPos = 0;
constexpr auto fullSpeedPos = 1;
constexpr auto floorSpeedPos = 2;
constexpr auto incDelayPos = 3;
constexpr auto decIntervalPos = 4;
constexpr auto fanListPos = 5;
constexpr auto setSpeedEventsPos = 6;
using ZoneDefinition = std::tuple<size_t,
                                  uint64_t,
                                  uint64_t,
                                  size_t,
                                  size_t,
                                  std::vector<FanDefinition>,
                                  std::vector<SetSpeedEvent>>;

constexpr auto conditionListPos = 0;
constexpr auto zoneListPos = 1;
using ZoneGroup = std::tuple<std::vector<Condition>,
                             std::vector<ZoneDefinition>>;

}
}
}
OpenPOWER on IntegriCloud