Refactoring of the updateValue method

Purpose of these changes is to make the method created to update any dbus
parameters, not only the `Value`, available for all classes that inherit
from the Sensor class.

This commit does following changes:
* method areDifferent is moved from the CPUSensor class to the Sensor.
* method genericUpdateValue is renamed to updateProperty and moved from
  the CPUSensor class to the Sensor.
* method updateValue is changed to utilize the updateProperty method.

Tested:
    Manual tests where done on CPUSensor. No differences detected comparing
    to results taken before these changes.

Signed-off-by: Zbigniew Kurzynski <zbigniew.kurzynski@intel.com>
Change-Id: I736526c0a128ffe094e156018fca6a883659f82a
diff --git a/src/CPUSensor.cpp b/src/CPUSensor.cpp
index 801138a..afc4706 100644
--- a/src/CPUSensor.cpp
+++ b/src/CPUSensor.cpp
@@ -142,19 +142,20 @@
                 if (auto newVal =
                         readFile(attrPath, CPUSensor::sensorScaleFactor))
                 {
-                    genericUpdateValue(oldValue, *newVal, dbusName);
+                    updateProperty(sensorInterface, oldValue, *newVal,
+                                   dbusName);
                 }
                 else
                 {
                     if (isPowerOn())
                     {
-                        genericUpdateValue(oldValue, 0, dbusName);
+                        updateProperty(sensorInterface, oldValue, 0, dbusName);
                     }
                     else
                     {
-                        genericUpdateValue(
-                            oldValue, std::numeric_limits<double>::quiet_NaN(),
-                            dbusName);
+                        updateProperty(sensorInterface, oldValue,
+                                       std::numeric_limits<double>::quiet_NaN(),
+                                       dbusName);
                     }
                 }
             }
@@ -162,34 +163,6 @@
     }
 }
 
-bool CPUSensor::areDifferent(const double& lVal, const double& rVal)
-{
-    if (std::isnan(lVal) || std::isnan(rVal))
-    {
-        return !(std::isnan(lVal) && std::isnan(rVal));
-    }
-    double diff = std::abs(lVal - rVal);
-    if (diff > hysteresisPublish)
-    {
-        return true;
-    }
-    return false;
-}
-
-void CPUSensor::genericUpdateValue(double& oldValue, const double& newValue,
-                                   const char* dbusParamName)
-{
-    if (areDifferent(oldValue, newValue))
-    {
-        oldValue = newValue;
-        if (!(sensorInterface->set_property(dbusParamName, newValue)))
-        {
-            std::cerr << "Error setting property " << dbusParamName << " to "
-                      << newValue << "\n";
-        }
-    }
-}
-
 void CPUSensor::handleResponse(const boost::system::error_code& err)
 {
     if (err == boost::system::errc::bad_file_descriptor)