Matt Spinler | abf8da3 | 2017-04-27 14:08:45 -0500 | [diff] [blame] | 1 | #pragma once |
| 2 | |
Matt Spinler | abf8da3 | 2017-04-27 14:08:45 -0500 | [diff] [blame] | 3 | #include <sdbusplus/bus.hpp> |
| 4 | #include <sdbusplus/server.hpp> |
William A. Kennington III | 8fd879f | 2018-10-30 19:49:29 -0700 | [diff] [blame] | 5 | #include <sdeventplus/clock.hpp> |
William A. Kennington III | 1cfc2f1 | 2018-10-19 17:29:46 -0700 | [diff] [blame] | 6 | #include <sdeventplus/event.hpp> |
William A. Kennington III | 8fd879f | 2018-10-30 19:49:29 -0700 | [diff] [blame] | 7 | #include <sdeventplus/utility/timer.hpp> |
Matt Spinler | abf8da3 | 2017-04-27 14:08:45 -0500 | [diff] [blame] | 8 | |
Matthew Barth | 177fe98 | 2020-05-26 11:05:19 -0500 | [diff] [blame] | 9 | #include <chrono> |
| 10 | |
Matt Spinler | abf8da3 | 2017-04-27 14:08:45 -0500 | [diff] [blame] | 11 | namespace phosphor |
| 12 | { |
| 13 | namespace fan |
| 14 | { |
| 15 | namespace monitor |
| 16 | { |
| 17 | |
| 18 | class Fan; |
| 19 | |
Matt Spinler | 78689dd | 2017-09-28 10:12:07 -0500 | [diff] [blame] | 20 | constexpr auto FAN_SENSOR_PATH = "/xyz/openbmc_project/sensors/fan_tach/"; |
Matt Spinler | abf8da3 | 2017-04-27 14:08:45 -0500 | [diff] [blame] | 21 | |
| 22 | /** |
Matthew Barth | 0a9fe16 | 2018-01-26 12:53:15 -0600 | [diff] [blame] | 23 | * The mode fan monitor will run in: |
| 24 | * - init - only do the initialization steps |
| 25 | * - monitor - run normal monitoring algorithm |
| 26 | */ |
| 27 | enum class Mode |
| 28 | { |
| 29 | init, |
| 30 | monitor |
| 31 | }; |
| 32 | |
| 33 | /** |
Matthew Barth | 3800ae7 | 2018-02-19 16:08:04 -0600 | [diff] [blame] | 34 | * The mode that the timer is running in: |
| 35 | * - func - Transition to functional state timer |
| 36 | * - nonfunc - Transition to nonfunctional state timer |
| 37 | */ |
| 38 | enum class TimerMode |
| 39 | { |
| 40 | func, |
| 41 | nonfunc |
| 42 | }; |
| 43 | |
| 44 | /** |
Jolie Ku | 69f2f48 | 2020-10-21 09:59:43 +0800 | [diff] [blame] | 45 | * The mode that the method is running in: |
| 46 | * - time - Use a percentage based deviation |
| 47 | * - count - Run up/down count fault detection |
| 48 | */ |
| 49 | enum MethodMode |
| 50 | { |
| 51 | timebased = 0, |
| 52 | count |
| 53 | }; |
| 54 | |
| 55 | /** |
Matt Spinler | abf8da3 | 2017-04-27 14:08:45 -0500 | [diff] [blame] | 56 | * @class TachSensor |
| 57 | * |
| 58 | * This class represents the sensor that reads a tach value. |
| 59 | * It may also support a Target, which is the property used to |
| 60 | * set a speed. Since it doesn't necessarily have a Target, it |
| 61 | * won't for sure know if it is running too slow, so it leaves |
| 62 | * that determination to other code. |
| 63 | * |
| 64 | * This class has a parent Fan object that knows about all |
| 65 | * sensors for that fan. |
| 66 | */ |
| 67 | class TachSensor |
| 68 | { |
Matthew Barth | 177fe98 | 2020-05-26 11:05:19 -0500 | [diff] [blame] | 69 | public: |
| 70 | TachSensor() = delete; |
| 71 | TachSensor(const TachSensor&) = delete; |
| 72 | // TachSensor is not moveable since the this pointer is used as systemd |
| 73 | // callback context. |
| 74 | TachSensor(TachSensor&&) = delete; |
| 75 | TachSensor& operator=(const TachSensor&) = delete; |
| 76 | TachSensor& operator=(TachSensor&&) = delete; |
| 77 | ~TachSensor() = default; |
Matt Spinler | abf8da3 | 2017-04-27 14:08:45 -0500 | [diff] [blame] | 78 | |
Matthew Barth | 177fe98 | 2020-05-26 11:05:19 -0500 | [diff] [blame] | 79 | /** |
| 80 | * @brief Constructor |
| 81 | * |
| 82 | * @param[in] mode - mode of fan monitor |
| 83 | * @param[in] bus - the dbus object |
| 84 | * @param[in] fan - the parent fan object |
| 85 | * @param[in] id - the id of the sensor |
| 86 | * @param[in] hasTarget - if the sensor supports |
| 87 | * setting the speed |
| 88 | * @param[in] funcDelay - Delay to mark functional |
| 89 | * @param[in] interface - the interface of the target |
| 90 | * @param[in] factor - the factor of the sensor target |
| 91 | * @param[in] offset - the offset of the sensor target |
Jolie Ku | 69f2f48 | 2020-10-21 09:59:43 +0800 | [diff] [blame] | 92 | * @param[in] method - the method of out of range |
| 93 | * @param[in] threshold - the threshold of counter method |
Matthew Barth | 177fe98 | 2020-05-26 11:05:19 -0500 | [diff] [blame] | 94 | * @param[in] timeout - Normal timeout value to use |
Matt Spinler | f13b42e | 2020-10-26 15:29:49 -0500 | [diff] [blame] | 95 | * @param[in] errorDelay - Delay in seconds before creating an error |
| 96 | * or std::nullopt if no errors. |
| 97 | * |
Matthew Barth | 177fe98 | 2020-05-26 11:05:19 -0500 | [diff] [blame] | 98 | * @param[in] event - Event loop reference |
| 99 | */ |
| 100 | TachSensor(Mode mode, sdbusplus::bus::bus& bus, Fan& fan, |
| 101 | const std::string& id, bool hasTarget, size_t funcDelay, |
| 102 | const std::string& interface, double factor, int64_t offset, |
Jolie Ku | 69f2f48 | 2020-10-21 09:59:43 +0800 | [diff] [blame] | 103 | size_t method, size_t threshold, size_t timeout, |
| 104 | const std::optional<size_t>& errorDelay, |
Matt Spinler | f13b42e | 2020-10-26 15:29:49 -0500 | [diff] [blame] | 105 | const sdeventplus::Event& event); |
Matt Spinler | abf8da3 | 2017-04-27 14:08:45 -0500 | [diff] [blame] | 106 | |
Matthew Barth | 177fe98 | 2020-05-26 11:05:19 -0500 | [diff] [blame] | 107 | /** |
Matthew Barth | c8c8ccf | 2021-01-26 14:55:22 -0600 | [diff] [blame^] | 108 | * @brief Reads a property from the input message and stores it in value. |
| 109 | * T is the value type. |
| 110 | * |
| 111 | * Note: This can only be called once per message. |
| 112 | * |
| 113 | * @param[in] msg - the dbus message that contains the data |
| 114 | * @param[in] interface - the interface the property is on |
| 115 | * @param[in] propertName - the name of the property |
| 116 | * @param[out] value - the value to store the property value in |
| 117 | */ |
| 118 | template <typename T> |
| 119 | static void readPropertyFromMessage(sdbusplus::message::message& msg, |
| 120 | const std::string& interface, |
| 121 | const std::string& propertyName, |
| 122 | T& value) |
| 123 | { |
| 124 | std::string sensor; |
| 125 | std::map<std::string, std::variant<T>> data; |
| 126 | msg.read(sensor, data); |
| 127 | |
| 128 | if (sensor.compare(interface) == 0) |
| 129 | { |
| 130 | auto propertyMap = data.find(propertyName); |
| 131 | if (propertyMap != data.end()) |
| 132 | { |
| 133 | value = std::get<T>(propertyMap->second); |
| 134 | } |
| 135 | } |
| 136 | } |
| 137 | |
| 138 | /** |
Matthew Barth | 177fe98 | 2020-05-26 11:05:19 -0500 | [diff] [blame] | 139 | * @brief Returns the target speed value |
| 140 | */ |
| 141 | uint64_t getTarget() const; |
Matt Spinler | abf8da3 | 2017-04-27 14:08:45 -0500 | [diff] [blame] | 142 | |
Matthew Barth | 177fe98 | 2020-05-26 11:05:19 -0500 | [diff] [blame] | 143 | /** |
| 144 | * @brief Returns the input speed value |
| 145 | */ |
Matthew Barth | 0891e3b | 2020-08-13 12:00:23 -0500 | [diff] [blame] | 146 | inline double getInput() const |
Matthew Barth | 177fe98 | 2020-05-26 11:05:19 -0500 | [diff] [blame] | 147 | { |
| 148 | return _tachInput; |
| 149 | } |
Matt Spinler | abf8da3 | 2017-04-27 14:08:45 -0500 | [diff] [blame] | 150 | |
Matthew Barth | 177fe98 | 2020-05-26 11:05:19 -0500 | [diff] [blame] | 151 | /** |
| 152 | * @brief Returns true if sensor has a target |
| 153 | */ |
| 154 | inline bool hasTarget() const |
| 155 | { |
| 156 | return _hasTarget; |
| 157 | } |
Matt Spinler | abf8da3 | 2017-04-27 14:08:45 -0500 | [diff] [blame] | 158 | |
Matthew Barth | 177fe98 | 2020-05-26 11:05:19 -0500 | [diff] [blame] | 159 | /** |
| 160 | * @brief Returns the interface of the sensor target |
| 161 | */ |
| 162 | inline std::string getInterface() const |
| 163 | { |
| 164 | return _interface; |
| 165 | } |
Matt Spinler | abf8da3 | 2017-04-27 14:08:45 -0500 | [diff] [blame] | 166 | |
Matthew Barth | 177fe98 | 2020-05-26 11:05:19 -0500 | [diff] [blame] | 167 | /** |
| 168 | * @brief Returns the factor of the sensor target |
| 169 | */ |
| 170 | inline double getFactor() const |
| 171 | { |
| 172 | return _factor; |
| 173 | } |
Lei YU | 80f271b | 2018-01-31 15:24:46 +0800 | [diff] [blame] | 174 | |
Matthew Barth | 177fe98 | 2020-05-26 11:05:19 -0500 | [diff] [blame] | 175 | /** |
| 176 | * @brief Returns the offset of the sensor target |
| 177 | */ |
| 178 | inline int64_t getOffset() const |
| 179 | { |
| 180 | return _offset; |
| 181 | } |
Lei YU | 8e5d197 | 2018-01-26 17:14:00 +0800 | [diff] [blame] | 182 | |
Matthew Barth | 177fe98 | 2020-05-26 11:05:19 -0500 | [diff] [blame] | 183 | /** |
Jolie Ku | 69f2f48 | 2020-10-21 09:59:43 +0800 | [diff] [blame] | 184 | * @brief Returns the method of out of range |
| 185 | */ |
| 186 | inline size_t getMethod() const |
| 187 | { |
| 188 | return _method; |
| 189 | } |
| 190 | |
| 191 | /** |
| 192 | * @brief Returns the threshold of count method |
| 193 | */ |
| 194 | inline size_t getThreshold() const |
| 195 | { |
| 196 | return _threshold; |
| 197 | } |
| 198 | |
| 199 | /** |
| 200 | * Set the sensor faulted counter |
| 201 | */ |
| 202 | void setCounter(bool count); |
| 203 | |
| 204 | /** |
| 205 | * @brief Returns the sensor faulted count |
| 206 | */ |
| 207 | inline size_t getCounter() const |
| 208 | { |
| 209 | return _counter; |
| 210 | } |
| 211 | |
| 212 | /** |
Matthew Barth | 177fe98 | 2020-05-26 11:05:19 -0500 | [diff] [blame] | 213 | * Returns true if the hardware behind this |
| 214 | * sensor is considered working OK/functional. |
| 215 | */ |
| 216 | inline bool functional() const |
| 217 | { |
| 218 | return _functional; |
| 219 | } |
Lei YU | 8e5d197 | 2018-01-26 17:14:00 +0800 | [diff] [blame] | 220 | |
Matthew Barth | 177fe98 | 2020-05-26 11:05:19 -0500 | [diff] [blame] | 221 | /** |
| 222 | * Set the functional status and update inventory to match |
| 223 | */ |
| 224 | void setFunctional(bool functional); |
Matt Spinler | abf8da3 | 2017-04-27 14:08:45 -0500 | [diff] [blame] | 225 | |
Matthew Barth | 177fe98 | 2020-05-26 11:05:19 -0500 | [diff] [blame] | 226 | /** |
| 227 | * @brief Says if the timer is running or not |
| 228 | * |
| 229 | * @return bool - if timer is currently running |
| 230 | */ |
| 231 | inline bool timerRunning() |
| 232 | { |
| 233 | return _timer.isEnabled(); |
| 234 | } |
Matt Spinler | abf8da3 | 2017-04-27 14:08:45 -0500 | [diff] [blame] | 235 | |
Matthew Barth | 177fe98 | 2020-05-26 11:05:19 -0500 | [diff] [blame] | 236 | /** |
| 237 | * @brief Stops the timer when the given mode differs and starts |
| 238 | * the associated timer for the mode given if not already running |
| 239 | * |
| 240 | * @param[in] mode - mode of timer to start |
| 241 | */ |
| 242 | void startTimer(TimerMode mode); |
Matt Spinler | 6fa181c | 2017-09-27 16:24:45 -0500 | [diff] [blame] | 243 | |
Matthew Barth | 177fe98 | 2020-05-26 11:05:19 -0500 | [diff] [blame] | 244 | /** |
| 245 | * @brief Stops the timer |
| 246 | */ |
| 247 | inline void stopTimer() |
| 248 | { |
| 249 | _timer.setEnabled(false); |
| 250 | } |
Matt Spinler | 6fa181c | 2017-09-27 16:24:45 -0500 | [diff] [blame] | 251 | |
Matthew Barth | 177fe98 | 2020-05-26 11:05:19 -0500 | [diff] [blame] | 252 | /** |
| 253 | * @brief Return the given timer mode's delay time |
| 254 | * |
| 255 | * @param[in] mode - mode of timer to get delay time for |
| 256 | */ |
| 257 | std::chrono::microseconds getDelay(TimerMode mode); |
Matt Spinler | a9406a7 | 2017-04-27 14:29:24 -0500 | [diff] [blame] | 258 | |
Matthew Barth | 177fe98 | 2020-05-26 11:05:19 -0500 | [diff] [blame] | 259 | /** |
| 260 | * Returns the sensor name |
| 261 | */ |
| 262 | inline const std::string& name() const |
| 263 | { |
| 264 | return _name; |
| 265 | }; |
Matt Spinler | a9406a7 | 2017-04-27 14:29:24 -0500 | [diff] [blame] | 266 | |
Matt Spinler | f13b42e | 2020-10-26 15:29:49 -0500 | [diff] [blame] | 267 | /** |
| 268 | * @brief Says if the error timer is running |
| 269 | * |
| 270 | * @return bool - If the timer is running |
| 271 | */ |
| 272 | bool errorTimerRunning() const |
| 273 | { |
| 274 | if (_errorTimer && _errorTimer->isEnabled()) |
| 275 | { |
| 276 | return true; |
| 277 | } |
| 278 | return false; |
| 279 | } |
| 280 | |
Matthew Barth | 177fe98 | 2020-05-26 11:05:19 -0500 | [diff] [blame] | 281 | private: |
| 282 | /** |
| 283 | * @brief Returns the match string to use for matching |
| 284 | * on a properties changed signal. |
| 285 | */ |
| 286 | std::string getMatchString(const std::string& interface); |
Matt Spinler | ce75b51 | 2017-07-26 15:10:48 -0500 | [diff] [blame] | 287 | |
Matthew Barth | 177fe98 | 2020-05-26 11:05:19 -0500 | [diff] [blame] | 288 | /** |
| 289 | * @brief Reads the Target property and stores in _tachTarget. |
| 290 | * Also calls Fan::tachChanged(). |
| 291 | * |
| 292 | * @param[in] msg - the dbus message |
| 293 | */ |
| 294 | void handleTargetChange(sdbusplus::message::message& msg); |
Matt Spinler | abf8da3 | 2017-04-27 14:08:45 -0500 | [diff] [blame] | 295 | |
Matthew Barth | 177fe98 | 2020-05-26 11:05:19 -0500 | [diff] [blame] | 296 | /** |
| 297 | * @brief Reads the Value property and stores in _tachInput. |
| 298 | * Also calls Fan::tachChanged(). |
| 299 | * |
| 300 | * @param[in] msg - the dbus message |
| 301 | */ |
| 302 | void handleTachChange(sdbusplus::message::message& msg); |
Matt Spinler | ebaae61 | 2017-04-27 14:21:48 -0500 | [diff] [blame] | 303 | |
Matthew Barth | 177fe98 | 2020-05-26 11:05:19 -0500 | [diff] [blame] | 304 | /** |
| 305 | * @brief Updates the Functional property in the inventory |
| 306 | * for this tach sensor based on the value passed in. |
| 307 | * |
| 308 | * @param[in] functional - If the Functional property should |
| 309 | * be set to true or false. |
| 310 | */ |
| 311 | void updateInventory(bool functional); |
Matt Spinler | ebaae61 | 2017-04-27 14:21:48 -0500 | [diff] [blame] | 312 | |
Matthew Barth | 177fe98 | 2020-05-26 11:05:19 -0500 | [diff] [blame] | 313 | /** |
| 314 | * @brief the dbus object |
| 315 | */ |
| 316 | sdbusplus::bus::bus& _bus; |
Matt Spinler | ebaae61 | 2017-04-27 14:21:48 -0500 | [diff] [blame] | 317 | |
Matthew Barth | 177fe98 | 2020-05-26 11:05:19 -0500 | [diff] [blame] | 318 | /** |
| 319 | * @brief Reference to the parent Fan object |
| 320 | */ |
| 321 | Fan& _fan; |
Matt Spinler | ebaae61 | 2017-04-27 14:21:48 -0500 | [diff] [blame] | 322 | |
Matthew Barth | 177fe98 | 2020-05-26 11:05:19 -0500 | [diff] [blame] | 323 | /** |
| 324 | * @brief The name of the sensor, including the full path |
| 325 | * |
| 326 | * For example /xyz/openbmc_project/sensors/fan_tach/fan0 |
| 327 | */ |
| 328 | const std::string _name; |
Matt Spinler | abf8da3 | 2017-04-27 14:08:45 -0500 | [diff] [blame] | 329 | |
Matthew Barth | 177fe98 | 2020-05-26 11:05:19 -0500 | [diff] [blame] | 330 | /** |
| 331 | * @brief The inventory name of the sensor, including the full path |
| 332 | */ |
| 333 | const std::string _invName; |
Matt Spinler | abf8da3 | 2017-04-27 14:08:45 -0500 | [diff] [blame] | 334 | |
Matthew Barth | 177fe98 | 2020-05-26 11:05:19 -0500 | [diff] [blame] | 335 | /** |
| 336 | * @brief If functional (not too slow). The parent |
| 337 | * fan object sets this. |
| 338 | */ |
| 339 | bool _functional; |
Matt Spinler | abf8da3 | 2017-04-27 14:08:45 -0500 | [diff] [blame] | 340 | |
Matthew Barth | 177fe98 | 2020-05-26 11:05:19 -0500 | [diff] [blame] | 341 | /** |
| 342 | * @brief If the sensor has a Target property (can set speed) |
| 343 | */ |
| 344 | const bool _hasTarget; |
Matthew Barth | 4d98285 | 2017-11-17 09:37:13 -0600 | [diff] [blame] | 345 | |
Matthew Barth | 177fe98 | 2020-05-26 11:05:19 -0500 | [diff] [blame] | 346 | /** |
| 347 | * @brief Amount of time to delay updating to functional |
| 348 | */ |
| 349 | const size_t _funcDelay; |
Matt Spinler | abf8da3 | 2017-04-27 14:08:45 -0500 | [diff] [blame] | 350 | |
Matthew Barth | 177fe98 | 2020-05-26 11:05:19 -0500 | [diff] [blame] | 351 | /** |
| 352 | * @brief The interface that the target implements |
| 353 | */ |
| 354 | const std::string _interface; |
Matt Spinler | abf8da3 | 2017-04-27 14:08:45 -0500 | [diff] [blame] | 355 | |
Matthew Barth | 177fe98 | 2020-05-26 11:05:19 -0500 | [diff] [blame] | 356 | /** |
| 357 | * @brief The factor of target to get fan rpm |
| 358 | */ |
| 359 | const double _factor; |
Matthew Barth | 9396bcc | 2018-02-19 14:13:20 -0600 | [diff] [blame] | 360 | |
Matthew Barth | 177fe98 | 2020-05-26 11:05:19 -0500 | [diff] [blame] | 361 | /** |
| 362 | * @brief The offset of target to get fan rpm |
| 363 | */ |
| 364 | const int64_t _offset; |
Lei YU | 80f271b | 2018-01-31 15:24:46 +0800 | [diff] [blame] | 365 | |
Matthew Barth | 177fe98 | 2020-05-26 11:05:19 -0500 | [diff] [blame] | 366 | /** |
Jolie Ku | 69f2f48 | 2020-10-21 09:59:43 +0800 | [diff] [blame] | 367 | * @brief The method of out of range |
| 368 | */ |
| 369 | const size_t _method; |
| 370 | |
| 371 | /** |
| 372 | * @brief The threshold for count method |
| 373 | */ |
| 374 | const size_t _threshold; |
| 375 | |
| 376 | /** |
| 377 | * @brief The counter for count method |
| 378 | */ |
| 379 | size_t _counter = 0; |
| 380 | |
| 381 | /** |
Matthew Barth | 177fe98 | 2020-05-26 11:05:19 -0500 | [diff] [blame] | 382 | * @brief The input speed, from the Value dbus property |
| 383 | */ |
Matthew Barth | 0891e3b | 2020-08-13 12:00:23 -0500 | [diff] [blame] | 384 | double _tachInput = 0; |
Lei YU | 8e5d197 | 2018-01-26 17:14:00 +0800 | [diff] [blame] | 385 | |
Matthew Barth | 177fe98 | 2020-05-26 11:05:19 -0500 | [diff] [blame] | 386 | /** |
| 387 | * @brief The current target speed, from the Target dbus property |
| 388 | * (if applicable) |
| 389 | */ |
| 390 | uint64_t _tachTarget = 0; |
Lei YU | 8e5d197 | 2018-01-26 17:14:00 +0800 | [diff] [blame] | 391 | |
Matthew Barth | 177fe98 | 2020-05-26 11:05:19 -0500 | [diff] [blame] | 392 | /** |
| 393 | * @brief The timeout value to use |
| 394 | */ |
| 395 | const size_t _timeout; |
Matt Spinler | abf8da3 | 2017-04-27 14:08:45 -0500 | [diff] [blame] | 396 | |
Matthew Barth | 177fe98 | 2020-05-26 11:05:19 -0500 | [diff] [blame] | 397 | /** |
| 398 | * @brief Mode that current timer is in |
| 399 | */ |
| 400 | TimerMode _timerMode; |
Matt Spinler | abf8da3 | 2017-04-27 14:08:45 -0500 | [diff] [blame] | 401 | |
Matthew Barth | 177fe98 | 2020-05-26 11:05:19 -0500 | [diff] [blame] | 402 | /** |
| 403 | * The timer object |
| 404 | */ |
| 405 | sdeventplus::utility::Timer<sdeventplus::ClockId::Monotonic> _timer; |
Matt Spinler | ebaae61 | 2017-04-27 14:21:48 -0500 | [diff] [blame] | 406 | |
Matthew Barth | 177fe98 | 2020-05-26 11:05:19 -0500 | [diff] [blame] | 407 | /** |
| 408 | * @brief The match object for the Value properties changed signal |
| 409 | */ |
| 410 | std::unique_ptr<sdbusplus::server::match::match> tachSignal; |
Matthew Barth | 3800ae7 | 2018-02-19 16:08:04 -0600 | [diff] [blame] | 411 | |
Matthew Barth | 177fe98 | 2020-05-26 11:05:19 -0500 | [diff] [blame] | 412 | /** |
| 413 | * @brief The match object for the Target properties changed signal |
| 414 | */ |
| 415 | std::unique_ptr<sdbusplus::server::match::match> targetSignal; |
Matt Spinler | f13b42e | 2020-10-26 15:29:49 -0500 | [diff] [blame] | 416 | |
| 417 | /** |
| 418 | * @brief The number of seconds to wait between a sensor being set |
| 419 | * to nonfunctional and creating an error for it. |
| 420 | * |
| 421 | * If std::nullopt, no errors will be created. |
| 422 | */ |
| 423 | const std::optional<size_t> _errorDelay; |
| 424 | |
| 425 | /** |
| 426 | * @brief The timer that uses _errorDelay. When it expires an error |
| 427 | * will be created for a faulted fan sensor (rotor). |
| 428 | * |
| 429 | * If _errorDelay is std::nullopt, then this won't be created. |
| 430 | */ |
| 431 | std::unique_ptr< |
| 432 | sdeventplus::utility::Timer<sdeventplus::ClockId::Monotonic>> |
| 433 | _errorTimer; |
Matt Spinler | abf8da3 | 2017-04-27 14:08:45 -0500 | [diff] [blame] | 434 | }; |
| 435 | |
Matthew Barth | 177fe98 | 2020-05-26 11:05:19 -0500 | [diff] [blame] | 436 | } // namespace monitor |
| 437 | } // namespace fan |
| 438 | } // namespace phosphor |