blob: 73761d038eb8e900d4fd299a11fcab478f6c18e4 [file] [log] [blame]
Matt Spinler7f88fe62017-04-10 14:39:02 -05001#pragma once
William A. Kennington III8fd879f2018-10-30 19:49:29 -07002#include <algorithm>
William A. Kennington III2c8e1982018-11-12 08:37:07 -08003#include <cassert>
Matthew Bartha9561842017-06-29 11:43:45 -05004#include <chrono>
Matt Spinler7f88fe62017-04-10 14:39:02 -05005#include <sdbusplus/bus.hpp>
William A. Kennington III1cfc2f12018-10-19 17:29:46 -07006#include <sdeventplus/event.hpp>
William A. Kennington III8fd879f2018-10-30 19:49:29 -07007#include <vector>
Matt Spinler7f88fe62017-04-10 14:39:02 -05008#include "fan.hpp"
9#include "types.hpp"
Matthew Barth93af4192019-01-18 09:30:57 -060010#include "xyz/openbmc_project/Control/ThermalMode/server.hpp"
Matt Spinler7f88fe62017-04-10 14:39:02 -050011
12namespace phosphor
13{
14namespace fan
15{
16namespace control
17{
18
Matthew Barth93af4192019-01-18 09:30:57 -060019using ThermalObject = sdbusplus::server::object::object<
20 sdbusplus::xyz::openbmc_project::Control::server::ThermalMode>;
21
Matt Spinler7f88fe62017-04-10 14:39:02 -050022/**
Matthew Barth14184132017-05-19 14:37:30 -050023 * The mode fan control will run in:
24 * - init - only do the initialization steps
25 * - control - run normal control algorithms
26 */
27enum class Mode
28{
29 init,
30 control
31};
32
33/**
Matt Spinler7f88fe62017-04-10 14:39:02 -050034 * @class Represents a fan control zone, which is a group of fans
35 * that behave the same.
36 */
Matthew Barth93af4192019-01-18 09:30:57 -060037class Zone : public ThermalObject
Matt Spinler7f88fe62017-04-10 14:39:02 -050038{
39 public:
40
41 Zone() = delete;
42 Zone(const Zone&) = delete;
Matthew Barth0081fdb2017-11-14 14:02:34 -060043 Zone(Zone&&) = delete;
Matt Spinler7f88fe62017-04-10 14:39:02 -050044 Zone& operator=(const Zone&) = delete;
45 Zone& operator=(Zone&&) = delete;
46 ~Zone() = default;
47
48 /**
49 * Constructor
50 * Creates the appropriate fan objects based on
51 * the zone definition data passed in.
52 *
Matthew Barth14184132017-05-19 14:37:30 -050053 * @param[in] mode - mode of fan control
Matt Spinler7f88fe62017-04-10 14:39:02 -050054 * @param[in] bus - the dbus object
Matthew Barth93af4192019-01-18 09:30:57 -060055 * @param[in] path - object instance path
William A. Kennington III1cfc2f12018-10-19 17:29:46 -070056 * @param[in] event - Event loop reference
Matt Spinler7f88fe62017-04-10 14:39:02 -050057 * @param[in] def - the fan zone definition data
58 */
Matthew Barth14184132017-05-19 14:37:30 -050059 Zone(Mode mode,
60 sdbusplus::bus::bus& bus,
Matthew Barth93af4192019-01-18 09:30:57 -060061 const std::string& path,
William A. Kennington III1cfc2f12018-10-19 17:29:46 -070062 const sdeventplus::Event& event,
Matt Spinler7f88fe62017-04-10 14:39:02 -050063 const ZoneDefinition& def);
64
65 /**
66 * Sets all fans in the zone to the speed
Matthew Barth60b00762017-08-15 13:39:06 -050067 * passed in when the zone is active
Matt Spinler7f88fe62017-04-10 14:39:02 -050068 *
69 * @param[in] speed - the fan speed
70 */
71 void setSpeed(uint64_t speed);
72
73 /**
Matthew Barth60b00762017-08-15 13:39:06 -050074 * Sets the zone to full speed regardless of zone's active state
Matt Spinler7f88fe62017-04-10 14:39:02 -050075 */
Matthew Barth60b00762017-08-15 13:39:06 -050076 void setFullSpeed();
Matt Spinler7f88fe62017-04-10 14:39:02 -050077
Matthew Barth38a93a82017-05-11 14:12:27 -050078 /**
Matthew Barth861d77c2017-05-22 14:18:25 -050079 * @brief Sets the automatic fan control allowed active state
80 *
81 * @param[in] group - A group that affects the active state
82 * @param[in] isActiveAllow - Active state according to group
83 */
84 void setActiveAllow(const Group* group, bool isActiveAllow);
85
86 /**
Matthew Barth98726c42017-10-17 10:35:20 -050087 * @brief Sets the floor change allowed state
88 *
89 * @param[in] group - A group that affects floor changes
90 * @param[in] isAllow - Allow state according to group
91 */
92 inline void setFloorChangeAllow(const Group* group, bool isAllow)
93 {
94 _floorChange[*(group)] = isAllow;
95 }
96
97 /**
Matthew Barthe4338cd2017-12-14 11:14:30 -060098 * @brief Sets the decrease allowed state of a group
99 *
100 * @param[in] group - A group that affects speed decreases
101 * @param[in] isAllow - Allow state according to group
102 */
103 inline void setDecreaseAllow(const Group* group, bool isAllow)
104 {
105 _decAllowed[*(group)] = isAllow;
106 }
107
108 /**
Matthew Barth38a93a82017-05-11 14:12:27 -0500109 * @brief Sets a given object's property value
110 *
111 * @param[in] object - Name of the object containing the property
Matthew Barthcec5ab72017-06-02 15:20:56 -0500112 * @param[in] interface - Interface name containing the property
Matthew Barth38a93a82017-05-11 14:12:27 -0500113 * @param[in] property - Property name
114 * @param[in] value - Property value
115 */
Matthew Barth9e741ed2017-06-02 16:29:09 -0500116 template <typename T>
Matthew Barth38a93a82017-05-11 14:12:27 -0500117 void setPropertyValue(const char* object,
Matthew Barthcec5ab72017-06-02 15:20:56 -0500118 const char* interface,
Matthew Barth38a93a82017-05-11 14:12:27 -0500119 const char* property,
Matthew Barth9e741ed2017-06-02 16:29:09 -0500120 T value)
Matthew Barth38a93a82017-05-11 14:12:27 -0500121 {
Matthew Barthcec5ab72017-06-02 15:20:56 -0500122 _properties[object][interface][property] = value;
Matthew Barth38a93a82017-05-11 14:12:27 -0500123 };
124
Matthew Barth17d1fe22017-05-11 15:00:36 -0500125 /**
126 * @brief Get the value of an object's property
127 *
128 * @param[in] object - Name of the object containing the property
Matthew Barthcec5ab72017-06-02 15:20:56 -0500129 * @param[in] interface - Interface name containing the property
Matthew Barth17d1fe22017-05-11 15:00:36 -0500130 * @param[in] property - Property name
131 *
132 * @return - The property value
133 */
Matthew Barth9e741ed2017-06-02 16:29:09 -0500134 template <typename T>
Matthew Barth17d1fe22017-05-11 15:00:36 -0500135 inline auto getPropertyValue(const std::string& object,
Matthew Barthcec5ab72017-06-02 15:20:56 -0500136 const std::string& interface,
Matthew Barth17d1fe22017-05-11 15:00:36 -0500137 const std::string& property)
138 {
Matthew Barth9e741ed2017-06-02 16:29:09 -0500139 return sdbusplus::message::variant_ns::get<T>(
Matthew Barthbc651602017-08-10 16:59:43 -0500140 _properties.at(object).at(interface).at(property));
Matthew Barth17d1fe22017-05-11 15:00:36 -0500141 };
142
Matthew Barth1de66622017-06-12 13:13:02 -0500143 /**
Matthew Barth604329e2017-08-04 11:18:28 -0500144 * @brief Get the object's property variant
145 *
146 * @param[in] object - Name of the object containing the property
147 * @param[in] interface - Interface name containing the property
148 * @param[in] property - Property name
149 *
150 * @return - The property variant
151 */
152 inline auto getPropValueVariant(const std::string& object,
153 const std::string& interface,
154 const std::string& property)
155 {
156 return _properties.at(object).at(interface).at(property);
157 };
158
159 /**
Matthew Barth1499a5c2018-03-20 15:52:33 -0500160 * @brief Remove an object's interface
161 *
162 * @param[in] object - Name of the object with the interface
163 * @param[in] interface - Interface name to remove
164 */
Matthew Barth30abbef2018-04-12 09:40:54 -0500165 inline void removeObjectInterface(const char* object,
166 const char* interface)
Matthew Barth1499a5c2018-03-20 15:52:33 -0500167 {
168 auto it = _properties.find(object);
169 if (it != std::end(_properties))
170 {
171 _properties[object].erase(interface);
172 }
173 }
174
175 /**
Matthew Barth55dea642017-11-06 13:34:32 -0600176 * @brief Remove a service associated to a group
177 *
178 * @param[in] group - Group associated with service
179 * @param[in] name - Service name to remove
180 */
181 void removeService(const Group* group,
182 const std::string& name);
183
184 /**
Matthew Barthe59fdf72017-09-27 09:33:42 -0500185 * @brief Set or update a service name owner in use
186 *
187 * @param[in] group - Group associated with service
188 * @param[in] name - Service name
189 * @param[in] hasOwner - Whether the service is owned or not
190 */
191 void setServiceOwner(const Group* group,
192 const std::string& name,
193 const bool hasOwner);
194
195 /**
Matthew Barth480787c2017-11-06 11:00:00 -0600196 * @brief Set or update all services for a group
197 *
198 * @param[in] group - Group to get service names for
199 */
200 void setServices(const Group* group);
201
202 /**
Matthew Barthbfb1a562017-10-05 17:03:40 -0500203 * @brief Get the group's list of service names
204 *
205 * @param[in] group - Group to get service names for
206 *
207 * @return - The list of service names
208 */
209 inline auto getGroupServices(const Group* group)
210 {
211 return _services.at(*group);
212 }
213
214 /**
Matthew Barth604329e2017-08-04 11:18:28 -0500215 * @brief Initialize a set speed event properties and actions
216 *
217 * @param[in] event - Set speed event
218 */
219 void initEvent(const SetSpeedEvent& event);
220
221 /**
Matthew Barthf6b76d82017-08-04 12:58:02 -0500222 * @brief Removes all the set speed event properties and actions
223 *
224 * @param[in] event - Set speed event
225 */
226 void removeEvent(const SetSpeedEvent& event);
227
228 /**
Matthew Barth1de66622017-06-12 13:13:02 -0500229 * @brief Get the default floor speed
230 *
231 * @return - The defined default floor speed
232 */
233 inline auto getDefFloor()
234 {
235 return _defFloorSpeed;
236 };
237
Matthew Barth4af419c2017-06-12 13:39:31 -0500238 /**
Matthew Barthe0ca13e2017-06-13 16:29:09 -0500239 * @brief Get the ceiling speed
240 *
241 * @return - The current ceiling speed
242 */
243 inline auto& getCeiling() const
244 {
245 return _ceilingSpeed;
246 };
247
248 /**
249 * @brief Set the ceiling speed to the given speed
250 *
251 * @param[in] speed - Speed to set the ceiling to
252 */
253 inline void setCeiling(uint64_t speed)
254 {
255 _ceilingSpeed = speed;
256 };
257
258 /**
259 * @brief Swaps the ceiling key value with what's given and
260 * returns the value that was swapped.
261 *
262 * @param[in] keyValue - New ceiling key value
263 *
264 * @return - Ceiling key value prior to swapping
265 */
266 inline auto swapCeilingKeyValue(int64_t keyValue)
267 {
268 std::swap(_ceilingKeyValue, keyValue);
269 return keyValue;
270 };
271
Matthew Barth24623522017-06-21 14:09:57 -0500272 /**
273 * @brief Get the increase speed delta
274 *
275 * @return - The current increase speed delta
276 */
277 inline auto& getIncSpeedDelta() const
278 {
279 return _incSpeedDelta;
280 };
281
Matthew Barth240397b2017-06-22 11:23:30 -0500282 /**
Matthew Barth0ce99d82017-06-22 15:07:29 -0500283 * @brief Get the decrease speed delta
284 *
285 * @return - The current decrease speed delta
286 */
287 inline auto& getDecSpeedDelta() const
288 {
289 return _decSpeedDelta;
290 };
291
292 /**
Matthew Barthb4a7cb92017-06-28 15:29:50 -0500293 * @brief Set the floor speed to the given speed and increase target
Matthew Barth98726c42017-10-17 10:35:20 -0500294 * speed to the floor when target is below floor where floor changes
295 * are allowed.
Matthew Barthb4a7cb92017-06-28 15:29:50 -0500296 *
297 * @param[in] speed - Speed to set the floor to
298 */
299 void setFloor(uint64_t speed);
300
301 /**
Matthew Barth1bfdc422017-09-14 16:23:28 -0500302 * @brief Set the requested speed base to be used as the speed to
303 * base a new requested speed target from
304 *
305 * @param[in] speedBase - Base speed value to use
306 */
307 inline void setRequestSpeedBase(uint64_t speedBase)
308 {
309 _requestSpeedBase = speedBase;
310 };
311
312 /**
Matthew Barth240397b2017-06-22 11:23:30 -0500313 * @brief Calculate the requested target speed from the given delta
314 * and increase the fan speeds, not going above the ceiling.
315 *
316 * @param[in] targetDelta - The delta to increase the target speed by
317 */
318 void requestSpeedIncrease(uint64_t targetDelta);
319
Matthew Barth0ce99d82017-06-22 15:07:29 -0500320 /**
321 * @brief Calculate the requested target speed from the given delta
322 * and increase the fan speeds, not going above the ceiling.
323 *
324 * @param[in] targetDelta - The delta to increase the target speed by
325 */
326 void requestSpeedDecrease(uint64_t targetDelta);
327
Matthew Barth8600d9a2017-06-23 14:38:05 -0500328 /**
Matthew Barth1ee48f22017-06-27 15:14:48 -0500329 * @brief Callback function for the increase timer that delays
330 * processing of requested speed increases while fans are increasing
331 */
332 void incTimerExpired();
333
334 /**
Matthew Barth8600d9a2017-06-23 14:38:05 -0500335 * @brief Callback function for the decrease timer that processes any
336 * requested speed decreases if allowed
337 */
338 void decTimerExpired();
339
Matthew Barth90149802017-08-15 10:51:37 -0500340 /**
William A. Kennington III1cfc2f12018-10-19 17:29:46 -0700341 * @brief Get the event loop used with this zone's timers
Matthew Barthbfb1a562017-10-05 17:03:40 -0500342 *
William A. Kennington III1cfc2f12018-10-19 17:29:46 -0700343 * @return - The event loop for timers
Matthew Barthbfb1a562017-10-05 17:03:40 -0500344 */
William A. Kennington III1cfc2f12018-10-19 17:29:46 -0700345 inline auto& getEventLoop()
Matthew Barthbfb1a562017-10-05 17:03:40 -0500346 {
William A. Kennington III1cfc2f12018-10-19 17:29:46 -0700347 return _eventLoop;
Matthew Barthbfb1a562017-10-05 17:03:40 -0500348 }
349
350 /**
Matthew Barth33bfe762018-11-05 11:13:25 -0600351 * @brief Get the list of signal events
352 *
353 * @return - List of signal events
354 */
355 inline auto& getSignalEvents()
356 {
357 return _signalEvents;
358 }
359
360 /**
361 * @brief Find the first instance of a signal event
362 *
363 * @param[in] signal - Event signal to find
364 * @param[in] eGroup - Group associated with the signal
365 * @param[in] eActions - List of actions associated with the signal
366 *
367 * @return - Iterator to the stored signal event
368 */
369 std::vector<SignalEvent>::iterator findSignal(
370 const Signal& signal,
371 const Group& eGroup,
372 const std::vector<Action>& eActions);
373
374 /**
375 * @brief Remove the given signal event
376 *
377 * @param[in] seIter - Iterator pointing to the signal event to remove
378 */
379 inline void removeSignal(std::vector<SignalEvent>::iterator& seIter)
380 {
381 assert(seIter != std::end(_signalEvents));
382 std::get<signalEventDataPos>(*seIter).reset();
383 if (std::get<signalMatchPos>(*seIter) != nullptr)
384 {
385 std::get<signalMatchPos>(*seIter).reset();
386 }
387 _signalEvents.erase(seIter);
388 }
389
390 /**
Matthew Barthbfb1a562017-10-05 17:03:40 -0500391 * @brief Get the list of timer events
392 *
393 * @return - List of timer events
394 */
395 inline auto& getTimerEvents()
396 {
397 return _timerEvents;
398 }
399
400 /**
401 * @brief Find the first instance of a timer event
402 *
403 * @param[in] eventGroup - Group associated with a timer
404 * @param[in] eventActions - List of actions associated with a timer
405 *
406 * @return - Iterator to the timer event
407 */
408 std::vector<TimerEvent>::iterator findTimer(
409 const Group& eventGroup,
410 const std::vector<Action>& eventActions);
411
412 /**
413 * @brief Add a timer to the list of timer based events
414 *
William A. Kennington III94fe1a02018-10-30 19:00:27 -0700415 * @param[in] group - Group associated with a timer
416 * @param[in] actions - List of actions associated with a timer
417 * @param[in] tConf - Configuration for the new timer
Matthew Barthbfb1a562017-10-05 17:03:40 -0500418 */
William A. Kennington III94fe1a02018-10-30 19:00:27 -0700419 void addTimer(const Group& group,
420 const std::vector<Action>& actions,
421 const TimerConf& tConf);
Matthew Barthbfb1a562017-10-05 17:03:40 -0500422
423 /**
424 * @brief Remove the given timer event
425 *
426 * @param[in] teIter - Iterator pointing to the timer event to remove
427 */
428 inline void removeTimer(std::vector<TimerEvent>::iterator& teIter)
429 {
Matthew Barthbfb1a562017-10-05 17:03:40 -0500430 _timerEvents.erase(teIter);
431 }
432
433 /**
Matthew Barth90149802017-08-15 10:51:37 -0500434 * @brief Callback function for event timers that processes the given
Matthew Barthf9201ab2017-09-11 16:07:58 -0500435 * actions for a group
Matthew Barth90149802017-08-15 10:51:37 -0500436 *
Matthew Barthf9201ab2017-09-11 16:07:58 -0500437 * @param[in] eventGroup - Group to process actions on
438 * @param[in] eventActions - List of event actions to run
Matthew Barth90149802017-08-15 10:51:37 -0500439 */
William A. Kennington IIIc0c5f072018-10-30 19:11:01 -0700440 void timerExpired(const Group& eventGroup,
441 const std::vector<Action>& eventActions);
Matthew Barth90149802017-08-15 10:51:37 -0500442
Matthew Bartha603ed02018-01-19 16:56:26 -0600443 /**
444 * @brief Get the service for a given path and interface from cached
445 * dataset and add a service that's not found
446 *
447 * @param[in] path - Path to get service for
448 * @param[in] intf - Interface to get service for
449 *
450 * @return - The service name
451 */
452 const std::string& getService(const std::string& path,
453 const std::string& intf);
454
455 /**
456 * @brief Add a set of services for a path and interface
457 * by retrieving all the path subtrees to the given depth
458 * from root for the interface
459 *
460 * @param[in] path - Path to add services for
461 * @param[in] intf - Interface to add services for
462 * @param[in] depth - Depth of tree traversal from root path
463 *
464 * @return - The associated service to the given path and interface
465 * or empty string for no service found
466 */
467 const std::string& addServices(const std::string& path,
468 const std::string& intf,
469 int32_t depth);
470
Matthew Barth6faf8942019-01-22 09:26:09 -0600471 /**
472 * @brief Overridden thermal object's set 'Current' property function
473 *
474 * @param[in] value - Value to set 'Current' to
475 *
476 * @return - The updated value of the 'Current' property
477 */
478 virtual std::string current(std::string value);
479
Matt Spinler7f88fe62017-04-10 14:39:02 -0500480 private:
481
482 /**
483 * The dbus object
484 */
485 sdbusplus::bus::bus& _bus;
486
487 /**
Matthew Barth93af4192019-01-18 09:30:57 -0600488 * Zone object path
489 */
490 const std::string _path;
491
492 /**
Matt Spinler7f88fe62017-04-10 14:39:02 -0500493 * Full speed for the zone
494 */
495 const uint64_t _fullSpeed;
496
497 /**
498 * The zone number
499 */
500 const size_t _zoneNum;
501
502 /**
Matthew Barth1de66622017-06-12 13:13:02 -0500503 * The default floor speed for the zone
504 */
505 const uint64_t _defFloorSpeed;
506
507 /**
Matthew Barthe0ca13e2017-06-13 16:29:09 -0500508 * The default ceiling speed for the zone
509 */
510 const uint64_t _defCeilingSpeed;
511
512 /**
Matthew Barth4af419c2017-06-12 13:39:31 -0500513 * The floor speed to not go below
514 */
515 uint64_t _floorSpeed = _defFloorSpeed;
516
517 /**
Matthew Barthe0ca13e2017-06-13 16:29:09 -0500518 * The ceiling speed to not go above
519 */
520 uint64_t _ceilingSpeed = _defCeilingSpeed;
521
522 /**
523 * The previous sensor value for calculating the ceiling
524 */
525 int64_t _ceilingKeyValue = 0;
526
527 /**
Matthew Barth861d77c2017-05-22 14:18:25 -0500528 * Automatic fan control active state
529 */
530 bool _isActive = true;
531
532 /**
Matthew Barth240397b2017-06-22 11:23:30 -0500533 * Target speed for this zone
534 */
535 uint64_t _targetSpeed = _fullSpeed;
536
537 /**
Matthew Barth24623522017-06-21 14:09:57 -0500538 * Speed increase delta
539 */
540 uint64_t _incSpeedDelta = 0;
541
542 /**
Matthew Barth0ce99d82017-06-22 15:07:29 -0500543 * Speed decrease delta
544 */
545 uint64_t _decSpeedDelta = 0;
546
547 /**
Matthew Barth1bfdc422017-09-14 16:23:28 -0500548 * Requested speed base
549 */
550 uint64_t _requestSpeedBase = 0;
551
552 /**
Matthew Bartha9561842017-06-29 11:43:45 -0500553 * Speed increase delay in seconds
554 */
555 std::chrono::seconds _incDelay;
556
557 /**
558 * Speed decrease interval in seconds
559 */
560 std::chrono::seconds _decInterval;
561
562 /**
Matthew Barth1ee48f22017-06-27 15:14:48 -0500563 * The increase timer object
564 */
William A. Kennington III8fd879f2018-10-30 19:49:29 -0700565 Timer _incTimer;
Matthew Barth1ee48f22017-06-27 15:14:48 -0500566
567 /**
Matthew Barth8600d9a2017-06-23 14:38:05 -0500568 * The decrease timer object
569 */
William A. Kennington III8fd879f2018-10-30 19:49:29 -0700570 Timer _decTimer;
Matthew Barth8600d9a2017-06-23 14:38:05 -0500571
572 /**
William A. Kennington III1cfc2f12018-10-19 17:29:46 -0700573 * Event loop used on set speed event timers
Matthew Barth90149802017-08-15 10:51:37 -0500574 */
William A. Kennington III1cfc2f12018-10-19 17:29:46 -0700575 sdeventplus::Event _eventLoop;
Matthew Barth90149802017-08-15 10:51:37 -0500576
577 /**
Matt Spinler7f88fe62017-04-10 14:39:02 -0500578 * The vector of fans in this zone
579 */
580 std::vector<std::unique_ptr<Fan>> _fans;
Matthew Barth38a93a82017-05-11 14:12:27 -0500581
582 /**
583 * @brief Map of object property values
584 */
Matthew Barthcec5ab72017-06-02 15:20:56 -0500585 std::map<std::string,
586 std::map<std::string,
587 std::map<std::string,
Matthew Barth9e741ed2017-06-02 16:29:09 -0500588 PropertyVariantType>>> _properties;
Matthew Barth38a93a82017-05-11 14:12:27 -0500589
590 /**
Matthew Barth861d77c2017-05-22 14:18:25 -0500591 * @brief Map of active fan control allowed by groups
592 */
Matthew Barth60b00762017-08-15 13:39:06 -0500593 std::map<const Group, bool> _active;
Matthew Barth861d77c2017-05-22 14:18:25 -0500594
595 /**
Matthew Barth98726c42017-10-17 10:35:20 -0500596 * @brief Map of floor change allowed by groups
597 */
598 std::map<const Group, bool> _floorChange;
599
600 /**
Matthew Barthe4338cd2017-12-14 11:14:30 -0600601 * @brief Map of groups controlling decreases allowed
602 */
603 std::map<const Group, bool> _decAllowed;
604
605 /**
Matthew Barthe59fdf72017-09-27 09:33:42 -0500606 * @brief Map of group service names
607 */
608 std::map<const Group, std::vector<Service>> _services;
609
610 /**
Matthew Bartha603ed02018-01-19 16:56:26 -0600611 * @brief Map tree of paths to services of interfaces
612 */
613 std::map<std::string,
614 std::map<std::string,
615 std::vector<std::string>>> _servTree;
616
617 /**
Matthew Barthf6b76d82017-08-04 12:58:02 -0500618 * @brief List of signal event arguments and Dbus matches for callbacks
Matthew Barth38a93a82017-05-11 14:12:27 -0500619 */
Matthew Barthf6b76d82017-08-04 12:58:02 -0500620 std::vector<SignalEvent> _signalEvents;
Matthew Barth38a93a82017-05-11 14:12:27 -0500621
622 /**
Matthew Barth90149802017-08-15 10:51:37 -0500623 * @brief List of timers for events
624 */
Matthew Barthbfb1a562017-10-05 17:03:40 -0500625 std::vector<TimerEvent> _timerEvents;
Matthew Barth90149802017-08-15 10:51:37 -0500626
627 /**
Matthew Barthcc8912e2019-01-21 11:35:27 -0600628 * @brief Save the thermal control current mode property
629 * to persisted storage
630 */
631 void saveCurrentMode();
632
633 /**
Matthew Barth9e4db252019-01-21 13:08:02 -0600634 * @brief Restore persisted thermal control current mode property
635 * value, setting the mode to "Default" otherwise
636 */
637 void restoreCurrentMode();
638
639 /**
Matthew Barth4e728542017-09-14 16:47:55 -0500640 * @brief Get the request speed base if defined, otherwise the
641 * the current target speed is returned
642 *
643 * @return - The request speed base or current target speed
644 */
645 inline auto getRequestSpeedBase() const
646 {
647 return (_requestSpeedBase != 0) ? _requestSpeedBase : _targetSpeed;
648 };
649
650 /**
Matthew Barth34f1bda2017-05-31 13:45:36 -0500651 * @brief Dbus signal change callback handler
Matthew Barth38a93a82017-05-11 14:12:27 -0500652 *
Matthew Barth34f1bda2017-05-31 13:45:36 -0500653 * @param[in] msg - Expanded sdbusplus message data
654 * @param[in] eventData - The single event's data
Matthew Barth38a93a82017-05-11 14:12:27 -0500655 */
Matthew Barth34f1bda2017-05-31 13:45:36 -0500656 void handleEvent(sdbusplus::message::message& msg,
657 const EventData* eventData);
Matt Spinler7f88fe62017-04-10 14:39:02 -0500658};
659
660}
661}
662}