Avoid redundant virtual sensor updates on unchanged values

This patch fixes a potential memory growth issue caused by handling
PropertyChanged signals without checking whether the new value
differs from the previous one.

Previously, the virtual sensor's `updateVirtualSensor()` method was
called unconditionally whenever a "Value" property change signal was
received. If a large number of D-Bus PropertyChanged signals were
forged or triggered in rapid succession with the same value (e.g.,
during stress testing), this could result in frequent unnecessary
updates, which in turn caused increased memory usage in both the
sensor process and the dbus-broker.

With this change, the handler now compares the new value with the
current stored value and only invokes `updateVirtualSensor()` when
there is a real change.

This mitigates unnecessary CPU and memory load in high signal traffic
scenarios.

Change-Id: I345188fa9e361b2cc972cdbb40c911be89a5d661
Signed-off-by: George Liu <liuxiwei@ieisystem.com>
diff --git a/dbusSensor.cpp b/dbusSensor.cpp
index 0d9733e..8b6a48f 100644
--- a/dbusSensor.cpp
+++ b/dbusSensor.cpp
@@ -111,13 +111,22 @@
 
         if (auto itr = msgData.find("Value"); itr != msgData.end())
         {
-            value = std::get<double>(itr->second);
-            if (!std::isfinite(value))
+            double tmpValue = std::get<double>(itr->second);
+            if (!std::isfinite(tmpValue))
             {
-                value = std::numeric_limits<double>::quiet_NaN();
+                if (std::isnan(value))
+                {
+                    return;
+                }
+
+                tmpValue = std::numeric_limits<double>::quiet_NaN();
             }
 
-            virtualSensor.updateVirtualSensor();
+            if (tmpValue != value)
+            {
+                value = tmpValue;
+                virtualSensor.updateVirtualSensor();
+            }
         }
     }
     catch (const std::exception& e)