summaryrefslogtreecommitdiff
path: root/redfish-core/lib
diff options
context:
space:
mode:
authorEd Tanous <edtanous@google.com>2022-08-10 04:42:51 +0300
committerEd Tanous <ed@tanous.net>2022-10-06 01:45:07 +0300
commit40e4f380d645c6bbe6bd8050e501203798a0c488 (patch)
tree60c3fa2054bbe8782b84cf59f0069f1749162263 /redfish-core/lib
parent23a063171f6a6baf935303e2124a6725dca2e8a0 (diff)
downloadbmcweb-40e4f380d645c6bbe6bd8050e501203798a0c488.tar.xz
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
Diffstat (limited to 'redfish-core/lib')
-rw-r--r--redfish-core/lib/sensors.hpp40
1 files changed, 4 insertions, 36 deletions
diff --git a/redfish-core/lib/sensors.hpp b/redfish-core/lib/sensors.hpp
index ac69f26db4..390a2a7bf2 100644
--- a/redfish-core/lib/sensors.hpp
+++ b/redfish-core/lib/sensors.hpp
@@ -800,19 +800,6 @@ inline void objectPropertiesToJson(
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 @@ inline void objectPropertiesToJson(
// 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;
}
}
}