blob: ff8bf8e75f4809685939c2e5570268b0c23c0a4d [file] [log] [blame]
James Feist8fd8a582018-11-16 11:10:46 -08001#pragma once
Bruce Lee1263c3d2021-06-04 15:16:33 +08002#include "dbus-sensor_config.h"
James Feist8fd8a582018-11-16 11:10:46 -08003
Ed Tanous6cb732a2021-02-18 15:33:51 -08004#include <SensorPaths.hpp>
Ed Tanous8a57ec02020-10-09 12:46:52 -07005#include <Thresholds.hpp>
6#include <Utils.hpp>
James Feist38fb5982020-05-28 10:09:54 -07007#include <sdbusplus/asio/object_server.hpp>
8
Patrick Venturefd6ba732019-10-31 14:27:39 -07009#include <limits>
10#include <memory>
Patrick Venturefd6ba732019-10-31 14:27:39 -070011#include <string>
12#include <vector>
James Feist8fd8a582018-11-16 11:10:46 -080013
James Feist1169eb42018-10-31 10:08:47 -070014constexpr size_t sensorFailedPollTimeMs = 5000;
James Feista5e58722019-04-22 14:43:11 -070015
Josh Lehan3bcd8232020-10-29 00:22:12 -070016// Enable useful logging with sensor instrumentation
17// This is intentionally not DEBUG, avoid clash with usage in .cpp files
18constexpr bool enableInstrumentation = false;
19
James Feista5e58722019-04-22 14:43:11 -070020constexpr const char* sensorValueInterface = "xyz.openbmc_project.Sensor.Value";
Jie Yang3291b9c2021-07-29 14:46:51 -070021constexpr const char* valueMutabilityInterfaceName =
22 "xyz.openbmc_project.Sensor.ValueMutability";
James Feist67601bd2020-06-16 17:14:44 -070023constexpr const char* availableInterfaceName =
24 "xyz.openbmc_project.State.Decorator.Availability";
James Feist961bf092020-07-01 16:38:12 -070025constexpr const char* operationalInterfaceName =
26 "xyz.openbmc_project.State.Decorator.OperationalStatus";
27constexpr const size_t errorThreshold = 5;
28
Josh Lehan3bcd8232020-10-29 00:22:12 -070029struct SensorInstrumentation
30{
31 // These are for instrumentation for debugging
32 int numCollectsGood = 0;
33 int numCollectsMiss = 0;
34 int numStreakGreats = 0;
35 int numStreakMisses = 0;
36 double minCollected = 0.0;
37 double maxCollected = 0.0;
38};
39
James Feist8fd8a582018-11-16 11:10:46 -080040struct Sensor
41{
James Feist930fcde2019-05-28 12:58:43 -070042 Sensor(const std::string& name,
James Feistd8705872019-02-08 13:26:09 -080043 std::vector<thresholds::Threshold>&& thresholdData,
44 const std::string& configurationPath, const std::string& objectType,
Jie Yang3291b9c2021-07-29 14:46:51 -070045 bool isSettable, bool isMutable, const double max, const double min,
James Feiste3338522020-09-15 15:40:30 -070046 std::shared_ptr<sdbusplus::asio::connection>& conn,
James Feist961bf092020-07-01 16:38:12 -070047 PowerState readState = PowerState::always) :
Ed Tanous6cb732a2021-02-18 15:33:51 -080048 name(sensor_paths::escapePathForDbus(name)),
James Feist930fcde2019-05-28 12:58:43 -070049 configurationPath(configurationPath), objectType(objectType),
Jie Yang3291b9c2021-07-29 14:46:51 -070050 isSensorSettable(isSettable), isValueMutable(isMutable), maxValue(max),
51 minValue(min), thresholds(std::move(thresholdData)),
Josh Lehan883fb3a2020-02-27 14:41:39 -080052 hysteresisTrigger((max - min) * 0.01),
James Feiste3338522020-09-15 15:40:30 -070053 hysteresisPublish((max - min) * 0.0001), dbusConnection(conn),
Josh Lehan3bcd8232020-10-29 00:22:12 -070054 readState(readState), errCount(0),
55 instrumentation(enableInstrumentation
56 ? std::make_unique<SensorInstrumentation>()
57 : nullptr)
James Feist38fb5982020-05-28 10:09:54 -070058 {}
James Feist8fd8a582018-11-16 11:10:46 -080059 virtual ~Sensor() = default;
James Feistce3fca42018-11-21 12:58:24 -080060 virtual void checkThresholds(void) = 0;
James Feistdc6c55f2018-10-31 12:53:20 -070061 std::string name;
James Feistce3fca42018-11-21 12:58:24 -080062 std::string configurationPath;
63 std::string objectType;
Bruce Lee1263c3d2021-06-04 15:16:33 +080064 bool isSensorSettable;
Jie Yang3291b9c2021-07-29 14:46:51 -070065
66 /* A flag indicates if properties of xyz.openbmc_project.Sensor.Value
67 * interface are mutable. If mutable, then
68 * xyz.openbmc_project.Sensor.ValueMutability interface will be
69 * instantiated.
70 */
71 bool isValueMutable;
James Feistce3fca42018-11-21 12:58:24 -080072 double maxValue;
73 double minValue;
James Feist8fd8a582018-11-16 11:10:46 -080074 std::vector<thresholds::Threshold> thresholds;
75 std::shared_ptr<sdbusplus::asio::dbus_interface> sensorInterface;
76 std::shared_ptr<sdbusplus::asio::dbus_interface> thresholdInterfaceWarning;
77 std::shared_ptr<sdbusplus::asio::dbus_interface> thresholdInterfaceCritical;
James Feist078f2322019-03-08 11:09:05 -080078 std::shared_ptr<sdbusplus::asio::dbus_interface> association;
James Feist67601bd2020-06-16 17:14:44 -070079 std::shared_ptr<sdbusplus::asio::dbus_interface> availableInterface;
James Feist961bf092020-07-01 16:38:12 -070080 std::shared_ptr<sdbusplus::asio::dbus_interface> operationalInterface;
Jie Yang3291b9c2021-07-29 14:46:51 -070081 std::shared_ptr<sdbusplus::asio::dbus_interface> valueMutabilityInterface;
James Feist8fd8a582018-11-16 11:10:46 -080082 double value = std::numeric_limits<double>::quiet_NaN();
Zhikui Rend3da1282020-09-11 17:02:01 -070083 double rawValue = std::numeric_limits<double>::quiet_NaN();
Richard Marian Thomaiyarc0ca7ee2019-04-24 21:22:52 +053084 bool overriddenState = false;
Richard Marian Thomaiyar87219222018-11-06 20:25:38 +053085 bool internalSet = false;
Josh Lehan883fb3a2020-02-27 14:41:39 -080086 double hysteresisTrigger;
87 double hysteresisPublish;
James Feiste3338522020-09-15 15:40:30 -070088 std::shared_ptr<sdbusplus::asio::connection> dbusConnection;
James Feist961bf092020-07-01 16:38:12 -070089 PowerState readState;
90 size_t errCount;
Josh Lehan3bcd8232020-10-29 00:22:12 -070091 std::unique_ptr<SensorInstrumentation> instrumentation;
92
Josh Lehanffe18342021-03-17 13:29:51 -070093 // This member variable provides a hook that can be used to receive
94 // notification whenever this Sensor's value is externally set via D-Bus.
95 // If interested, assign your own lambda to this variable, during
96 // construction of your Sensor subclass. See ExternalSensor for example.
97 std::function<void()> externalSetHook;
98
Jayashree Dhanapal45f27022021-12-07 12:56:35 +053099 struct ThresholdProperty
100 {
101 thresholds::Level level;
102 thresholds::Direction direction;
103 uint8_t sevOrder;
104 const char* levelProperty;
105 const char* alarmProperty;
106 const char* dirOrder;
107 };
108
109 constexpr static std::array<ThresholdProperty, 4> thresProp = {
110 {{thresholds::Level::WARNING, thresholds::Direction::HIGH, 0,
111 "WarningHigh", "WarningAlarmHigh", "greater than"},
112 {thresholds::Level::WARNING, thresholds::Direction::LOW, 0,
113 "WarningLow", "WarningAlarmLow", "less than"},
114 {thresholds::Level::CRITICAL, thresholds::Direction::HIGH, 1,
115 "CriticalHigh", "CriticalAlarmHigh", "greater than"},
116 {thresholds::Level::CRITICAL, thresholds::Direction::LOW, 1,
117 "CriticalLow", "CriticalAlarmLow", "less than"}}};
118
Josh Lehan3bcd8232020-10-29 00:22:12 -0700119 void updateInstrumentation(double readValue)
120 {
121 // Do nothing if this feature is not enabled
122 if constexpr (!enableInstrumentation)
123 {
124 return;
125 }
126 if (!instrumentation)
127 {
128 return;
129 }
130
131 // Save some typing
132 auto& inst = *instrumentation;
133
134 // Show constants if first reading (even if unsuccessful)
135 if ((inst.numCollectsGood == 0) && (inst.numCollectsMiss == 0))
136 {
137 std::cerr << "Sensor " << name << ": Configuration min=" << minValue
138 << ", max=" << maxValue << ", type=" << objectType
139 << ", path=" << configurationPath << "\n";
140 }
141
142 // Sensors can use "nan" to indicate unavailable reading
143 if (!std::isfinite(readValue))
144 {
145 // Only show this if beginning a new streak
146 if (inst.numStreakMisses == 0)
147 {
148 std::cerr << "Sensor " << name
149 << ": Missing reading, Reading counts good="
150 << inst.numCollectsGood
151 << ", miss=" << inst.numCollectsMiss
152 << ", Prior good streak=" << inst.numStreakGreats
153 << "\n";
154 }
155
156 inst.numStreakGreats = 0;
157 ++(inst.numCollectsMiss);
158 ++(inst.numStreakMisses);
159
160 return;
161 }
162
163 // Only show this if beginning a new streak and not the first time
164 if ((inst.numStreakGreats == 0) && (inst.numCollectsGood != 0))
165 {
166 std::cerr << "Sensor " << name
167 << ": Recovered reading, Reading counts good="
168 << inst.numCollectsGood
169 << ", miss=" << inst.numCollectsMiss
170 << ", Prior miss streak=" << inst.numStreakMisses << "\n";
171 }
172
173 // Initialize min/max if the first successful reading
174 if (inst.numCollectsGood == 0)
175 {
176 std::cerr << "Sensor " << name << ": First reading=" << readValue
177 << "\n";
178
179 inst.minCollected = readValue;
180 inst.maxCollected = readValue;
181 }
182
183 inst.numStreakMisses = 0;
184 ++(inst.numCollectsGood);
185 ++(inst.numStreakGreats);
186
187 // Only provide subsequent output if new min/max established
188 if (readValue < inst.minCollected)
189 {
190 std::cerr << "Sensor " << name << ": Lowest reading=" << readValue
191 << "\n";
192
193 inst.minCollected = readValue;
194 }
195
196 if (readValue > inst.maxCollected)
197 {
198 std::cerr << "Sensor " << name << ": Highest reading=" << readValue
199 << "\n";
200
201 inst.maxCollected = readValue;
202 }
203 }
James Feistce3fca42018-11-21 12:58:24 -0800204
James Feistd8705872019-02-08 13:26:09 -0800205 int setSensorValue(const double& newValue, double& oldValue)
Richard Marian Thomaiyar87219222018-11-06 20:25:38 +0530206 {
Richard Marian Thomaiyaraf6b87c2019-04-03 23:54:28 +0530207 if (!internalSet)
Richard Marian Thomaiyar87219222018-11-06 20:25:38 +0530208 {
Bruce Lee1263c3d2021-06-04 15:16:33 +0800209 if (insecureSensorOverride == false)
210 { // insecure sesnor override.
211 if (isSensorSettable == false)
212 { // sensor is not settable.
213 if (getManufacturingMode() == false)
214 { // manufacture mode is not enable.
Patrick Williams379b1132021-09-02 05:42:25 -0500215 std::cerr << "Sensor " << name
216 << ": Not allowed to set property value.\n";
217 return -EACCES;
Bruce Lee1263c3d2021-06-04 15:16:33 +0800218 }
219 }
220 }
221
Richard Marian Thomaiyar87219222018-11-06 20:25:38 +0530222 oldValue = newValue;
Richard Marian Thomaiyarc0ca7ee2019-04-24 21:22:52 +0530223 overriddenState = true;
224 // check thresholds for external set
225 value = newValue;
226 checkThresholds();
Josh Lehanffe18342021-03-17 13:29:51 -0700227
228 // Trigger the hook, as an external set has just happened
229 if (externalSetHook)
230 {
231 externalSetHook();
232 }
Richard Marian Thomaiyar87219222018-11-06 20:25:38 +0530233 }
Richard Marian Thomaiyarc0ca7ee2019-04-24 21:22:52 +0530234 else if (!overriddenState)
Richard Marian Thomaiyaraf6b87c2019-04-03 23:54:28 +0530235 {
236 oldValue = newValue;
237 }
Richard Marian Thomaiyar87219222018-11-06 20:25:38 +0530238 return 1;
239 }
James Feistce3fca42018-11-21 12:58:24 -0800240
241 void
Cheng C Yang6b1247a2020-03-09 23:48:39 +0800242 setInitialProperties(std::shared_ptr<sdbusplus::asio::connection>& conn,
Zev Weiss6b6891c2021-04-22 02:46:21 -0500243 const std::string& unit,
Ed Tanous8a57ec02020-10-09 12:46:52 -0700244 const std::string& label = std::string(),
Cheng C Yang6b1247a2020-03-09 23:48:39 +0800245 size_t thresholdSize = 0)
James Feistce3fca42018-11-21 12:58:24 -0800246 {
James Feist961bf092020-07-01 16:38:12 -0700247 if (readState == PowerState::on || readState == PowerState::biosPost)
248 {
249 setupPowerMatch(conn);
250 }
251
James Feist82bac4c2019-03-11 11:16:53 -0700252 createAssociation(association, configurationPath);
AppaRao Pulic82213c2020-02-27 01:24:58 +0530253
Zev Weiss6b6891c2021-04-22 02:46:21 -0500254 sensorInterface->register_property("Unit", unit);
James Feistce3fca42018-11-21 12:58:24 -0800255 sensorInterface->register_property("MaxValue", maxValue);
256 sensorInterface->register_property("MinValue", minValue);
257 sensorInterface->register_property(
James Feistd8705872019-02-08 13:26:09 -0800258 "Value", value, [&](const double& newValue, double& oldValue) {
James Feistce3fca42018-11-21 12:58:24 -0800259 return setSensorValue(newValue, oldValue);
260 });
James Feistd8705872019-02-08 13:26:09 -0800261 for (auto& threshold : thresholds)
James Feistce3fca42018-11-21 12:58:24 -0800262 {
Rashmica Gupta1e34cec2021-08-31 16:47:39 +1000263 if (std::isnan(threshold.hysteresis))
264 {
265 threshold.hysteresis = hysteresisTrigger;
266 }
James Feistce3fca42018-11-21 12:58:24 -0800267 std::shared_ptr<sdbusplus::asio::dbus_interface> iface;
James Feistce3fca42018-11-21 12:58:24 -0800268 if (threshold.level == thresholds::Level::CRITICAL)
269 {
270 iface = thresholdInterfaceCritical;
James Feistce3fca42018-11-21 12:58:24 -0800271 }
272 else if (threshold.level == thresholds::Level::WARNING)
273 {
274 iface = thresholdInterfaceWarning;
James Feistce3fca42018-11-21 12:58:24 -0800275 }
276 else
277 {
Jayashree Dhanapal45f27022021-12-07 12:56:35 +0530278 std::cerr << "Unknown threshold level"
279 << static_cast<int>(threshold.level) << "\n";
James Feistce3fca42018-11-21 12:58:24 -0800280 continue;
281 }
282 if (!iface)
283 {
284 std::cout << "trying to set uninitialized interface\n";
285 continue;
286 }
Cheng C Yang6b1247a2020-03-09 23:48:39 +0800287
Jayashree Dhanapal45f27022021-12-07 12:56:35 +0530288 std::string level =
289 propertyLevel(threshold.level, threshold.direction);
290 std::string alarm =
291 propertyAlarm(threshold.level, threshold.direction);
292
293 if ((level.empty()) || (alarm.empty()))
294 {
295 continue;
296 }
Cheng C Yang6b1247a2020-03-09 23:48:39 +0800297 size_t thresSize =
298 label.empty() ? thresholds.size() : thresholdSize;
James Feistce3fca42018-11-21 12:58:24 -0800299 iface->register_property(
300 level, threshold.value,
Cheng C Yang6b1247a2020-03-09 23:48:39 +0800301 [&, label, thresSize](const double& request, double& oldValue) {
James Feistce3fca42018-11-21 12:58:24 -0800302 oldValue = request; // todo, just let the config do this?
303 threshold.value = request;
304 thresholds::persistThreshold(configurationPath, objectType,
Cheng C Yang6b1247a2020-03-09 23:48:39 +0800305 threshold, conn, thresSize,
306 label);
Josh Lehan883fb3a2020-02-27 14:41:39 -0800307 // Invalidate previously remembered value,
308 // so new thresholds will be checked during next update,
309 // even if sensor reading remains unchanged.
310 value = std::numeric_limits<double>::quiet_NaN();
311
312 // Although tempting, don't call checkThresholds() from here
313 // directly. Let the regular sensor monitor call the same
314 // using updateValue(), which can check conditions like
315 // poweron, etc., before raising any event.
James Feistce3fca42018-11-21 12:58:24 -0800316 return 1;
317 });
318 iface->register_property(alarm, false);
319 }
320 if (!sensorInterface->initialize())
321 {
322 std::cerr << "error initializing value interface\n";
323 }
324 if (thresholdInterfaceWarning &&
Yong Lif902c052020-05-07 17:13:53 +0800325 !thresholdInterfaceWarning->initialize(true))
James Feistce3fca42018-11-21 12:58:24 -0800326 {
327 std::cerr << "error initializing warning threshold interface\n";
328 }
329
330 if (thresholdInterfaceCritical &&
Yong Lif902c052020-05-07 17:13:53 +0800331 !thresholdInterfaceCritical->initialize(true))
James Feistce3fca42018-11-21 12:58:24 -0800332 {
333 std::cerr << "error initializing critical threshold interface\n";
334 }
James Feist67601bd2020-06-16 17:14:44 -0700335
Jie Yang3291b9c2021-07-29 14:46:51 -0700336 if (isValueMutable)
337 {
338 valueMutabilityInterface =
339 std::make_shared<sdbusplus::asio::dbus_interface>(
340 conn, sensorInterface->get_object_path(),
341 valueMutabilityInterfaceName);
342 valueMutabilityInterface->register_property("Mutable", true);
343 if (!valueMutabilityInterface->initialize())
344 {
345 std::cerr
346 << "error initializing sensor value mutability interface\n";
347 valueMutabilityInterface = nullptr;
348 }
349 }
350
James Feist67601bd2020-06-16 17:14:44 -0700351 if (!availableInterface)
352 {
353 availableInterface =
354 std::make_shared<sdbusplus::asio::dbus_interface>(
355 conn, sensorInterface->get_object_path(),
356 availableInterfaceName);
357 availableInterface->register_property(
358 "Available", true, [this](const bool propIn, bool& old) {
359 if (propIn == old)
360 {
361 return 1;
362 }
James Feist961bf092020-07-01 16:38:12 -0700363 old = propIn;
James Feist67601bd2020-06-16 17:14:44 -0700364 if (!propIn)
365 {
366 updateValue(std::numeric_limits<double>::quiet_NaN());
367 }
James Feist67601bd2020-06-16 17:14:44 -0700368 return 1;
369 });
370 availableInterface->initialize();
371 }
James Feist961bf092020-07-01 16:38:12 -0700372 if (!operationalInterface)
373 {
374 operationalInterface =
375 std::make_shared<sdbusplus::asio::dbus_interface>(
376 conn, sensorInterface->get_object_path(),
377 operationalInterfaceName);
378 operationalInterface->register_property("Functional", true);
379 operationalInterface->initialize();
380 }
381 }
382
Jayashree Dhanapal45f27022021-12-07 12:56:35 +0530383 std::string propertyLevel(const thresholds::Level lev,
384 const thresholds::Direction dir)
385 {
386 for (ThresholdProperty prop : thresProp)
387 {
388 if ((prop.level == lev) && (prop.direction == dir))
389 {
390 return prop.levelProperty;
391 }
392 }
393 return "";
394 }
395
396 std::string propertyAlarm(const thresholds::Level lev,
397 const thresholds::Direction dir)
398 {
399 for (ThresholdProperty prop : thresProp)
400 {
401 if ((prop.level == lev) && (prop.direction == dir))
402 {
403 return prop.alarmProperty;
404 }
405 }
406 return "";
407 }
408
James Feist961bf092020-07-01 16:38:12 -0700409 bool readingStateGood()
410 {
411 if (readState == PowerState::on && !isPowerOn())
412 {
413 return false;
414 }
415 if (readState == PowerState::biosPost &&
416 (!hasBiosPost() || !isPowerOn()))
417 {
418 return false;
419 }
420
421 return true;
422 }
423
424 void markFunctional(bool isFunctional)
425 {
426 if (operationalInterface)
427 {
428 operationalInterface->set_property("Functional", isFunctional);
429 }
430 if (isFunctional)
431 {
432 errCount = 0;
433 }
434 else
435 {
436 updateValue(std::numeric_limits<double>::quiet_NaN());
437 }
438 }
439
440 void markAvailable(bool isAvailable)
441 {
442 if (availableInterface)
443 {
444 availableInterface->set_property("Available", isAvailable);
445 errCount = 0;
446 }
447 }
448
449 void incrementError()
450 {
451 if (!readingStateGood())
452 {
453 markAvailable(false);
454 return;
455 }
456
457 if (errCount >= errorThreshold)
458 {
459 return;
460 }
461
462 errCount++;
463 if (errCount == errorThreshold)
464 {
465 std::cerr << "Sensor " << name << " reading error!\n";
466 markFunctional(false);
467 }
James Feistce3fca42018-11-21 12:58:24 -0800468 }
469
James Feistd8705872019-02-08 13:26:09 -0800470 void updateValue(const double& newValue)
James Feistce3fca42018-11-21 12:58:24 -0800471 {
Richard Marian Thomaiyarc0ca7ee2019-04-24 21:22:52 +0530472 // Ignore if overriding is enabled
James Feist961bf092020-07-01 16:38:12 -0700473 if (overriddenState)
Richard Marian Thomaiyarc0ca7ee2019-04-24 21:22:52 +0530474 {
Josh Lehan883fb3a2020-02-27 14:41:39 -0800475 return;
Richard Marian Thomaiyarc0ca7ee2019-04-24 21:22:52 +0530476 }
Josh Lehan883fb3a2020-02-27 14:41:39 -0800477
James Feist961bf092020-07-01 16:38:12 -0700478 if (!readingStateGood())
479 {
480 markAvailable(false);
Adrian Ambrożewicz623723b2020-07-29 12:53:54 +0200481 updateValueProperty(std::numeric_limits<double>::quiet_NaN());
James Feist961bf092020-07-01 16:38:12 -0700482 return;
483 }
484
Adrian Ambrożewicz623723b2020-07-29 12:53:54 +0200485 updateValueProperty(newValue);
Josh Lehan3bcd8232020-10-29 00:22:12 -0700486 updateInstrumentation(newValue);
Josh Lehan883fb3a2020-02-27 14:41:39 -0800487
488 // Always check thresholds after changing the value,
489 // as the test against hysteresisTrigger now takes place in
490 // the thresholds::checkThresholds() method,
491 // which is called by checkThresholds() below,
492 // in all current implementations of sensors that have thresholds.
493 checkThresholds();
James Feist961bf092020-07-01 16:38:12 -0700494 if (!std::isnan(newValue))
495 {
496 markFunctional(true);
497 markAvailable(true);
498 }
James Feistce3fca42018-11-21 12:58:24 -0800499 }
Zbigniew Kurzynski4f45e422020-06-09 12:42:15 +0200500
501 void updateProperty(
502 std::shared_ptr<sdbusplus::asio::dbus_interface>& interface,
503 double& oldValue, const double& newValue, const char* dbusPropertyName)
504 {
505 if (requiresUpdate(oldValue, newValue))
506 {
507 oldValue = newValue;
Jae Hyun Yoo1a540b82020-07-30 23:33:18 -0700508 if (interface &&
509 !(interface->set_property(dbusPropertyName, newValue)))
Zbigniew Kurzynski4f45e422020-06-09 12:42:15 +0200510 {
511 std::cerr << "error setting property " << dbusPropertyName
512 << " to " << newValue << "\n";
513 }
514 }
515 }
516
517 bool requiresUpdate(const double& lVal, const double& rVal)
518 {
519 if (std::isnan(lVal) || std::isnan(rVal))
520 {
521 return true;
522 }
523 double diff = std::abs(lVal - rVal);
524 if (diff > hysteresisPublish)
525 {
526 return true;
527 }
528 return false;
529 }
Adrian Ambrożewicz623723b2020-07-29 12:53:54 +0200530
531 private:
532 void updateValueProperty(const double& newValue)
533 {
534 // Indicate that it is internal set call, not an external overwrite
535 internalSet = true;
536 updateProperty(sensorInterface, value, newValue, "Value");
537 internalSet = false;
538 }
Richard Marian Thomaiyarc0ca7ee2019-04-24 21:22:52 +0530539};