blob: 5176c4b44ef3b9403fccdfb3fa9a1888aaf70693 [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 Barthde90fb42021-03-04 16:34:28 -060019#include "fan.hpp"
Matthew Bartha0dd1352021-03-09 11:10:49 -060020#include "xyz/openbmc_project/Control/ThermalMode/server.hpp"
Matthew Barth4f0d3b72020-08-27 14:32:15 -050021
22#include <nlohmann/json.hpp>
Matthew Barthacd737c2021-03-04 11:04:01 -060023#include <sdbusplus/bus.hpp>
Matthew Barth603ef162021-03-24 15:34:53 -050024#include <sdeventplus/event.hpp>
Matthew Barth007de092021-03-25 13:56:04 -050025#include <sdeventplus/utility/timer.hpp>
Matthew Barth4f0d3b72020-08-27 14:32:15 -050026
Matthew Barth651f03a2020-08-27 16:15:11 -050027#include <any>
Matthew Barth007de092021-03-25 13:56:04 -050028#include <chrono>
Matthew Barth651f03a2020-08-27 16:15:11 -050029#include <functional>
30#include <map>
31#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 Bartha0dd1352021-03-09 11:10:49 -060040/* Extend the Control::ThermalMode interface */
41using ThermalObject = sdbusplus::server::object::object<
42 sdbusplus::xyz::openbmc_project::Control::server::ThermalMode>;
43
Matthew Barth007de092021-03-25 13:56:04 -050044/* Dbus event timer */
45using Timer = sdeventplus::utility::Timer<sdeventplus::ClockId::Monotonic>;
46
Matthew Barth4f0d3b72020-08-27 14:32:15 -050047/**
48 * @class Zone - Represents a configured fan control zone
49 *
50 * A zone object contains the configured attributes for a zone that groups
Matthew Barthe47c9582021-03-09 14:24:02 -060051 * a number of fans together to be under the same target control. These
52 * configuration attributes include, but are not limited to, the default ceiling
53 * of the fans within the zone, a default floor, the delay between increases, a
54 * decrease interval, and any profiles(OPTIONAL) the zone should be included in.
Matthew Barth4f0d3b72020-08-27 14:32:15 -050055 *
56 * (When no profile for a zone is given, the zone defaults to always exist)
57 *
58 */
Matthew Bartha0dd1352021-03-09 11:10:49 -060059class Zone : public ConfigBase, public ThermalObject
Matthew Barth4f0d3b72020-08-27 14:32:15 -050060{
61 public:
62 /* JSON file name for zones */
63 static constexpr auto confFileName = "zones.json";
Matthew Barth216229c2020-09-24 13:47:33 -050064 static constexpr auto thermModeIntf =
65 "xyz.openbmc_project.Control.ThermalMode";
66 static constexpr auto supportedProp = "Supported";
67 static constexpr auto currentProp = "Current";
Matthew Barth651f03a2020-08-27 16:15:11 -050068
Matthew Barth4f0d3b72020-08-27 14:32:15 -050069 Zone() = delete;
70 Zone(const Zone&) = delete;
71 Zone(Zone&&) = delete;
72 Zone& operator=(const Zone&) = delete;
73 Zone& operator=(Zone&&) = delete;
74 ~Zone() = default;
75
76 /**
77 * Constructor
78 * Parses and populates a zone from JSON object data
79 *
Matthew Barth4f0d3b72020-08-27 14:32:15 -050080 * @param[in] jsonObj - JSON object
Matthew Barth603ef162021-03-24 15:34:53 -050081 * @param[in] event - sdeventplus event loop
82 * @param[in] mgr - Manager of this zone
Matthew Barth4f0d3b72020-08-27 14:32:15 -050083 */
Matthew Barth9403a212021-05-17 09:31:50 -050084 Zone(const json& jsonObj, const sdeventplus::Event& event, Manager* mgr);
Matthew Barth4f0d3b72020-08-27 14:32:15 -050085
86 /**
Matthew Barthe47c9582021-03-09 14:24:02 -060087 * @brief Get the default ceiling
Matthew Barth4f0d3b72020-08-27 14:32:15 -050088 *
Matthew Barthe47c9582021-03-09 14:24:02 -060089 * Default ceiling is the highest target the fans within this zone is
90 * allowed to increase to. The zone's ceiling defaults to this unless
91 * changed by some configured event.
Matthew Barth4f0d3b72020-08-27 14:32:15 -050092 *
Matthew Barthe47c9582021-03-09 14:24:02 -060093 * @return Default ceiling of this zone
Matthew Barth4f0d3b72020-08-27 14:32:15 -050094 */
Matthew Barthe47c9582021-03-09 14:24:02 -060095 inline const auto& getDefaultCeiling() const
Matthew Barth4f0d3b72020-08-27 14:32:15 -050096 {
Matthew Barthe47c9582021-03-09 14:24:02 -060097 return _defaultCeiling;
Matthew Barth4f0d3b72020-08-27 14:32:15 -050098 }
99
100 /**
Matthew Barthe47c9582021-03-09 14:24:02 -0600101 * @brief Get the default floor
Matthew Barth4f0d3b72020-08-27 14:32:15 -0500102 *
Matthew Barthe47c9582021-03-09 14:24:02 -0600103 * The default floor is the lowest target the fans within this zone
104 * are allowed to decrease to. The zone's floor defaults to this
Matthew Barth4f0d3b72020-08-27 14:32:15 -0500105 * unless changed by some configured event.
106 *
Matthew Barthe47c9582021-03-09 14:24:02 -0600107 * @return Default floor
Matthew Barth4f0d3b72020-08-27 14:32:15 -0500108 */
109 inline const auto& getDefaultFloor() const
110 {
111 return _defaultFloor;
112 }
113
114 /**
Matthew Barthe47c9582021-03-09 14:24:02 -0600115 * @brief Get the increase delay(OPTIONAL)
Matthew Barth4f0d3b72020-08-27 14:32:15 -0500116 *
Matthew Barthe47c9582021-03-09 14:24:02 -0600117 * The increase delay is the amount of time(in seconds) increases
118 * to a target are delayed before being made. The default is 0, which
119 * results in immediate increase requests when any events result in
120 * a change to the target.
Matthew Barth4f0d3b72020-08-27 14:32:15 -0500121 *
122 * It is recommend a value other than 0 is configured, but that inherently
Matthew Barthe47c9582021-03-09 14:24:02 -0600123 * depends on the fan controller and configured increases.
Matthew Barth4f0d3b72020-08-27 14:32:15 -0500124 *
Matthew Barthe47c9582021-03-09 14:24:02 -0600125 * @return Increase delay(in seconds)
Matthew Barth4f0d3b72020-08-27 14:32:15 -0500126 */
127 inline const auto& getIncDelay() const
128 {
129 return _incDelay;
130 }
131
132 /**
Matthew Barthe47c9582021-03-09 14:24:02 -0600133 * @brief Get the decrease interval
Matthew Barth4f0d3b72020-08-27 14:32:15 -0500134 *
Matthew Barthe47c9582021-03-09 14:24:02 -0600135 * Decreases happen on a set interval when no requests for an increase
136 * in fan targets exists. This is the interval(in seconds) at which the fans
Matthew Barth4f0d3b72020-08-27 14:32:15 -0500137 * within the zone are decreased if events exist that result in a target
Matthew Barthe47c9582021-03-09 14:24:02 -0600138 * decrease.
Matthew Barth4f0d3b72020-08-27 14:32:15 -0500139 *
Matthew Barthe47c9582021-03-09 14:24:02 -0600140 * @return Decrease interval(in seconds)
Matthew Barth4f0d3b72020-08-27 14:32:15 -0500141 */
142 inline const auto& getDecInterval() const
143 {
144 return _decInterval;
145 }
146
Matthew Barth651f03a2020-08-27 16:15:11 -0500147 /**
Matthew Barth6f787302021-03-25 15:01:01 -0500148 * @brief Get the current target of the zone
149 *
150 * @return - The current target of the zone
151 */
152 inline const auto& getTarget() const
153 {
154 return _target;
155 }
156
157 /**
Matthew Barthdc776c82021-02-25 16:06:16 -0600158 * @brief Get the target increase delta
159 *
160 * @return - The current target increase delta
161 */
162 inline auto& getIncDelta() const
163 {
164 return _incDelta;
165 };
166
167 /**
Matthew Barth45c44ea2021-03-03 13:16:14 -0600168 * @brief Get the target decrease delta
169 *
170 * @return - The current target decrease delta
171 */
172 inline auto& getDecDelta() const
173 {
174 return _decDelta;
175 };
176
177 /**
Matthew Barth603ef162021-03-24 15:34:53 -0500178 * @brief Get the manager of the zone
179 *
180 * @return - The manager of the zone
181 */
182 inline auto* getManager() const
183 {
184 return _manager;
185 }
186
187 /**
Matthew Barth14303a42021-05-21 13:04:08 -0500188 * @brief Enable the zone
189 *
190 * Performs the necessary tasks to enable the zone such as restoring any
191 * dbus property states(if persisted), starting the decrement timer, etc...
192 */
193 void enable();
194
195 /**
Matthew Barthde90fb42021-03-04 16:34:28 -0600196 * @brief Add a fan object to the zone
197 *
198 * @param[in] fan - Unique pointer to a fan object that will be moved into
199 * the zone
200 *
201 * Adds a fan object to the list of fans that make up the zone by moving the
202 * fan object into the list.
203 */
204 void addFan(std::unique_ptr<Fan> fan);
205
Matthew Barth12cb1252021-03-08 16:47:30 -0600206 /**
Matthew Barth8ba715e2021-03-05 09:00:05 -0600207 * Sets all fans in the zone to the target given when the zone is active
208 *
209 * @param[in] target - Target for fans
210 */
211 void setTarget(uint64_t target);
212
213 /**
214 * @brief Sets the automatic fan control allowed active state
215 *
216 * @param[in] ident - An identifier that affects the active state
217 * @param[in] isActiveAllow - Active state according to group
218 */
219 void setActiveAllow(const std::string& ident, bool isActiveAllow);
220
221 /**
Matthew Barth12cb1252021-03-08 16:47:30 -0600222 * @brief Set the floor to the given target and increase target to the floor
223 * when the target is below the floor value when floor changes are allowed.
224 *
225 * @param[in] target - Target to set the floor to
226 */
227 void setFloor(uint64_t target);
228
229 /**
230 * @brief Sets the floor change allowed state
231 *
232 * @param[in] ident - An identifier that affects floor changes
233 * @param[in] isAllow - Allow state according to the identifier
234 */
235 inline void setFloorChangeAllow(const std::string& ident, bool isAllow)
236 {
237 _floorChange[ident] = isAllow;
238 }
239
240 /**
Matthew Barth45c44ea2021-03-03 13:16:14 -0600241 * @brief Sets the decrease allowed state of a group
242 *
243 * @param[in] ident - An identifier that affects speed decreases
244 * @param[in] isAllow - Allow state according to the identifier
245 */
246 inline void setDecreaseAllow(const std::string& ident, bool isAllow)
247 {
248 _decAllowed[ident] = isAllow;
249 }
250
251 /**
Matthew Barth12cb1252021-03-08 16:47:30 -0600252 * @brief Calculate the requested target from the given delta and increases
253 * the fans, not going above the ceiling.
254 *
255 * @param[in] targetDelta - The delta to increase the target by
256 */
257 void requestIncrease(uint64_t targetDelta);
258
Matthew Bartha0dd1352021-03-09 11:10:49 -0600259 /**
Matthew Barth007de092021-03-25 13:56:04 -0500260 * @brief Callback function for the increase timer that delays
261 * processing of requested target increases while fans are increasing
262 */
263 void incTimerExpired();
264
265 /**
Matthew Barth45c44ea2021-03-03 13:16:14 -0600266 * @brief Calculate the lowest requested decrease target from the given
267 * delta within a decrease interval.
268 *
269 * @param[in] targetDelta - The delta to decrease the target by
270 */
271 void requestDecrease(uint64_t targetDelta);
272
273 /**
Matthew Barth007de092021-03-25 13:56:04 -0500274 * @brief Callback function for the decrease timer that processes any
275 * requested target decreases if allowed
276 */
277 void decTimerExpired();
278
279 /**
Matthew Barth07fecfc2021-01-29 09:04:43 -0600280 * @brief Set the requested target base to be used as the target to base a
281 * new requested target from
282 *
283 * @param[in] targetBase - Base target value to use
284 */
285 inline void setRequestTargetBase(uint64_t targetBase)
286 {
287 _requestTargetBase = targetBase;
288 };
289
290 /**
Matthew Bartha0dd1352021-03-09 11:10:49 -0600291 * @brief Set a property to be persisted
292 *
293 * @param[in] intf - Interface containing property
294 * @param[in] prop - Property to be persisted
295 */
296 void setPersisted(const std::string& intf, const std::string& prop);
297
298 /**
Matthew Barth279183f2021-05-25 10:19:43 -0500299 * @brief Is the property persisted
300 *
301 * @param[in] intf - Interface containing property
302 * @param[in] prop - Property to check if persisted
303 *
304 * @return - True if property is to be persisted, false otherwise
305 */
306 bool isPersisted(const std::string& intf, const std::string& prop) const;
307
308 /**
Matthew Bartha0dd1352021-03-09 11:10:49 -0600309 * @brief Overridden thermal object's set 'Current' property function
310 *
311 * @param[in] value - Value to set 'Current' to
312 *
313 * @return - The updated value of the 'Current' property
314 */
315 std::string current(std::string value) override;
316
Matthew Barthb584d812021-03-11 15:55:04 -0600317 /**
318 * @brief A handler function to set/update a property on a zone
319 * @details Sets or updates a zone's dbus property to the given value using
320 * the provided base dbus object's set property function
321 *
322 * @param[in] intf - Interface on zone object
323 * @param[in] prop - Property on interface
324 * @param[in] func - Zone object's set property function pointer
325 * @param[in] value - Value to set property to
326 * @param[in] persist - Persist property value or not
327 *
328 * @return Lambda function
329 * A lambda function to set/update the zone's dbus property
330 */
331 template <typename T>
332 static auto setProperty(const char* intf, const char* prop,
333 T (Zone::*func)(T), T&& value, bool persist)
334 {
335 return [=, value = std::forward<T>(value)](Zone* zone) {
336 (zone->*func)(value);
337 if (persist)
338 {
339 zone->setPersisted(intf, prop);
340 }
341 };
342 }
343
344 /**
345 * @brief A handler function to set/update a zone's dbus property's persist
346 * state
347 * @details Sets or updates a zone's dbus property's persist state where the
348 * value of the property is to be left unchanged
349 *
350 * @param[in] intf - Interface on zone object
351 * @param[in] prop - Property on interface
352 * @param[in] persist - Persist property value or not
353 *
354 * @return Lambda function
355 * A lambda function to set/update the zone's dbus property's persist
356 * state
357 */
358 static auto setPropertyPersist(const char* intf, const char* prop,
359 bool persist)
360 {
361 return [=](Zone* zone) {
362 if (persist)
363 {
364 zone->setPersisted(intf, prop);
365 }
366 };
367 }
368
Matthew Barth4f0d3b72020-08-27 14:32:15 -0500369 private:
Matthew Barth603ef162021-03-24 15:34:53 -0500370 /* The zone's manager */
371 Manager* _manager;
372
Matthew Barthe47c9582021-03-09 14:24:02 -0600373 /* The zone's default ceiling value for fans */
374 uint64_t _defaultCeiling;
Matthew Barth4f0d3b72020-08-27 14:32:15 -0500375
Matthew Barthe47c9582021-03-09 14:24:02 -0600376 /* The zone's default floor value for fans */
Matthew Barth4f0d3b72020-08-27 14:32:15 -0500377 uint64_t _defaultFloor;
378
Matthew Barthe47c9582021-03-09 14:24:02 -0600379 /* Zone's increase delay(in seconds) (OPTIONAL) */
Matthew Barth007de092021-03-25 13:56:04 -0500380 std::chrono::seconds _incDelay;
Matthew Barth4f0d3b72020-08-27 14:32:15 -0500381
Matthew Barthe47c9582021-03-09 14:24:02 -0600382 /* Zone's decrease interval(in seconds) */
Matthew Barth007de092021-03-25 13:56:04 -0500383 std::chrono::seconds _decInterval;
Matthew Barth4f0d3b72020-08-27 14:32:15 -0500384
Matthew Barth12cb1252021-03-08 16:47:30 -0600385 /* The floor target to not go below */
386 uint64_t _floor;
387
388 /* Target for this zone */
389 uint64_t _target;
390
Matthew Barth2b3253e2021-03-09 14:51:16 -0600391 /* Zone increase delta */
392 uint64_t _incDelta;
393
Matthew Barth45c44ea2021-03-03 13:16:14 -0600394 /* Zone decrease delta */
395 uint64_t _decDelta;
396
Matthew Barth2b3253e2021-03-09 14:51:16 -0600397 /* The ceiling target to not go above */
398 uint64_t _ceiling;
399
400 /* Requested target base */
401 uint64_t _requestTargetBase;
402
Matthew Barth12cb1252021-03-08 16:47:30 -0600403 /* Map of whether floor changes are allowed by a string identifier */
404 std::map<std::string, bool> _floorChange;
405
Matthew Barth45c44ea2021-03-03 13:16:14 -0600406 /* Map of controlling decreases allowed by a string identifer */
407 std::map<std::string, bool> _decAllowed;
408
Matthew Bartha0dd1352021-03-09 11:10:49 -0600409 /* Map of interfaces to persisted properties the zone hosts*/
410 std::map<std::string, std::vector<std::string>> _propsPersisted;
411
Matthew Barth8ba715e2021-03-05 09:00:05 -0600412 /* Automatic fan control active state */
413 bool _isActive;
414
Matthew Barth007de092021-03-25 13:56:04 -0500415 /* The target increase timer object */
416 Timer _incTimer;
417
418 /* The target decrease timer object */
419 Timer _decTimer;
420
Matthew Barth8ba715e2021-03-05 09:00:05 -0600421 /* Map of active fan control allowed by a string identifier */
422 std::map<std::string, bool> _active;
423
Matthew Barthb584d812021-03-11 15:55:04 -0600424 /* Interface to property mapping of their associated set property handler
425 * function */
426 static const std::map<
427 std::string,
428 std::map<std::string,
429 std::function<std::function<void(Zone*)>(const json&, bool)>>>
Matthew Barth216229c2020-09-24 13:47:33 -0500430 _intfPropHandlers;
Matthew Barth651f03a2020-08-27 16:15:11 -0500431
Matthew Barthde90fb42021-03-04 16:34:28 -0600432 /* List of fans included in this zone */
433 std::vector<std::unique_ptr<Fan>> _fans;
434
Matthew Barth4f0d3b72020-08-27 14:32:15 -0500435 /**
Matthew Barthe47c9582021-03-09 14:24:02 -0600436 * @brief Parse and set the zone's default ceiling value
Matthew Barth4f0d3b72020-08-27 14:32:15 -0500437 *
438 * @param[in] jsonObj - JSON object for the zone
439 *
Matthew Barthe47c9582021-03-09 14:24:02 -0600440 * Sets the default ceiling value for the zone from the JSON configuration
441 * object
Matthew Barth4f0d3b72020-08-27 14:32:15 -0500442 */
Matthew Barthe47c9582021-03-09 14:24:02 -0600443 void setDefaultCeiling(const json& jsonObj);
Matthew Barth4f0d3b72020-08-27 14:32:15 -0500444
445 /**
Matthew Barthe47c9582021-03-09 14:24:02 -0600446 * @brief Parse and set the zone's default floor value
Matthew Barth4f0d3b72020-08-27 14:32:15 -0500447 *
448 * @param[in] jsonObj - JSON object for the zone
449 *
Matthew Barthe47c9582021-03-09 14:24:02 -0600450 * Sets the default floor value for the zone from the JSON configuration
451 * object
Matthew Barth4f0d3b72020-08-27 14:32:15 -0500452 */
453 void setDefaultFloor(const json& jsonObj);
454
455 /**
456 * @brief Parse and set the zone's decrease interval(in seconds)
457 *
458 * @param[in] jsonObj - JSON object for the zone
459 *
Matthew Barthe47c9582021-03-09 14:24:02 -0600460 * Sets the decrease interval(in seconds) for the zone from the JSON
Matthew Barth4f0d3b72020-08-27 14:32:15 -0500461 * configuration object
462 */
463 void setDecInterval(const json& jsonObj);
Matthew Barth651f03a2020-08-27 16:15:11 -0500464
465 /**
Matthew Barth216229c2020-09-24 13:47:33 -0500466 * @brief Parse and set the interfaces served by the zone(OPTIONAL)
Matthew Barth651f03a2020-08-27 16:15:11 -0500467 *
468 * @param[in] jsonObj - JSON object for the zone
469 *
Matthew Barth216229c2020-09-24 13:47:33 -0500470 * Constructs any zone interface handler functions for interfaces that the
471 * zone serves which contains the interface's property's value and
472 * persistency state (OPTIONAL). A property's "persist" state is defaulted
473 * to not be persisted when not given.
Matthew Barth651f03a2020-08-27 16:15:11 -0500474 */
475 void setInterfaces(const json& jsonObj);
Matthew Bartha0dd1352021-03-09 11:10:49 -0600476
477 /**
Matthew Bartha0dd1352021-03-09 11:10:49 -0600478 * @brief Save the thermal control current mode property to persisted
479 * storage
480 */
481 void saveCurrentMode();
Matthew Barth2b3253e2021-03-09 14:51:16 -0600482
483 /**
Matthew Bartha4483742021-03-25 14:09:01 -0500484 * @brief Restore persisted thermal control current mode property
485 * value, setting the mode to "Default" otherwise
486 */
487 void restoreCurrentMode();
488
489 /**
Matthew Barth2b3253e2021-03-09 14:51:16 -0600490 * @brief Get the request target base if defined, otherwise the the current
491 * target is returned
492 *
493 * @return - The request target base or current target
494 */
495 inline auto getRequestTargetBase() const
496 {
497 return (_requestTargetBase != 0) ? _requestTargetBase : _target;
498 };
Matthew Barth4f0d3b72020-08-27 14:32:15 -0500499};
500
Matthew Barth651f03a2020-08-27 16:15:11 -0500501/**
502 * Properties of interfaces supported by the zone configuration
503 */
504namespace zone::property
505{
506
507/**
Matthew Barth216229c2020-09-24 13:47:33 -0500508 * @brief "Supported" property on the "xyz.openbmc_project.Control.ThermalMode"
Matthew Barthb584d812021-03-11 15:55:04 -0600509 * interface parser. Also creates the handler function for the Zone object to
510 * initialize the property according to what's parsed from the configuration.
Matthew Barth651f03a2020-08-27 16:15:11 -0500511 *
512 * @param[in] jsonObj - JSON object for the "Supported" property
Matthew Barth216229c2020-09-24 13:47:33 -0500513 * @param[in] persist - Whether to persist the value or not
Matthew Barth651f03a2020-08-27 16:15:11 -0500514 *
Matthew Barthb584d812021-03-11 15:55:04 -0600515 * @return Zone interface set property handler function for the "Supported"
516 * property
Matthew Barth651f03a2020-08-27 16:15:11 -0500517 */
Matthew Barthb584d812021-03-11 15:55:04 -0600518std::function<void(Zone*)> supported(const json& jsonObj, bool persist);
Matthew Barth651f03a2020-08-27 16:15:11 -0500519
520/**
Matthew Barth216229c2020-09-24 13:47:33 -0500521 * @brief "Current" property on the "xyz.openbmc_project.Control.ThermalMode"
Matthew Barthb584d812021-03-11 15:55:04 -0600522 * interface parser. Also creates the handler function for the Zone object to
523 * initialize the property according to what's parsed from the configuration.
Matthew Barth651f03a2020-08-27 16:15:11 -0500524 *
525 * @param[in] jsonObj - JSON object for the "Current" property
Matthew Barth216229c2020-09-24 13:47:33 -0500526 * @param[in] persist - Whether to persist the value or not
Matthew Barth651f03a2020-08-27 16:15:11 -0500527 *
Matthew Barthb584d812021-03-11 15:55:04 -0600528 * @return Zone interface set property handler function for the "Current"
529 * property
Matthew Barth651f03a2020-08-27 16:15:11 -0500530 */
Matthew Barthb584d812021-03-11 15:55:04 -0600531std::function<void(Zone*)> current(const json& jsonObj, bool persist);
Matthew Barth651f03a2020-08-27 16:15:11 -0500532
533} // namespace zone::property
534
Matthew Barth4f0d3b72020-08-27 14:32:15 -0500535} // namespace phosphor::fan::control::json