DPS310 temperature pressure, SI7020 temperature

Infineon DPS310 pressure and temperature sensors for the Blyth
and Storm King Panel, as well as the Silicon Laboratories
SI7020 type sensors.  This provide OpenBMC with the ability
to have the DPS310 pressure and temperature sensors also the
Silicon Laboratories SI7020 type sensors provide OpenBMC
with temperature sensor on dbus via dbus-sensors through
HwmonTempSensor.  And adds "pressure" as a type of sensor.
Changed sensorScaleFactor to have offsetValue and scaleValue
for _raw IIO devices, scaleValue is a multiplier where
sensorScaleFactor was a divisor.  Pulling this into HwmonTempSensor
came about from this Discord discussion:
https://discord.com/channels/775381525260664832/775381525260664836/869641817220595772

Tested: on Rainier's Blyth and Everest's Storm King Op Panels
busctl tree --no-pager xyz.openbmc_project.HwmonTempSensor
busctl introspect --no-pager xyz.openbmc_project.HwmonTempSensor \
/xyz/openbmc_project/sensors/temperature/Ambient_0_Temp
busctl introspect --no-pager xyz.openbmc_project.HwmonTempSensor \
/xyz/openbmc_project/sensors/temperature/Ambient_1_Temp
busctl introspect --no-pager xyz.openbmc_project.HwmonTempSensor \
/xyz/openbmc_project/sensors/temperature/Ambient_2_Temp
busctl introspect --no-pager xyz.openbmc_project.HwmonTempSensor \
/xyz/openbmc_project/sensors/temperature/PCIE_0_Temp
busctl introspect --no-pager xyz.openbmc_project.HwmonTempSensor \
/xyz/openbmc_project/sensors/temperature/PCIE_1_Temp
busctl introspect --no-pager xyz.openbmc_project.HwmonTempSensor \
/xyz/openbmc_project/sensors/pressure/Station_Pressure
Results consistent with location of the systems.

Signed-off-by: Bruce Mitchell <bruce.mitchell@linux.vnet.ibm.com>
Change-Id: I5c0d56b486a671ee507c7bfe18fea72e7eaf9ebe
diff --git a/src/HwmonTempSensor.cpp b/src/HwmonTempSensor.cpp
index 549fff7..ba632a2 100644
--- a/src/HwmonTempSensor.cpp
+++ b/src/HwmonTempSensor.cpp
@@ -38,46 +38,49 @@
 // https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-bus-iio
 // For IIO RAW sensors we get a raw_value, an offset, and scale to compute
 // the value = (raw_value + offset) * scale
-static constexpr double sensorOffset = 0.0;
-static constexpr double sensorScale = 0.001;
-static constexpr size_t warnAfterErrorCount = 10;
-
-static constexpr double maxReading = 127;
-static constexpr double minReading = -128;
 
 HwmonTempSensor::HwmonTempSensor(
     const std::string& path, const std::string& objectType,
     sdbusplus::asio::object_server& objectServer,
     std::shared_ptr<sdbusplus::asio::connection>& conn,
     boost::asio::io_service& io, const std::string& sensorName,
-    std::vector<thresholds::Threshold>&& thresholdsIn, const float pollRate,
+    std::vector<thresholds::Threshold>&& thresholdsIn,
+    const struct SensorParams& thisSensorParameters, const float pollRate,
     const std::string& sensorConfiguration, const PowerState powerState) :
-    Sensor(escapeName(sensorName), std::move(thresholdsIn), sensorConfiguration,
-           objectType, false, false, maxReading, minReading, conn, powerState),
+    Sensor(boost::replace_all_copy(sensorName, " ", "_"),
+           std::move(thresholdsIn), sensorConfiguration, objectType, false,
+           false, thisSensorParameters.maxValue, thisSensorParameters.minValue,
+           conn, powerState),
     std::enable_shared_from_this<HwmonTempSensor>(), objServer(objectServer),
     inputDev(io, open(path.c_str(), O_RDONLY)), waitTimer(io), path(path),
+    offsetValue(thisSensorParameters.offsetValue),
+    scaleValue(thisSensorParameters.scaleValue),
     sensorPollMs(static_cast<unsigned int>(pollRate * 1000))
 {
     sensorInterface = objectServer.add_interface(
-        "/xyz/openbmc_project/sensors/temperature/" + name,
+        "/xyz/openbmc_project/sensors/" + thisSensorParameters.typeName + "/" +
+            name,
         "xyz.openbmc_project.Sensor.Value");
 
     if (thresholds::hasWarningInterface(thresholds))
     {
         thresholdInterfaceWarning = objectServer.add_interface(
-            "/xyz/openbmc_project/sensors/temperature/" + name,
+            "/xyz/openbmc_project/sensors/" + thisSensorParameters.typeName +
+                "/" + name,
             "xyz.openbmc_project.Sensor.Threshold.Warning");
     }
     if (thresholds::hasCriticalInterface(thresholds))
     {
         thresholdInterfaceCritical = objectServer.add_interface(
-            "/xyz/openbmc_project/sensors/temperature/" + name,
+            "/xyz/openbmc_project/sensors/" + thisSensorParameters.typeName +
+                "/" + name,
             "xyz.openbmc_project.Sensor.Threshold.Critical");
     }
-    association = objectServer.add_interface(
-        "/xyz/openbmc_project/sensors/temperature/" + name,
-        association::interface);
-    setInitialProperties(conn, sensor_paths::unitDegreesC);
+    association = objectServer.add_interface("/xyz/openbmc_project/sensors/" +
+                                                 thisSensorParameters.typeName +
+                                                 "/" + name,
+                                             association::interface);
+    setInitialProperties(conn, thisSensorParameters.units);
 }
 
 HwmonTempSensor::~HwmonTempSensor()
@@ -149,7 +152,7 @@
         try
         {
             rawValue = std::stod(response);
-            double nvalue = (rawValue + sensorOffset) * sensorScale;
+            double nvalue = (rawValue + offsetValue) * scaleValue;
             updateValue(nvalue);
         }
         catch (const std::invalid_argument&)