Remove support for scaling parameter sensors
Scaling parameters on integer value sensors were removed from
phosphor-dbus-interfaces a long time ago[1] in lieu of double
parameters. It has been several years since that change, and to the
projects knowlege, all sensor daemons either never produced an int64
type, or have since been converted to producing double.
Bmcweb kept compatibility for some time during the transition, but these
days it is just unused code. Remove it.
Tested: Redfish-service-validator passes.
[1] https://gerrit.openbmc.org/c/openbmc/phosphor-dbus-interfaces/+/11739
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: Ie64b093f7b787c169613bb0ff2d9f96fba8dda1a
diff --git a/redfish-core/lib/sensors.hpp b/redfish-core/lib/sensors.hpp
index ac69f26..390a2a7 100644
--- a/redfish-core/lib/sensors.hpp
+++ b/redfish-core/lib/sensors.hpp
@@ -800,19 +800,6 @@
const dbus::utility::DBusPropertiesMap& propertiesDict,
nlohmann::json& sensorJson, InventoryItem* inventoryItem)
{
- // Assume values exist as is (10^0 == 1) if no scale exists
- int64_t scaleMultiplier = 0;
-
- const int64_t* scale = nullptr;
-
- const bool success = sdbusplus::unpackPropertiesNoThrow(
- dbus_utils::UnpackErrorPrinter(), propertiesDict, "Scale", scale);
-
- if (success && scale != nullptr)
- {
- scaleMultiplier = *scale;
- }
-
if (chassisSubNode == sensors::node::sensors)
{
std::string subNodeEscaped(chassisSubNode);
@@ -1007,38 +994,19 @@
// a json_pointer for easy indexing into the json structure.
const nlohmann::json::json_pointer& key = std::get<2>(p);
- // Attempt to pull the int64 directly
- const int64_t* int64Value = std::get_if<int64_t>(&valueVariant);
-
const double* doubleValue = std::get_if<double>(&valueVariant);
- const uint32_t* uValue = std::get_if<uint32_t>(&valueVariant);
- double temp = 0.0;
- if (int64Value != nullptr)
+ if (doubleValue == nullptr)
{
- temp = static_cast<double>(*int64Value);
- }
- else if (doubleValue != nullptr)
- {
- temp = *doubleValue;
- }
- else if (uValue != nullptr)
- {
- temp = *uValue;
- }
- else
- {
- BMCWEB_LOG_ERROR
- << "Got value interface that wasn't int or double";
+ BMCWEB_LOG_ERROR << "Got value interface that wasn't double";
continue;
}
- temp = temp * std::pow(10, scaleMultiplier);
if (forceToInt)
{
- sensorJson[key] = static_cast<int64_t>(temp);
+ sensorJson[key] = static_cast<int64_t>(*doubleValue);
}
else
{
- sensorJson[key] = temp;
+ sensorJson[key] = *doubleValue;
}
}
}