blob: 4063bd5cafd42af1cc4fcf3fa7f30a6edc158a11 [file] [log] [blame]
Matthew Barth4f0d3b72020-08-27 14:32:15 -05001/**
2 * Copyright © 2020 IBM Corporation
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16#pragma once
17
18#include "config_base.hpp"
Matthew Barthbc89a8a2021-05-25 15:42:58 -050019#include "dbus_zone.hpp"
Matthew Barthde90fb42021-03-04 16:34:28 -060020#include "fan.hpp"
Matthew Barth4f0d3b72020-08-27 14:32:15 -050021
22#include <nlohmann/json.hpp>
Matthew Barth603ef162021-03-24 15:34:53 -050023#include <sdeventplus/event.hpp>
Matthew Barth007de092021-03-25 13:56:04 -050024#include <sdeventplus/utility/timer.hpp>
Matthew Barth4f0d3b72020-08-27 14:32:15 -050025
Matthew Barth651f03a2020-08-27 16:15:11 -050026#include <any>
Matthew Barth007de092021-03-25 13:56:04 -050027#include <chrono>
Matthew Barth651f03a2020-08-27 16:15:11 -050028#include <functional>
29#include <map>
Matthew Barthbc89a8a2021-05-25 15:42:58 -050030#include <memory>
Matthew Barth651f03a2020-08-27 16:15:11 -050031#include <tuple>
32
Matthew Barth4f0d3b72020-08-27 14:32:15 -050033namespace phosphor::fan::control::json
34{
35
Matthew Barth603ef162021-03-24 15:34:53 -050036class Manager;
37
Matthew Barth4f0d3b72020-08-27 14:32:15 -050038using json = nlohmann::json;
39
Matthew Barth007de092021-03-25 13:56:04 -050040/* Dbus event timer */
41using Timer = sdeventplus::utility::Timer<sdeventplus::ClockId::Monotonic>;
42
Matthew Barth4f0d3b72020-08-27 14:32:15 -050043/**
44 * @class Zone - Represents a configured fan control zone
45 *
46 * A zone object contains the configured attributes for a zone that groups
Matthew Barthe47c9582021-03-09 14:24:02 -060047 * a number of fans together to be under the same target control. These
48 * configuration attributes include, but are not limited to, the default ceiling
49 * of the fans within the zone, a default floor, the delay between increases, a
50 * decrease interval, and any profiles(OPTIONAL) the zone should be included in.
Matthew Barth4f0d3b72020-08-27 14:32:15 -050051 *
52 * (When no profile for a zone is given, the zone defaults to always exist)
53 *
54 */
Matthew Barthbc89a8a2021-05-25 15:42:58 -050055class Zone : public ConfigBase
Matthew Barth4f0d3b72020-08-27 14:32:15 -050056{
57 public:
58 /* JSON file name for zones */
59 static constexpr auto confFileName = "zones.json";
Matthew Barth651f03a2020-08-27 16:15:11 -050060
Matthew Barth4f0d3b72020-08-27 14:32:15 -050061 Zone() = delete;
62 Zone(const Zone&) = delete;
63 Zone(Zone&&) = delete;
64 Zone& operator=(const Zone&) = delete;
65 Zone& operator=(Zone&&) = delete;
66 ~Zone() = default;
67
68 /**
69 * Constructor
70 * Parses and populates a zone from JSON object data
71 *
Matthew Barth4f0d3b72020-08-27 14:32:15 -050072 * @param[in] jsonObj - JSON object
Matthew Barth603ef162021-03-24 15:34:53 -050073 * @param[in] event - sdeventplus event loop
74 * @param[in] mgr - Manager of this zone
Matthew Barth4f0d3b72020-08-27 14:32:15 -050075 */
Matthew Barth9403a212021-05-17 09:31:50 -050076 Zone(const json& jsonObj, const sdeventplus::Event& event, Manager* mgr);
Matthew Barth4f0d3b72020-08-27 14:32:15 -050077
78 /**
Matthew Barth48f44da2021-05-27 15:43:34 -050079 * @brief Get the poweron target
80 *
81 * Poweron target is the target the fans within this zone should be set to
82 * when the system is powered on.
83 *
84 * @return Poweron target of this zone
85 */
86 inline const auto& getPoweronTarget() const
87 {
88 return _poweronTarget;
89 }
90
91 /**
Matthew Barthe47c9582021-03-09 14:24:02 -060092 * @brief Get the default ceiling
Matthew Barth4f0d3b72020-08-27 14:32:15 -050093 *
Matthew Barthe47c9582021-03-09 14:24:02 -060094 * Default ceiling is the highest target the fans within this zone is
95 * allowed to increase to. The zone's ceiling defaults to this unless
96 * changed by some configured event.
Matthew Barth4f0d3b72020-08-27 14:32:15 -050097 *
Matthew Barthe47c9582021-03-09 14:24:02 -060098 * @return Default ceiling of this zone
Matthew Barth4f0d3b72020-08-27 14:32:15 -050099 */
Matthew Barthe47c9582021-03-09 14:24:02 -0600100 inline const auto& getDefaultCeiling() const
Matthew Barth4f0d3b72020-08-27 14:32:15 -0500101 {
Matthew Barthe47c9582021-03-09 14:24:02 -0600102 return _defaultCeiling;
Matthew Barth4f0d3b72020-08-27 14:32:15 -0500103 }
104
105 /**
Matthew Barthe47c9582021-03-09 14:24:02 -0600106 * @brief Get the default floor
Matthew Barth4f0d3b72020-08-27 14:32:15 -0500107 *
Matthew Barthe47c9582021-03-09 14:24:02 -0600108 * The default floor is the lowest target the fans within this zone
109 * are allowed to decrease to. The zone's floor defaults to this
Matthew Barth4f0d3b72020-08-27 14:32:15 -0500110 * unless changed by some configured event.
111 *
Matthew Barthe47c9582021-03-09 14:24:02 -0600112 * @return Default floor
Matthew Barth4f0d3b72020-08-27 14:32:15 -0500113 */
114 inline const auto& getDefaultFloor() const
115 {
116 return _defaultFloor;
117 }
118
119 /**
Matthew Barthe47c9582021-03-09 14:24:02 -0600120 * @brief Get the increase delay(OPTIONAL)
Matthew Barth4f0d3b72020-08-27 14:32:15 -0500121 *
Matthew Barthe47c9582021-03-09 14:24:02 -0600122 * The increase delay is the amount of time(in seconds) increases
123 * to a target are delayed before being made. The default is 0, which
124 * results in immediate increase requests when any events result in
125 * a change to the target.
Matthew Barth4f0d3b72020-08-27 14:32:15 -0500126 *
127 * It is recommend a value other than 0 is configured, but that inherently
Matthew Barthe47c9582021-03-09 14:24:02 -0600128 * depends on the fan controller and configured increases.
Matthew Barth4f0d3b72020-08-27 14:32:15 -0500129 *
Matthew Barthe47c9582021-03-09 14:24:02 -0600130 * @return Increase delay(in seconds)
Matthew Barth4f0d3b72020-08-27 14:32:15 -0500131 */
132 inline const auto& getIncDelay() const
133 {
134 return _incDelay;
135 }
136
137 /**
Matthew Barthe47c9582021-03-09 14:24:02 -0600138 * @brief Get the decrease interval
Matthew Barth4f0d3b72020-08-27 14:32:15 -0500139 *
Matthew Barthe47c9582021-03-09 14:24:02 -0600140 * Decreases happen on a set interval when no requests for an increase
141 * in fan targets exists. This is the interval(in seconds) at which the fans
Matthew Barth4f0d3b72020-08-27 14:32:15 -0500142 * within the zone are decreased if events exist that result in a target
Matthew Barthe47c9582021-03-09 14:24:02 -0600143 * decrease.
Matthew Barth4f0d3b72020-08-27 14:32:15 -0500144 *
Matthew Barthe47c9582021-03-09 14:24:02 -0600145 * @return Decrease interval(in seconds)
Matthew Barth4f0d3b72020-08-27 14:32:15 -0500146 */
147 inline const auto& getDecInterval() const
148 {
149 return _decInterval;
150 }
151
Matthew Barth651f03a2020-08-27 16:15:11 -0500152 /**
Matthew Barth6f787302021-03-25 15:01:01 -0500153 * @brief Get the current target of the zone
154 *
155 * @return - The current target of the zone
156 */
157 inline const auto& getTarget() const
158 {
159 return _target;
160 }
161
162 /**
Matthew Barthdc776c82021-02-25 16:06:16 -0600163 * @brief Get the target increase delta
164 *
165 * @return - The current target increase delta
166 */
167 inline auto& getIncDelta() const
168 {
169 return _incDelta;
170 };
171
172 /**
Matthew Barth45c44ea2021-03-03 13:16:14 -0600173 * @brief Get the target decrease delta
174 *
175 * @return - The current target decrease delta
176 */
177 inline auto& getDecDelta() const
178 {
179 return _decDelta;
180 };
181
182 /**
Matthew Barth603ef162021-03-24 15:34:53 -0500183 * @brief Get the manager of the zone
184 *
185 * @return - The manager of the zone
186 */
187 inline auto* getManager() const
188 {
189 return _manager;
190 }
191
192 /**
Matthew Barth14303a42021-05-21 13:04:08 -0500193 * @brief Enable the zone
194 *
195 * Performs the necessary tasks to enable the zone such as restoring any
196 * dbus property states(if persisted), starting the decrement timer, etc...
197 */
198 void enable();
199
200 /**
Matthew Barthde90fb42021-03-04 16:34:28 -0600201 * @brief Add a fan object to the zone
202 *
203 * @param[in] fan - Unique pointer to a fan object that will be moved into
204 * the zone
205 *
206 * Adds a fan object to the list of fans that make up the zone by moving the
207 * fan object into the list.
208 */
209 void addFan(std::unique_ptr<Fan> fan);
210
Matthew Barth12cb1252021-03-08 16:47:30 -0600211 /**
Matthew Barth8ba715e2021-03-05 09:00:05 -0600212 * Sets all fans in the zone to the target given when the zone is active
213 *
214 * @param[in] target - Target for fans
215 */
216 void setTarget(uint64_t target);
217
218 /**
Matthew Barth53680112021-09-23 11:20:41 -0500219 * Sets and holds all fans in the zone to the target given or releases a
220 * target hold resulting in the fans being held at the highest remaining
221 * hold target if other hold targets had been requested. When no hold
222 * targets exist, the zone returns to being active.
223 *
224 * @param[in] ident - Unique identifier for a target hold
225 * @param[in] target - Target to hold fans at
226 * @param[in] hold - Whether to hold(true) or release(false) a target hold
227 */
228 void setTargetHold(const std::string& ident, uint64_t target, bool hold);
229
230 /**
Matthew Barth12cb1252021-03-08 16:47:30 -0600231 * @brief Set the floor to the given target and increase target to the floor
232 * when the target is below the floor value when floor changes are allowed.
233 *
234 * @param[in] target - Target to set the floor to
235 */
236 void setFloor(uint64_t target);
237
238 /**
Matt Spinler40554d82021-10-26 15:23:59 -0500239 * Sets and holds the floor of the zone to the target given or releases a
240 * floor hold resulting in the fans being held at the highest remaining
241 * hold target if other floor hold targets had been requested. When no hold
242 * targets exist, the floor gets set to the default floor value.
243 *
244 * @param[in] ident - Unique identifier for a floor hold
245 * @param[in] target - Floor value
246 * @param[in] hold - Whether to hold(true) or release(false) a hold
247 */
248 void setFloorHold(const std::string& ident, uint64_t target, bool hold);
249
250 /**
Matthew Barth9d763882021-06-30 15:55:26 -0500251 * @brief Set the default floor to the given value
252 *
253 * @param[in] value - Value to set the default floor to
254 */
255 inline void setDefaultFloor(uint64_t value)
256 {
257 _defaultFloor = value;
258 }
259
260 /**
Matthew Barth12cb1252021-03-08 16:47:30 -0600261 * @brief Sets the floor change allowed state
262 *
263 * @param[in] ident - An identifier that affects floor changes
264 * @param[in] isAllow - Allow state according to the identifier
265 */
266 inline void setFloorChangeAllow(const std::string& ident, bool isAllow)
267 {
268 _floorChange[ident] = isAllow;
269 }
270
271 /**
Matthew Barth45c44ea2021-03-03 13:16:14 -0600272 * @brief Sets the decrease allowed state of a group
273 *
274 * @param[in] ident - An identifier that affects speed decreases
275 * @param[in] isAllow - Allow state according to the identifier
276 */
277 inline void setDecreaseAllow(const std::string& ident, bool isAllow)
278 {
279 _decAllowed[ident] = isAllow;
280 }
281
282 /**
Matthew Barth12cb1252021-03-08 16:47:30 -0600283 * @brief Calculate the requested target from the given delta and increases
284 * the fans, not going above the ceiling.
285 *
286 * @param[in] targetDelta - The delta to increase the target by
287 */
288 void requestIncrease(uint64_t targetDelta);
289
Matthew Bartha0dd1352021-03-09 11:10:49 -0600290 /**
Matthew Barth007de092021-03-25 13:56:04 -0500291 * @brief Callback function for the increase timer that delays
292 * processing of requested target increases while fans are increasing
293 */
294 void incTimerExpired();
295
296 /**
Matthew Barth45c44ea2021-03-03 13:16:14 -0600297 * @brief Calculate the lowest requested decrease target from the given
298 * delta within a decrease interval.
299 *
300 * @param[in] targetDelta - The delta to decrease the target by
301 */
302 void requestDecrease(uint64_t targetDelta);
303
304 /**
Matthew Barth007de092021-03-25 13:56:04 -0500305 * @brief Callback function for the decrease timer that processes any
306 * requested target decreases if allowed
307 */
308 void decTimerExpired();
309
310 /**
Matthew Barth07fecfc2021-01-29 09:04:43 -0600311 * @brief Set the requested target base to be used as the target to base a
312 * new requested target from
313 *
314 * @param[in] targetBase - Base target value to use
315 */
316 inline void setRequestTargetBase(uint64_t targetBase)
317 {
318 _requestTargetBase = targetBase;
319 };
320
321 /**
Matthew Bartha0dd1352021-03-09 11:10:49 -0600322 * @brief Set a property to be persisted
323 *
324 * @param[in] intf - Interface containing property
325 * @param[in] prop - Property to be persisted
326 */
327 void setPersisted(const std::string& intf, const std::string& prop);
328
329 /**
Matthew Barth279183f2021-05-25 10:19:43 -0500330 * @brief Is the property persisted
331 *
332 * @param[in] intf - Interface containing property
333 * @param[in] prop - Property to check if persisted
334 *
335 * @return - True if property is to be persisted, false otherwise
336 */
337 bool isPersisted(const std::string& intf, const std::string& prop) const;
338
339 /**
Matthew Barthb584d812021-03-11 15:55:04 -0600340 * @brief A handler function to set/update a property on a zone
341 * @details Sets or updates a zone's dbus property to the given value using
342 * the provided base dbus object's set property function
343 *
344 * @param[in] intf - Interface on zone object
345 * @param[in] prop - Property on interface
Matthew Barthbc89a8a2021-05-25 15:42:58 -0500346 * @param[in] func - Zone dbus object's set property function pointer
Matthew Barthb584d812021-03-11 15:55:04 -0600347 * @param[in] value - Value to set property to
348 * @param[in] persist - Persist property value or not
349 *
350 * @return Lambda function
Matthew Barthbc89a8a2021-05-25 15:42:58 -0500351 * A lambda function to set/update the zone dbus object's property
Matthew Barthb584d812021-03-11 15:55:04 -0600352 */
353 template <typename T>
354 static auto setProperty(const char* intf, const char* prop,
Matthew Barthbc89a8a2021-05-25 15:42:58 -0500355 T (DBusZone::*func)(T), T&& value, bool persist)
Matthew Barthb584d812021-03-11 15:55:04 -0600356 {
Matthew Barthbc89a8a2021-05-25 15:42:58 -0500357 return [=, value = std::forward<T>(value)](DBusZone& dbusZone,
358 Zone& zone) {
359 (dbusZone.*func)(value);
Matthew Barthb584d812021-03-11 15:55:04 -0600360 if (persist)
361 {
Matthew Barthbc89a8a2021-05-25 15:42:58 -0500362 zone.setPersisted(intf, prop);
Matthew Barthb584d812021-03-11 15:55:04 -0600363 }
364 };
365 }
366
367 /**
368 * @brief A handler function to set/update a zone's dbus property's persist
369 * state
370 * @details Sets or updates a zone's dbus property's persist state where the
371 * value of the property is to be left unchanged
372 *
373 * @param[in] intf - Interface on zone object
374 * @param[in] prop - Property on interface
375 * @param[in] persist - Persist property value or not
376 *
377 * @return Lambda function
Matthew Barthbc89a8a2021-05-25 15:42:58 -0500378 * A lambda function to set/update the zone's dbus object's property's
379 * persist state
Matthew Barthb584d812021-03-11 15:55:04 -0600380 */
381 static auto setPropertyPersist(const char* intf, const char* prop,
382 bool persist)
383 {
Matthew Barthbc89a8a2021-05-25 15:42:58 -0500384 return [=](DBusZone&, Zone& zone) {
Matthew Barthb584d812021-03-11 15:55:04 -0600385 if (persist)
386 {
Matthew Barthbc89a8a2021-05-25 15:42:58 -0500387 zone.setPersisted(intf, prop);
Matthew Barthb584d812021-03-11 15:55:04 -0600388 }
389 };
390 }
391
Matt Spinler9db6dd12021-10-29 16:10:08 -0500392 /**
393 * @brief Dump the attributes into JSON
394 *
395 * @return json - JSON object with the attributes
396 */
397 json dump() const;
398
Matthew Barth4f0d3b72020-08-27 14:32:15 -0500399 private:
Matthew Barthbc89a8a2021-05-25 15:42:58 -0500400 /* The zone's associated dbus object */
401 std::unique_ptr<DBusZone> _dbusZone;
402
Matthew Barth603ef162021-03-24 15:34:53 -0500403 /* The zone's manager */
404 Manager* _manager;
405
Matthew Barthab8e4b82021-05-27 13:25:46 -0500406 /* The zone's poweron target value for fans */
407 uint64_t _poweronTarget;
408
Matthew Barthe47c9582021-03-09 14:24:02 -0600409 /* The zone's default ceiling value for fans */
410 uint64_t _defaultCeiling;
Matthew Barth4f0d3b72020-08-27 14:32:15 -0500411
Matthew Barthe47c9582021-03-09 14:24:02 -0600412 /* The zone's default floor value for fans */
Matthew Barth4f0d3b72020-08-27 14:32:15 -0500413 uint64_t _defaultFloor;
414
Matthew Barthe47c9582021-03-09 14:24:02 -0600415 /* Zone's increase delay(in seconds) (OPTIONAL) */
Matthew Barth007de092021-03-25 13:56:04 -0500416 std::chrono::seconds _incDelay;
Matthew Barth4f0d3b72020-08-27 14:32:15 -0500417
Matthew Barth2504c772021-05-27 14:02:31 -0500418 /* Zone's decrease interval(in seconds) (OPTIONAL) */
Matthew Barth007de092021-03-25 13:56:04 -0500419 std::chrono::seconds _decInterval;
Matthew Barth4f0d3b72020-08-27 14:32:15 -0500420
Matthew Barth12cb1252021-03-08 16:47:30 -0600421 /* The floor target to not go below */
422 uint64_t _floor;
423
424 /* Target for this zone */
425 uint64_t _target;
426
Matthew Barth2b3253e2021-03-09 14:51:16 -0600427 /* Zone increase delta */
428 uint64_t _incDelta;
429
Matthew Barth45c44ea2021-03-03 13:16:14 -0600430 /* Zone decrease delta */
431 uint64_t _decDelta;
432
Matthew Barth2b3253e2021-03-09 14:51:16 -0600433 /* The ceiling target to not go above */
434 uint64_t _ceiling;
435
436 /* Requested target base */
437 uint64_t _requestTargetBase;
438
Matthew Barth12cb1252021-03-08 16:47:30 -0600439 /* Map of whether floor changes are allowed by a string identifier */
440 std::map<std::string, bool> _floorChange;
441
Matthew Barth45c44ea2021-03-03 13:16:14 -0600442 /* Map of controlling decreases allowed by a string identifer */
443 std::map<std::string, bool> _decAllowed;
444
Matthew Bartha0dd1352021-03-09 11:10:49 -0600445 /* Map of interfaces to persisted properties the zone hosts*/
446 std::map<std::string, std::vector<std::string>> _propsPersisted;
447
Matthew Barth8ba715e2021-03-05 09:00:05 -0600448 /* Automatic fan control active state */
449 bool _isActive;
450
Matthew Barth007de092021-03-25 13:56:04 -0500451 /* The target increase timer object */
452 Timer _incTimer;
453
454 /* The target decrease timer object */
455 Timer _decTimer;
456
Matthew Barth53680112021-09-23 11:20:41 -0500457 /* Map of target holds by a string identifier */
Matt Spinler40554d82021-10-26 15:23:59 -0500458 std::unordered_map<std::string, uint64_t> _targetHolds;
459
460 /* Map of floor holds by a string identifier */
461 std::unordered_map<std::string, uint64_t> _floorHolds;
Matthew Barth53680112021-09-23 11:20:41 -0500462
Matthew Barthb584d812021-03-11 15:55:04 -0600463 /* Interface to property mapping of their associated set property handler
464 * function */
465 static const std::map<
466 std::string,
Matthew Barthbc89a8a2021-05-25 15:42:58 -0500467 std::map<std::string, std::function<std::function<void(
468 DBusZone&, Zone&)>(const json&, bool)>>>
Matthew Barth216229c2020-09-24 13:47:33 -0500469 _intfPropHandlers;
Matthew Barth651f03a2020-08-27 16:15:11 -0500470
Matthew Barthde90fb42021-03-04 16:34:28 -0600471 /* List of fans included in this zone */
472 std::vector<std::unique_ptr<Fan>> _fans;
473
Matthew Barthbc89a8a2021-05-25 15:42:58 -0500474 /* List of configured interface set property functions */
475 std::vector<std::function<void(DBusZone&, Zone&)>> _propInitFunctions;
476
Matthew Barth4f0d3b72020-08-27 14:32:15 -0500477 /**
Matthew Barthab8e4b82021-05-27 13:25:46 -0500478 * @brief Parse and set the zone's poweron target value
Matthew Barth4f0d3b72020-08-27 14:32:15 -0500479 *
480 * @param[in] jsonObj - JSON object for the zone
481 *
Matthew Barthab8e4b82021-05-27 13:25:46 -0500482 * Sets the poweron target value for the zone from the JSON configuration
Matthew Barthe47c9582021-03-09 14:24:02 -0600483 * object
Matthew Barth4f0d3b72020-08-27 14:32:15 -0500484 */
Matthew Barthab8e4b82021-05-27 13:25:46 -0500485 void setPowerOnTarget(const json& jsonObj);
Matthew Barth4f0d3b72020-08-27 14:32:15 -0500486
487 /**
Matthew Barth216229c2020-09-24 13:47:33 -0500488 * @brief Parse and set the interfaces served by the zone(OPTIONAL)
Matthew Barth651f03a2020-08-27 16:15:11 -0500489 *
490 * @param[in] jsonObj - JSON object for the zone
491 *
Matthew Barth216229c2020-09-24 13:47:33 -0500492 * Constructs any zone interface handler functions for interfaces that the
493 * zone serves which contains the interface's property's value and
494 * persistency state (OPTIONAL). A property's "persist" state is defaulted
495 * to not be persisted when not given.
Matthew Barth651f03a2020-08-27 16:15:11 -0500496 */
497 void setInterfaces(const json& jsonObj);
Matthew Bartha0dd1352021-03-09 11:10:49 -0600498
499 /**
Matthew Barth2b3253e2021-03-09 14:51:16 -0600500 * @brief Get the request target base if defined, otherwise the the current
501 * target is returned
502 *
503 * @return - The request target base or current target
504 */
505 inline auto getRequestTargetBase() const
506 {
507 return (_requestTargetBase != 0) ? _requestTargetBase : _target;
508 };
Matthew Barth4f0d3b72020-08-27 14:32:15 -0500509};
510
Matthew Barth651f03a2020-08-27 16:15:11 -0500511/**
512 * Properties of interfaces supported by the zone configuration
513 */
514namespace zone::property
515{
516
517/**
Matthew Barth216229c2020-09-24 13:47:33 -0500518 * @brief "Supported" property on the "xyz.openbmc_project.Control.ThermalMode"
Matthew Barthbc89a8a2021-05-25 15:42:58 -0500519 * interface parser. Also creates the handler function for the Zone dbus object
520 * to initialize the property according to what's parsed from the configuration.
Matthew Barth651f03a2020-08-27 16:15:11 -0500521 *
522 * @param[in] jsonObj - JSON object for the "Supported" property
Matthew Barth216229c2020-09-24 13:47:33 -0500523 * @param[in] persist - Whether to persist the value or not
Matthew Barth651f03a2020-08-27 16:15:11 -0500524 *
Matthew Barthbc89a8a2021-05-25 15:42:58 -0500525 * @return Zone dbus object's set property function for the "Supported" property
Matthew Barth651f03a2020-08-27 16:15:11 -0500526 */
Matthew Barthbc89a8a2021-05-25 15:42:58 -0500527std::function<void(DBusZone&, Zone&)> supported(const json& jsonObj,
528 bool persist);
Matthew Barth651f03a2020-08-27 16:15:11 -0500529
530/**
Matthew Barth216229c2020-09-24 13:47:33 -0500531 * @brief "Current" property on the "xyz.openbmc_project.Control.ThermalMode"
Matthew Barthbc89a8a2021-05-25 15:42:58 -0500532 * interface parser. Also creates the handler function for the Zone dbus object
533 * to initialize the property according to what's parsed from the configuration.
Matthew Barth651f03a2020-08-27 16:15:11 -0500534 *
535 * @param[in] jsonObj - JSON object for the "Current" property
Matthew Barth216229c2020-09-24 13:47:33 -0500536 * @param[in] persist - Whether to persist the value or not
Matthew Barth651f03a2020-08-27 16:15:11 -0500537 *
Matthew Barthbc89a8a2021-05-25 15:42:58 -0500538 * @return Zone dbus object's set property function for the "Current" property
Matthew Barth651f03a2020-08-27 16:15:11 -0500539 */
Matthew Barthbc89a8a2021-05-25 15:42:58 -0500540std::function<void(DBusZone&, Zone&)> current(const json& jsonObj,
541 bool persist);
Matthew Barth651f03a2020-08-27 16:15:11 -0500542
543} // namespace zone::property
544
Matthew Barth4f0d3b72020-08-27 14:32:15 -0500545} // namespace phosphor::fan::control::json