PSUSensor: Add Offset attribute

The value of "Offset" is measured by power team and is considered as the
correctest calibration value for making the sensor reading value much
more precise on the platform.

Add the customizable attribute "Offset" to be able to adjust the raw
data and than update to the "Value" property on dbus.

Tested: Add the following configuration to entity-manager
        {
            "Address": "0x68",
            "Bus": "32",
            "Labels": [
                "vout1",
                "iout1",
                "pout1",
                "temp1"
            ],
            "Name": "onboard_p12v",
            "Thresholds": [
                ...
            ],
            "Type": "RAA228000",
            "iout1_Max": 108.0,
            "iout1_Offset": -0.25,
            "pout1_Max": 900.0,
            "pout1_Offset": -5.0,
            "vout1_Max": 13.0
        },
    - Check the reading value on dbus of this sensor is equal to the
      value we expected.

Signed-off-by: Jeff Lin <JeffLin2@quantatw.com>
Change-Id: Ia741c668e1d1939d2366f2b02553a465cd3c616b
diff --git a/src/PSUSensor.cpp b/src/PSUSensor.cpp
index d323b4d..9ceda7f 100644
--- a/src/PSUSensor.cpp
+++ b/src/PSUSensor.cpp
@@ -42,14 +42,14 @@
                      std::vector<thresholds::Threshold>&& thresholdsIn,
                      const std::string& sensorConfiguration,
                      const std::string& sensorUnits, unsigned int factor,
-                     double max, double min, const std::string& label,
-                     size_t tSize, double pollRate) :
+                     double max, double min, double offset,
+                     const std::string& label, size_t tSize, double pollRate) :
     Sensor(boost::replace_all_copy(sensorName, " ", "_"),
            std::move(thresholdsIn), sensorConfiguration, objectType, false, max,
            min, conn),
     std::enable_shared_from_this<PSUSensor>(), objServer(objectServer),
     inputDev(io), waitTimer(io), path(path), pathRatedMax(""), pathRatedMin(""),
-    sensorFactor(factor), minMaxReadCounter(0)
+    sensorFactor(factor), minMaxReadCounter(0), sensorOffset(offset)
 {
     std::string unitPath = sensor_paths::getPathForUnits(sensorUnits);
     if constexpr (debug)
@@ -57,8 +57,8 @@
         std::cerr << "Constructed sensor: path " << path << " type "
                   << objectType << " config " << sensorConfiguration
                   << " typename " << unitPath << " factor " << factor << " min "
-                  << min << " max " << max << " name \"" << sensorName
-                  << "\"\n";
+                  << min << " max " << max << " offset " << offset << " name \""
+                  << sensorName << "\"\n";
     }
     if (pollRate > 0.0)
     {
@@ -181,7 +181,7 @@
         try
         {
             rawValue = std::stod(buffer);
-            updateValue(rawValue / sensorFactor);
+            updateValue((rawValue / sensorFactor) + sensorOffset);
             if (minMaxReadCounter++ % 8 == 0)
             {
                 updateMinMaxValues();