platform-mc: Refactor unit conversion out of constructor
This is a mostly non-functional refactor which moves code
duplicated across the two constructors to a common private
method which can be used by the constructors.
A minor side-effect introduced here is adding a new
sensorUnit member which could be used in the future.
Change-Id: I62ad69f843f1283a0695ff2ace814e454851fcf7
Signed-off-by: Amithash Prasad <amithash@meta.com>
diff --git a/platform-mc/numeric_sensor.hpp b/platform-mc/numeric_sensor.hpp
index a55c51a..c04a488 100644
--- a/platform-mc/numeric_sensor.hpp
+++ b/platform-mc/numeric_sensor.hpp
@@ -209,6 +209,9 @@
/** @brief sensorNameSpace */
std::string sensorNameSpace;
+ /** @brief Sensor Unit */
+ SensorUnit sensorUnit;
+
private:
/**
* @brief Check sensor reading if any threshold has been crossed and update
@@ -216,6 +219,11 @@
*/
void updateThresholds();
+ /**
+ * @brief Update the object units based on the PDR baseUnit
+ */
+ void setSensorUnit(uint8_t baseUnit);
+
/** @brief Create the sensor inventory path.
*
* @param[in] associationPath - sensor association path