added support for onChange report
Report is now notified when metric changes and updates reading values.
Tested:
- Added new unit tests
- OnChange report updates Readings when metric values changes
Change-Id: I3be9ef7aa0486cb15bac627aa1de5cc632613b3b
Signed-off-by: Krzysztof Grobelny <krzysztof.grobelny@intel.com>
diff --git a/src/sensor.cpp b/src/sensor.cpp
index 2551562..387d0d5 100644
--- a/src/sensor.cpp
+++ b/src/sensor.cpp
@@ -107,17 +107,7 @@
{
timestamp = Clock().steadyTimestamp();
- if (value == newValue)
- {
- for (const auto& weakListener : listeners)
- {
- if (auto listener = weakListener.lock())
- {
- listener->sensorUpdated(*this, timestamp);
- }
- }
- }
- else
+ if (value != newValue)
{
value = newValue;