Defer emitting InterfacesAdded signal until ready
Signed-off-by: Rashmica Gupta <rashmica.g@gmail.com>
Change-Id: I36b93db80fd6ff593288d107b06afd81dc1e2762
diff --git a/virtualSensor.cpp b/virtualSensor.cpp
index f0a456c..53325ff 100644
--- a/virtualSensor.cpp
+++ b/virtualSensor.cpp
@@ -398,6 +398,7 @@
/* Initialize unit value for virtual sensor */
virtualSensorPtr->ValueIface::unit(unitMap[sensorType]);
+ virtualSensorPtr->emit_object_added();
virtualSensorsMap.emplace(std::move(name),
std::move(virtualSensorPtr));
diff --git a/virtualSensor.hpp b/virtualSensor.hpp
index 6107fa1..c28e547 100644
--- a/virtualSensor.hpp
+++ b/virtualSensor.hpp
@@ -82,7 +82,7 @@
*/
VirtualSensor(sdbusplus::bus::bus& bus, const char* objPath,
const Json& sensorConfig, const std::string& name) :
- ValueObject(bus, objPath),
+ ValueObject(bus, objPath, action::defer_emit),
bus(bus), name(name)
{
initVirtualSensor(sensorConfig, objPath);