Add unit to health sensor
Added unit property in dbus
Tested:
Verfied by running on target and querying unit peoperty from dbus
busctl get-property xyz.openbmc_project.HealthMon
/xyz/openbmc_project/sensors/utilization/Memory
xyz.openbmc_project.Sensor.Value Unit
Signed-off-by: Vijay Khemka <vijaykhemka@fb.com>
Change-Id: I3a4fe71e83992688cdcdd2bdff9c2037558cf12d
diff --git a/healthMonitor.cpp b/healthMonitor.cpp
index f7ca6ce..a04ff37 100644
--- a/healthMonitor.cpp
+++ b/healthMonitor.cpp
@@ -162,11 +162,15 @@
return;
}
- /* Initialize value queue with initail sensor reading */
+ /* Initialize value queue with initial sensor reading */
for (int i = 0; i < sensorConfig.windowSize; i++)
{
valQueue.push_back(value);
}
+
+ /* Initialize unit value (Percent) for utilization sensor */
+ ValueIface::unit(ValueIface::Unit::Percent);
+
setSensorValueToDbus(value);
/* Start the timer for reading sensor data at regular interval */