OnChange trigger should not handle first reading

When OnChange trigger register for updates, it gets current sensor value
as an update. This reading fires trigger actions and is undesirable.

This change skips handling of first reading update for OnChange trigger.

Testing done:
- UTs updated and are passing,
- OnChange trigger is not doing an action on first reading update.

Signed-off-by: Szymon Dompke <szymon.dompke@intel.com>
Change-Id: Ief2d1edd5923fd332f3ea3234a9988e1967d972f
diff --git a/tests/src/test_on_change_threshold.cpp b/tests/src/test_on_change_threshold.cpp
index 0c3b301..60697da 100644
--- a/tests/src/test_on_change_threshold.cpp
+++ b/tests/src/test_on_change_threshold.cpp
@@ -64,6 +64,14 @@
     EXPECT_EQ(sut->getThresholdParam(), expected);
 }
 
+TEST_F(TestOnChangeThreshold, firstReadingDoesNoActionCommit)
+{
+    EXPECT_CALL(actionMock, commit(_, _, _)).Times(0);
+
+    sut->initialize();
+    sut->sensorUpdated(*sensorMocks.front(), 0ms, 42);
+}
+
 struct OnChangeParams
 {
     using UpdateParams = std::tuple<size_t, Milliseconds, double>;
@@ -141,6 +149,10 @@
     }
 
     sut->initialize();
+
+    // First reading will be skipped
+    sut->sensorUpdated(*sensorMocks.front(), 0ms, 42);
+
     for (const auto& [index, timestamp, value] : GetParam().updates)
     {
         sut->sensorUpdated(*sensorMocks[index], timestamp, value);