Sensors: Move objectPropertiesToJson() to sensor_utils
This commit move objectPropertiesToJson() to the sensor_utils class.
This is in preparation for building sensor excerpts using the same code
which builds a sensor. By moving the function into the sensor utility
class it should help with compile time by not needing to include all of
sensor code by the files implementing the excerpts.
Additional functions and definitions were moved into the sensor_utils
class as well due to dependencies from objectPropertiesToJson().
Tested:
- Confirmed output unchanged for following URI:
- /redfish/v1/Chassis/chassis/Sensors
- Selection of: /redfish/v1/Chassis/chassis/Sensors/<sensorId>
- /redfish/v1/Chassis/chassis/Sensors?\$expand=*
- Redfish Validator passes
Change-Id: I563a560b5b2760e0421c1402d51216101af40be2
Signed-off-by: Janet Adkins <janeta@us.ibm.com>
diff --git a/redfish-core/lib/power.hpp b/redfish-core/lib/power.hpp
index c914cee..ea1e00a 100644
--- a/redfish-core/lib/power.hpp
+++ b/redfish-core/lib/power.hpp
@@ -24,6 +24,7 @@
#include "sensors.hpp"
#include "utils/chassis_utils.hpp"
#include "utils/json_utils.hpp"
+#include "utils/sensor_utils.hpp"
#include <sdbusplus/asio/property.hpp>
@@ -182,7 +183,7 @@
}
// LimitException is Mandatory attribute as per OCP
- // Baseline Profile – v1.0.0, so currently making it
+ // Baseline Profile - v1.0.0, so currently making it
// "NoAction" as default value to make it OCP Compliant.
sensorJson["PowerLimit"]["LimitException"] =
power::PowerLimitException::NoAction;
@@ -268,7 +269,7 @@
auto sensorAsyncResp = std::make_shared<SensorsAsyncResp>(
asyncResp, chassisName, sensors::dbus::powerPaths,
- sensors::node::power);
+ sensor_utils::powerNode);
getChassisData(sensorAsyncResp);
@@ -297,7 +298,7 @@
}
auto sensorAsyncResp = std::make_shared<SensorsAsyncResp>(
asyncResp, chassisName, sensors::dbus::powerPaths,
- sensors::node::power);
+ sensor_utils::powerNode);
std::optional<std::vector<nlohmann::json::object_t>> voltageCollections;
std::optional<std::vector<nlohmann::json::object_t>> powerCtlCollections;