Delay emission of InterfacesAdded

Make use of sdbusplus::server::object::object defered signal
emission feature so that only one InterfacesAdded signal is
emitted when creating objects.

Change-Id: I3f1668f8ea0565c7da74f750b0d4da677099924e
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
diff --git a/mainloop.cpp b/mainloop.cpp
index b2ae7ff..1bef288 100644
--- a/mainloop.cpp
+++ b/mainloop.cpp
@@ -114,6 +114,8 @@
 auto addValue(const SensorSet::key_type& sensor,
               const std::string& sysfsRoot, ObjectInfo& info)
 {
+    static constexpr bool deferSignals = true;
+
     // Get the initial value for the value interface.
     auto& bus = *std::get<sdbusplus::bus::bus*>(info);
     auto& obj = std::get<Object>(info);
@@ -127,7 +129,7 @@
     int val = 0;
     read_sysfs(sysfsPath, val);
 
-    auto iface = std::make_shared<ValueObject>(bus, objPath.c_str());
+    auto iface = std::make_shared<ValueObject>(bus, objPath.c_str(), deferSignals);
     iface->value(val);
 
     Attributes attrs;
@@ -199,6 +201,10 @@
         addThreshold<WarningObject>(i.first, sensorValue, info);
         addThreshold<CriticalObject>(i.first, sensorValue, info);
 
+        // All the interfaces have been created.  Go ahead
+        // and emit InterfacesAdded.
+        valueInterface->emit_object_added();
+
         auto value = std::make_tuple(
                          std::move(i.second),
                          std::move(label),