blob: 50d87186eafd4447d63b01b292b5b0b063371aa5 [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 Barthe47c9582021-03-09 14:24:02 -060079 * @brief Get the default ceiling
Matthew Barth4f0d3b72020-08-27 14:32:15 -050080 *
Matthew Barthe47c9582021-03-09 14:24:02 -060081 * Default ceiling is the highest target the fans within this zone is
82 * allowed to increase to. The zone's ceiling defaults to this unless
83 * changed by some configured event.
Matthew Barth4f0d3b72020-08-27 14:32:15 -050084 *
Matthew Barthe47c9582021-03-09 14:24:02 -060085 * @return Default ceiling of this zone
Matthew Barth4f0d3b72020-08-27 14:32:15 -050086 */
Matthew Barthe47c9582021-03-09 14:24:02 -060087 inline const auto& getDefaultCeiling() const
Matthew Barth4f0d3b72020-08-27 14:32:15 -050088 {
Matthew Barthe47c9582021-03-09 14:24:02 -060089 return _defaultCeiling;
Matthew Barth4f0d3b72020-08-27 14:32:15 -050090 }
91
92 /**
Matthew Barthe47c9582021-03-09 14:24:02 -060093 * @brief Get the default floor
Matthew Barth4f0d3b72020-08-27 14:32:15 -050094 *
Matthew Barthe47c9582021-03-09 14:24:02 -060095 * The default floor is the lowest target the fans within this zone
96 * are allowed to decrease to. The zone's floor defaults to this
Matthew Barth4f0d3b72020-08-27 14:32:15 -050097 * unless changed by some configured event.
98 *
Matthew Barthe47c9582021-03-09 14:24:02 -060099 * @return Default floor
Matthew Barth4f0d3b72020-08-27 14:32:15 -0500100 */
101 inline const auto& getDefaultFloor() const
102 {
103 return _defaultFloor;
104 }
105
106 /**
Matthew Barthe47c9582021-03-09 14:24:02 -0600107 * @brief Get the increase delay(OPTIONAL)
Matthew Barth4f0d3b72020-08-27 14:32:15 -0500108 *
Matthew Barthe47c9582021-03-09 14:24:02 -0600109 * The increase delay is the amount of time(in seconds) increases
110 * to a target are delayed before being made. The default is 0, which
111 * results in immediate increase requests when any events result in
112 * a change to the target.
Matthew Barth4f0d3b72020-08-27 14:32:15 -0500113 *
114 * It is recommend a value other than 0 is configured, but that inherently
Matthew Barthe47c9582021-03-09 14:24:02 -0600115 * depends on the fan controller and configured increases.
Matthew Barth4f0d3b72020-08-27 14:32:15 -0500116 *
Matthew Barthe47c9582021-03-09 14:24:02 -0600117 * @return Increase delay(in seconds)
Matthew Barth4f0d3b72020-08-27 14:32:15 -0500118 */
119 inline const auto& getIncDelay() const
120 {
121 return _incDelay;
122 }
123
124 /**
Matthew Barthe47c9582021-03-09 14:24:02 -0600125 * @brief Get the decrease interval
Matthew Barth4f0d3b72020-08-27 14:32:15 -0500126 *
Matthew Barthe47c9582021-03-09 14:24:02 -0600127 * Decreases happen on a set interval when no requests for an increase
128 * in fan targets exists. This is the interval(in seconds) at which the fans
Matthew Barth4f0d3b72020-08-27 14:32:15 -0500129 * within the zone are decreased if events exist that result in a target
Matthew Barthe47c9582021-03-09 14:24:02 -0600130 * decrease.
Matthew Barth4f0d3b72020-08-27 14:32:15 -0500131 *
Matthew Barthe47c9582021-03-09 14:24:02 -0600132 * @return Decrease interval(in seconds)
Matthew Barth4f0d3b72020-08-27 14:32:15 -0500133 */
134 inline const auto& getDecInterval() const
135 {
136 return _decInterval;
137 }
138
Matthew Barth651f03a2020-08-27 16:15:11 -0500139 /**
Matthew Barth6f787302021-03-25 15:01:01 -0500140 * @brief Get the current target of the zone
141 *
142 * @return - The current target of the zone
143 */
144 inline const auto& getTarget() const
145 {
146 return _target;
147 }
148
149 /**
Matthew Barthdc776c82021-02-25 16:06:16 -0600150 * @brief Get the target increase delta
151 *
152 * @return - The current target increase delta
153 */
154 inline auto& getIncDelta() const
155 {
156 return _incDelta;
157 };
158
159 /**
Matthew Barth45c44ea2021-03-03 13:16:14 -0600160 * @brief Get the target decrease delta
161 *
162 * @return - The current target decrease delta
163 */
164 inline auto& getDecDelta() const
165 {
166 return _decDelta;
167 };
168
169 /**
Matthew Barth603ef162021-03-24 15:34:53 -0500170 * @brief Get the manager of the zone
171 *
172 * @return - The manager of the zone
173 */
174 inline auto* getManager() const
175 {
176 return _manager;
177 }
178
179 /**
Matthew Barth14303a42021-05-21 13:04:08 -0500180 * @brief Enable the zone
181 *
182 * Performs the necessary tasks to enable the zone such as restoring any
183 * dbus property states(if persisted), starting the decrement timer, etc...
184 */
185 void enable();
186
187 /**
Matthew Barthde90fb42021-03-04 16:34:28 -0600188 * @brief Add a fan object to the zone
189 *
190 * @param[in] fan - Unique pointer to a fan object that will be moved into
191 * the zone
192 *
193 * Adds a fan object to the list of fans that make up the zone by moving the
194 * fan object into the list.
195 */
196 void addFan(std::unique_ptr<Fan> fan);
197
Matthew Barth12cb1252021-03-08 16:47:30 -0600198 /**
Matthew Barth8ba715e2021-03-05 09:00:05 -0600199 * Sets all fans in the zone to the target given when the zone is active
200 *
201 * @param[in] target - Target for fans
202 */
203 void setTarget(uint64_t target);
204
205 /**
206 * @brief Sets the automatic fan control allowed active state
207 *
208 * @param[in] ident - An identifier that affects the active state
209 * @param[in] isActiveAllow - Active state according to group
210 */
211 void setActiveAllow(const std::string& ident, bool isActiveAllow);
212
213 /**
Matthew Barth12cb1252021-03-08 16:47:30 -0600214 * @brief Set the floor to the given target and increase target to the floor
215 * when the target is below the floor value when floor changes are allowed.
216 *
217 * @param[in] target - Target to set the floor to
218 */
219 void setFloor(uint64_t target);
220
221 /**
222 * @brief Sets the floor change allowed state
223 *
224 * @param[in] ident - An identifier that affects floor changes
225 * @param[in] isAllow - Allow state according to the identifier
226 */
227 inline void setFloorChangeAllow(const std::string& ident, bool isAllow)
228 {
229 _floorChange[ident] = isAllow;
230 }
231
232 /**
Matthew Barth45c44ea2021-03-03 13:16:14 -0600233 * @brief Sets the decrease allowed state of a group
234 *
235 * @param[in] ident - An identifier that affects speed decreases
236 * @param[in] isAllow - Allow state according to the identifier
237 */
238 inline void setDecreaseAllow(const std::string& ident, bool isAllow)
239 {
240 _decAllowed[ident] = isAllow;
241 }
242
243 /**
Matthew Barth12cb1252021-03-08 16:47:30 -0600244 * @brief Calculate the requested target from the given delta and increases
245 * the fans, not going above the ceiling.
246 *
247 * @param[in] targetDelta - The delta to increase the target by
248 */
249 void requestIncrease(uint64_t targetDelta);
250
Matthew Bartha0dd1352021-03-09 11:10:49 -0600251 /**
Matthew Barth007de092021-03-25 13:56:04 -0500252 * @brief Callback function for the increase timer that delays
253 * processing of requested target increases while fans are increasing
254 */
255 void incTimerExpired();
256
257 /**
Matthew Barth45c44ea2021-03-03 13:16:14 -0600258 * @brief Calculate the lowest requested decrease target from the given
259 * delta within a decrease interval.
260 *
261 * @param[in] targetDelta - The delta to decrease the target by
262 */
263 void requestDecrease(uint64_t targetDelta);
264
265 /**
Matthew Barth007de092021-03-25 13:56:04 -0500266 * @brief Callback function for the decrease timer that processes any
267 * requested target decreases if allowed
268 */
269 void decTimerExpired();
270
271 /**
Matthew Barth07fecfc2021-01-29 09:04:43 -0600272 * @brief Set the requested target base to be used as the target to base a
273 * new requested target from
274 *
275 * @param[in] targetBase - Base target value to use
276 */
277 inline void setRequestTargetBase(uint64_t targetBase)
278 {
279 _requestTargetBase = targetBase;
280 };
281
282 /**
Matthew Bartha0dd1352021-03-09 11:10:49 -0600283 * @brief Set a property to be persisted
284 *
285 * @param[in] intf - Interface containing property
286 * @param[in] prop - Property to be persisted
287 */
288 void setPersisted(const std::string& intf, const std::string& prop);
289
290 /**
Matthew Barth279183f2021-05-25 10:19:43 -0500291 * @brief Is the property persisted
292 *
293 * @param[in] intf - Interface containing property
294 * @param[in] prop - Property to check if persisted
295 *
296 * @return - True if property is to be persisted, false otherwise
297 */
298 bool isPersisted(const std::string& intf, const std::string& prop) const;
299
300 /**
Matthew Barthb584d812021-03-11 15:55:04 -0600301 * @brief A handler function to set/update a property on a zone
302 * @details Sets or updates a zone's dbus property to the given value using
303 * the provided base dbus object's set property function
304 *
305 * @param[in] intf - Interface on zone object
306 * @param[in] prop - Property on interface
Matthew Barthbc89a8a2021-05-25 15:42:58 -0500307 * @param[in] func - Zone dbus object's set property function pointer
Matthew Barthb584d812021-03-11 15:55:04 -0600308 * @param[in] value - Value to set property to
309 * @param[in] persist - Persist property value or not
310 *
311 * @return Lambda function
Matthew Barthbc89a8a2021-05-25 15:42:58 -0500312 * A lambda function to set/update the zone dbus object's property
Matthew Barthb584d812021-03-11 15:55:04 -0600313 */
314 template <typename T>
315 static auto setProperty(const char* intf, const char* prop,
Matthew Barthbc89a8a2021-05-25 15:42:58 -0500316 T (DBusZone::*func)(T), T&& value, bool persist)
Matthew Barthb584d812021-03-11 15:55:04 -0600317 {
Matthew Barthbc89a8a2021-05-25 15:42:58 -0500318 return [=, value = std::forward<T>(value)](DBusZone& dbusZone,
319 Zone& zone) {
320 (dbusZone.*func)(value);
Matthew Barthb584d812021-03-11 15:55:04 -0600321 if (persist)
322 {
Matthew Barthbc89a8a2021-05-25 15:42:58 -0500323 zone.setPersisted(intf, prop);
Matthew Barthb584d812021-03-11 15:55:04 -0600324 }
325 };
326 }
327
328 /**
329 * @brief A handler function to set/update a zone's dbus property's persist
330 * state
331 * @details Sets or updates a zone's dbus property's persist state where the
332 * value of the property is to be left unchanged
333 *
334 * @param[in] intf - Interface on zone object
335 * @param[in] prop - Property on interface
336 * @param[in] persist - Persist property value or not
337 *
338 * @return Lambda function
Matthew Barthbc89a8a2021-05-25 15:42:58 -0500339 * A lambda function to set/update the zone's dbus object's property's
340 * persist state
Matthew Barthb584d812021-03-11 15:55:04 -0600341 */
342 static auto setPropertyPersist(const char* intf, const char* prop,
343 bool persist)
344 {
Matthew Barthbc89a8a2021-05-25 15:42:58 -0500345 return [=](DBusZone&, Zone& zone) {
Matthew Barthb584d812021-03-11 15:55:04 -0600346 if (persist)
347 {
Matthew Barthbc89a8a2021-05-25 15:42:58 -0500348 zone.setPersisted(intf, prop);
Matthew Barthb584d812021-03-11 15:55:04 -0600349 }
350 };
351 }
352
Matthew Barth4f0d3b72020-08-27 14:32:15 -0500353 private:
Matthew Barthbc89a8a2021-05-25 15:42:58 -0500354 /* The zone's associated dbus object */
355 std::unique_ptr<DBusZone> _dbusZone;
356
Matthew Barth603ef162021-03-24 15:34:53 -0500357 /* The zone's manager */
358 Manager* _manager;
359
Matthew Barthab8e4b82021-05-27 13:25:46 -0500360 /* The zone's poweron target value for fans */
361 uint64_t _poweronTarget;
362
Matthew Barthe47c9582021-03-09 14:24:02 -0600363 /* The zone's default ceiling value for fans */
364 uint64_t _defaultCeiling;
Matthew Barth4f0d3b72020-08-27 14:32:15 -0500365
Matthew Barthe47c9582021-03-09 14:24:02 -0600366 /* The zone's default floor value for fans */
Matthew Barth4f0d3b72020-08-27 14:32:15 -0500367 uint64_t _defaultFloor;
368
Matthew Barthe47c9582021-03-09 14:24:02 -0600369 /* Zone's increase delay(in seconds) (OPTIONAL) */
Matthew Barth007de092021-03-25 13:56:04 -0500370 std::chrono::seconds _incDelay;
Matthew Barth4f0d3b72020-08-27 14:32:15 -0500371
Matthew Barthe47c9582021-03-09 14:24:02 -0600372 /* Zone's decrease interval(in seconds) */
Matthew Barth007de092021-03-25 13:56:04 -0500373 std::chrono::seconds _decInterval;
Matthew Barth4f0d3b72020-08-27 14:32:15 -0500374
Matthew Barth12cb1252021-03-08 16:47:30 -0600375 /* The floor target to not go below */
376 uint64_t _floor;
377
378 /* Target for this zone */
379 uint64_t _target;
380
Matthew Barth2b3253e2021-03-09 14:51:16 -0600381 /* Zone increase delta */
382 uint64_t _incDelta;
383
Matthew Barth45c44ea2021-03-03 13:16:14 -0600384 /* Zone decrease delta */
385 uint64_t _decDelta;
386
Matthew Barth2b3253e2021-03-09 14:51:16 -0600387 /* The ceiling target to not go above */
388 uint64_t _ceiling;
389
390 /* Requested target base */
391 uint64_t _requestTargetBase;
392
Matthew Barth12cb1252021-03-08 16:47:30 -0600393 /* Map of whether floor changes are allowed by a string identifier */
394 std::map<std::string, bool> _floorChange;
395
Matthew Barth45c44ea2021-03-03 13:16:14 -0600396 /* Map of controlling decreases allowed by a string identifer */
397 std::map<std::string, bool> _decAllowed;
398
Matthew Bartha0dd1352021-03-09 11:10:49 -0600399 /* Map of interfaces to persisted properties the zone hosts*/
400 std::map<std::string, std::vector<std::string>> _propsPersisted;
401
Matthew Barth8ba715e2021-03-05 09:00:05 -0600402 /* Automatic fan control active state */
403 bool _isActive;
404
Matthew Barth007de092021-03-25 13:56:04 -0500405 /* The target increase timer object */
406 Timer _incTimer;
407
408 /* The target decrease timer object */
409 Timer _decTimer;
410
Matthew Barth8ba715e2021-03-05 09:00:05 -0600411 /* Map of active fan control allowed by a string identifier */
412 std::map<std::string, bool> _active;
413
Matthew Barthb584d812021-03-11 15:55:04 -0600414 /* Interface to property mapping of their associated set property handler
415 * function */
416 static const std::map<
417 std::string,
Matthew Barthbc89a8a2021-05-25 15:42:58 -0500418 std::map<std::string, std::function<std::function<void(
419 DBusZone&, Zone&)>(const json&, bool)>>>
Matthew Barth216229c2020-09-24 13:47:33 -0500420 _intfPropHandlers;
Matthew Barth651f03a2020-08-27 16:15:11 -0500421
Matthew Barthde90fb42021-03-04 16:34:28 -0600422 /* List of fans included in this zone */
423 std::vector<std::unique_ptr<Fan>> _fans;
424
Matthew Barthbc89a8a2021-05-25 15:42:58 -0500425 /* List of configured interface set property functions */
426 std::vector<std::function<void(DBusZone&, Zone&)>> _propInitFunctions;
427
Matthew Barth4f0d3b72020-08-27 14:32:15 -0500428 /**
Matthew Barthab8e4b82021-05-27 13:25:46 -0500429 * @brief Parse and set the zone's poweron target value
Matthew Barth4f0d3b72020-08-27 14:32:15 -0500430 *
431 * @param[in] jsonObj - JSON object for the zone
432 *
Matthew Barthab8e4b82021-05-27 13:25:46 -0500433 * Sets the poweron target value for the zone from the JSON configuration
Matthew Barthe47c9582021-03-09 14:24:02 -0600434 * object
Matthew Barth4f0d3b72020-08-27 14:32:15 -0500435 */
Matthew Barthab8e4b82021-05-27 13:25:46 -0500436 void setPowerOnTarget(const json& jsonObj);
Matthew Barth4f0d3b72020-08-27 14:32:15 -0500437
438 /**
439 * @brief Parse and set the zone's decrease interval(in seconds)
440 *
441 * @param[in] jsonObj - JSON object for the zone
442 *
Matthew Barthe47c9582021-03-09 14:24:02 -0600443 * Sets the decrease interval(in seconds) for the zone from the JSON
Matthew Barth4f0d3b72020-08-27 14:32:15 -0500444 * configuration object
445 */
446 void setDecInterval(const json& jsonObj);
Matthew Barth651f03a2020-08-27 16:15:11 -0500447
448 /**
Matthew Barth216229c2020-09-24 13:47:33 -0500449 * @brief Parse and set the interfaces served by the zone(OPTIONAL)
Matthew Barth651f03a2020-08-27 16:15:11 -0500450 *
451 * @param[in] jsonObj - JSON object for the zone
452 *
Matthew Barth216229c2020-09-24 13:47:33 -0500453 * Constructs any zone interface handler functions for interfaces that the
454 * zone serves which contains the interface's property's value and
455 * persistency state (OPTIONAL). A property's "persist" state is defaulted
456 * to not be persisted when not given.
Matthew Barth651f03a2020-08-27 16:15:11 -0500457 */
458 void setInterfaces(const json& jsonObj);
Matthew Bartha0dd1352021-03-09 11:10:49 -0600459
460 /**
Matthew Barth2b3253e2021-03-09 14:51:16 -0600461 * @brief Get the request target base if defined, otherwise the the current
462 * target is returned
463 *
464 * @return - The request target base or current target
465 */
466 inline auto getRequestTargetBase() const
467 {
468 return (_requestTargetBase != 0) ? _requestTargetBase : _target;
469 };
Matthew Barth4f0d3b72020-08-27 14:32:15 -0500470};
471
Matthew Barth651f03a2020-08-27 16:15:11 -0500472/**
473 * Properties of interfaces supported by the zone configuration
474 */
475namespace zone::property
476{
477
478/**
Matthew Barth216229c2020-09-24 13:47:33 -0500479 * @brief "Supported" property on the "xyz.openbmc_project.Control.ThermalMode"
Matthew Barthbc89a8a2021-05-25 15:42:58 -0500480 * interface parser. Also creates the handler function for the Zone dbus object
481 * to initialize the property according to what's parsed from the configuration.
Matthew Barth651f03a2020-08-27 16:15:11 -0500482 *
483 * @param[in] jsonObj - JSON object for the "Supported" property
Matthew Barth216229c2020-09-24 13:47:33 -0500484 * @param[in] persist - Whether to persist the value or not
Matthew Barth651f03a2020-08-27 16:15:11 -0500485 *
Matthew Barthbc89a8a2021-05-25 15:42:58 -0500486 * @return Zone dbus object's set property function for the "Supported" property
Matthew Barth651f03a2020-08-27 16:15:11 -0500487 */
Matthew Barthbc89a8a2021-05-25 15:42:58 -0500488std::function<void(DBusZone&, Zone&)> supported(const json& jsonObj,
489 bool persist);
Matthew Barth651f03a2020-08-27 16:15:11 -0500490
491/**
Matthew Barth216229c2020-09-24 13:47:33 -0500492 * @brief "Current" property on the "xyz.openbmc_project.Control.ThermalMode"
Matthew Barthbc89a8a2021-05-25 15:42:58 -0500493 * interface parser. Also creates the handler function for the Zone dbus object
494 * to initialize the property according to what's parsed from the configuration.
Matthew Barth651f03a2020-08-27 16:15:11 -0500495 *
496 * @param[in] jsonObj - JSON object for the "Current" property
Matthew Barth216229c2020-09-24 13:47:33 -0500497 * @param[in] persist - Whether to persist the value or not
Matthew Barth651f03a2020-08-27 16:15:11 -0500498 *
Matthew Barthbc89a8a2021-05-25 15:42:58 -0500499 * @return Zone dbus object's set property function for the "Current" property
Matthew Barth651f03a2020-08-27 16:15:11 -0500500 */
Matthew Barthbc89a8a2021-05-25 15:42:58 -0500501std::function<void(DBusZone&, Zone&)> current(const json& jsonObj,
502 bool persist);
Matthew Barth651f03a2020-08-27 16:15:11 -0500503
504} // namespace zone::property
505
Matthew Barth4f0d3b72020-08-27 14:32:15 -0500506} // namespace phosphor::fan::control::json